I created an oracle Object Type like this:
CREATE OR REPLACE TYPE DFBOWNER."RPT_WIRE_IMPORT_ROWTYPE" AS OBJECT
(
REC_VALUE_DATE DATE
)
/
And then a collection based on this type:
CREATE OR REPLACE TYPE DFBOWNER."RPT_WIRE_IMPORT_TABLETYPE" IS TABLE OF RPT_WIRE_IMPORT_RowType;
/
Now I populate the collection using oracle bulk collect into syntax inside a procedure. So now i want to test if the collection actually got populated, and i am not sure how to do it. I tried looking it up:
http://docs.oracle.com/cd/B28359_01/appdev.111/b28371/adobjcol.htm#autoId17 but I am not able to find what I need.
I also have another question. When the procedure bulk collects data into collections, does the data in the collection become permanent as in a table? Or is it semi-permanent...i.e. only lives for the session...as in a temp table.
I suspect you are looking for the
COUNTmethod, i.e.Like any local variable,
l_local_collectionwill have the scope of the block in which it is declared. The data is stored in the PGA for the session. The data in a collection is not permanent.You can select from the local collection
but it generally doesn't make sense to go through the effort of pulling all the data from the SQL VM into the PL/SQL VM only to then pass all of the data back to the SQL VM in order to issue the
SELECTstatement. It would generally make more sense to just keep the data in SQL or to define a pipelined table function to return the data.If you merely want to iterate over the elements in the collection
It would make much more sense to iterate over the elements in the collection, which keeps everything in PL/SQL, than to
SELECTfrom the collection, which forces all the data back into the SQL VM.