Category Archive Template
21st Century PL/SQLYour chance to influence the direction of the Oracle PL/SQL language. |
|||||
|
SQL processing inside PL/SQL > Bulk processing FORALL and BULK COLLECT Oracle introduced FORALL and BULK COLLECT in Oracle8i and has improved upon them steadily. They allow you to perform DML and queries much more efficiently than with row-by-row processing. Ideas within Bulk processing FORALL and BULK COLLECT
April 04, 2005Assigning Index using bulk collectWhen populating pl/sql table using bulk collect, assign index value using a column from the sql statement. For example: select itemID, desc bulk collect into l_itemID, l_plsql_table[itemID].desc from items; Right now to do this we've to loop thru the data and set the index. Posted by Uday K at 01:08 AM | Add your thoughts (2) April 06, 2005Allow RETURNING for INSERT....SELECTAllow RETURNING for INSERT....SELECT and similar SQL statements: FORALL .. Posted by gary myers at 03:33 AM | Add your thoughts (2) Incremental bulk processingThere should be a provision to incrementally bulk collect the query columns in a select statement into a plsql collection.for e.g.
select *
bulk collect into emp_tab emp_tab should be populated with emp in increments of 100. Currently there is a limit clause. But you have to keep two plsql tables, one to bulk collect and another in which the results are appended. If the increment clause is there, then this can be avoided, and also coding will be more elegant. A more thorough explanation follows. Consider a table with nearly 5 million rows. In case for some purpose you
need to bulk collect 50000 rows, in to a plsql table for some processing. Posted by viswanathan venkat ramanan at 08:44 AM | Add your thoughts (0) April 12, 2005Add ERROR_MESSAGE to SQL%BULK_EXCEPTIONSRight now this pseudo-collection has ERROR_INDEX and ERROR_CODE fields, which is great. The problem is that we lose the specific error information, which is held in the error message and not the code. So if you save this value as well when the error occurs during FORALL processing, we will be able to log and/or recover more effectively.Posted by sf at 07:44 AM | Add your thoughts (0) June 30, 2005Returning * from DELETEYou can now write:SELECT * BULK COLLECT INTO vLst FROM MyTable;It is strange that you cannot write: DELETE FROM MyTable RETURNING * BULK COLLECT INTO vLst;It seems that RETURNING * is not supported. Instead, I have to write RETURNING col1, col2... Posted by John Ng at 09:13 PM | Add your thoughts (0) |
Sidebar Template Search Template Search 21st Century PL/SQLActions Template ActionsIdeas List Template Browse Categories
|
||||