I have a requirement wherein I have to save a large number of parameters from UI to database (Oracle 11g). There's also some business logic involved, so I have decided to use a Stored Procedure. But passing around 100 parameters to stored procedure seems ugly and performance intensive.
There's an option of using Object Types, but that's Oracle specific. Is there a generic solution to tackle this problem?
Even a non stored procedure approach is welcome.
Related
Today we got a new direction from management to use only stored procedures instead of SQL queries in Tibco BW. I'm new to tibco and worked only in couple of projects. Can someone help me to understand what added advantage will bring if we use stored procedure in Tibco? Also every process might be using 10 different queries. So if we add that many stored procedures and create indexes and maintain them is it worth on the whole for 50+ processes? I'm having hard time to present Advantages Vs disadvantages
People are used to queries and this is why a lot of times are skeptical when it comes to Stored Procedures. Use your databases' capabilities at its fullest. Do not depend only on your back end programming language. Database programming is very powerful. Stored procedures for complicated logic are usually faster than your typical query. Make sure you plan carefully what the Stored Procedure needs to do and also different scenarios within the stored procedure. Once you get used to it you will not want to do not use them.
The secret is to maintain a current and well written documentation of your stored procedures.
As an organization we are moving towards the purchase of ODI as an ELT tool.
We have plenty of PLSQL resource but I have heard ODI is powerful enough at data manipulation to replace much of what was previously done in PLSQL.
What are its strengths? And weaknesses?
And can it completely do away with coding the data transformation in PLSQL?
No, it doesn't however you might be 99% correct here.
It's actually a tricky question as PL/SQL might be submitted by ODI too.
I would reserve it (PL/SQL) for defining functions/procedures (if you REALLY need to) to be later called by ODI.
This should NEVER be something immediately related to ETL like INSERT INTO … SELECT … FROM … - that's where ODI fits the bill perfectly.
The only justified cases, I came across during my ODI experience (9yrs) were:
- creating PL/SQL function to authenticate (and later authorize through OBIEE) an LDAP/AD user
- creating helper functions to be later called by ODI DQ(CKM) modules like is_number, is_date
- creating XML files directly by DB (even with never ODI XML driver you might still find it's best to use native DB XML API/functionality to produce XML) - for performance reasons. Other direct file operations (load/unload) could be done in this way.
- creating my own (optimized) hierarchy traversal query for performance reasons (beaten the standard Oracle SQL 'Recursive Subquery Factoring' feature to about 1000:1)
It's up to you if you want to make a reusable piece of logic by using PL/SQL and call it from ODI or code it from ODI directly (in the PL/SQL form)
I have a requirement to send couple of List<> objects to the Oracle store procedure. I can do it using ODP.
But I just want to confirm that can it be possible with the System.Data.OracleClient.
System.Data.OracleClient does not accept Lists as parameters to stored procedures. In fact, it doesn't allow standard Arrays either. Really the only thing you can do is serialize the data encapsulated in the List and pass it into the stored procedure as a String (Varchar2) and then split it within the procedure. But that really depends on what sort of data your Lists contain, and how dynamic it is.
I'm using Oracle 9.2x to do some xmltype data manipulation.
The table as simple as tabls(xml sys.xmltype), with like 10000 rows stored. Now I use a cursor to loop every row, then doing like
table.xml.extract('//.../text()','...').getStringVal();
I notice the oracle instance and the uga/pga keep allocating memory per execution of xmltype.extract() function, until running out of the machine's available memory, even when the dbms_session.free_unused_user_memory() is executed per call of extract().
If the session is closed, then the memory used by the Oracle instance returns right away to as before the execution.
I'm wondering, how to free/deallocate those memory allocated by extract function in same session?
Thanks.
--
John
PL/SQL variables and instantiated objects are some in session memory, which is why your programming is hitting the PGA rather than the SGA. Without knowing some context it is difficult for us to give you some specific advice. The general advice would be to consider how you could reduce the footprint of the variables in your PL/SQL.
For instance, you could include the extract() in the SQL statement rather than doing it in PL/SQL; retrieving just the data you want is always an efficient thing to do. Another possibility would be to use BULK COLLECT with the LIMIT clause to reduce the amount of data you're handling at any one point. A third approach might be to do away with the PL/SQL altogether and just use pure SQL. Pure SQL is way more efficient than switching between SQL and PL/SQL, because sets are better than RBAR. But like I said, because you haven't told us more about what you're trying to achieve we cannot tell whether your CURSOR LOOP is appropriate.
I have to develop one program that consists data manipulation (retrieve data, update data and new insert data) to multiple tables. Which will be suitable approach and faster in performance using DataSet object and stored procedure with CURSOR object? Please point me out. Thanks you all!
Data manipulation is typically faster when done in the DB in the stored procedure.
Unless there is a reason you have to do the manipulation within the application, do it on the DB itself.
I sugget to go for ORM aproach like Entety Framework , LINQ to SQL or Nhibernate you both get better performance and greater development speed.