Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8413935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:02:10+00:00 2026-06-10T01:02:10+00:00

I created an oracle Object Type like this: CREATE OR REPLACE TYPE DFBOWNER.RPT_WIRE_IMPORT_ROWTYPE AS

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T01:02:12+00:00Added an answer on June 10, 2026 at 1:02 am

    I suspect you are looking for the COUNT method, i.e.

    DECLARE
      l_local_collection dbfowner.rpt_wire_import_tabletype;
    BEGIN
      SELECT sysdate + level
        BULK COLLECT INTO l_local_collection
        FROM dual
     CONNECT BY level <= 10;
      dbms_output.put_line( 'l_local_collection contains ' || 
                               l_local_collection.count || 
                               ' elements.' );
    END;
    

    Like any local variable, l_local_collection will 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

    SQL> create type some_object as object (
      2    rec_value_date date
      3  );
      4  /
    
    Type created.
    
    SQL> create type some_coll
      2      as table of some_object;
      3  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    l_local_collection some_coll;
      3  begin
      4    select some_object( sysdate + numtodsinterval( level, 'day' ) )
      5      bulk collect into l_local_collection
      6      from dual
      7   connect by level <= 10;
      8    for x in (select * from table( l_local_collection ))
      9    loop
     10      dbms_output.put_line( x.rec_value_date );
     11    end loop;
     12* end;
    SQL> /
    20-AUG-12
    21-AUG-12
    22-AUG-12
    23-AUG-12
    24-AUG-12
    25-AUG-12
    26-AUG-12
    27-AUG-12
    28-AUG-12
    29-AUG-12
    
    PL/SQL procedure successfully completed.
    

    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 SELECT statement. 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

    SQL> ed
    Wrote file afiedt.buf
    
      1  declare
      2    l_local_collection some_coll;
      3  begin
      4    select some_object( sysdate + numtodsinterval( level, 'day' ) )
      5      bulk collect into l_local_collection
      6      from dual
      7   connect by level <= 10;
      8    for i in 1 .. l_local_collection.count
      9    loop
     10      dbms_output.put_line( l_local_collection(i).rec_value_date );
     11    end loop;
     12* end;
    SQL> /
    20-AUG-12
    21-AUG-12
    22-AUG-12
    23-AUG-12
    24-AUG-12
    25-AUG-12
    26-AUG-12
    27-AUG-12
    28-AUG-12
    29-AUG-12
    
    PL/SQL procedure successfully completed.
    

    It would make much more sense to iterate over the elements in the collection, which keeps everything in PL/SQL, than to SELECT from the collection, which forces all the data back into the SQL VM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a simple Oracle type: create or replace TYPE MY_TYPE AS OBJECT (ID
I have some types in Oracle. create or replace TYPE r_telefone_cand AS OBJECT (
If someone does something like: CREATE OR REPLACE TYPE some_type AS OBJECT(whatever NUMBER); and
Create user defined type in oracle CREATE OR REPLACE TYPE CUSTOMER_NAME AS OBJECT(FIRST_NAME VARCHAR2(20),LAST_NAME
Is it possible to create an object type inside of a package in Oracle
I have this stored procedure for Oracle: create or replace procedure bns_saa_message_get() <--- PROBLEM
i have a type as follows: CREATE OR REPLACE TYPE tbusiness_inter_item_bag AS OBJECT (
Based on this previous question on stackoverflow: Fetch Oracle table type from stored procedure
I have the following statements in Oracle 11g: CREATE TYPE person AS OBJECT (
I have nested table xxx_nested_table in Oracle CREATE OR REPLACE TYPE xxx_tab AS TABLE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.