Get help in BULK COLLECT IN the treatment

the following gives me PLS-00302 error: component 'R_MDATA' must be declared

---------------------------------------------

declare

error_1555 exception;

pragma exception_init (error_1555,-1555);

number num.

-set the record

TYPE RJ_RECORD is RECORD (r_rowr_mdata BLOB ROWID);

-set the table based on the file type

TYPE RJ_LIST_T IS TABLE OF RJ_RECORD

INDEX BY PLS_INTEGER;

-our structure will be bulk collect into

l_List RJ_LIST_T;

sql_str varchar2 (2000);

cursor ovs_tab is SELECT table_name from user_tables;

Start

for c_rec in ovs_tab LOOP

sql_str: = ' select rowid, m_data of ' | c_rec.table_name;

run immediately sql_str

COLLECTION in BULK IN l_list;

for indx in 1.l_list. COUNTY

LOOP

Start

NUM: = dbms_lob.instr (l_list. R_MDATA(indx), hextoraw ('889911')) ;  -He does not like r_mdata

exception

When error_1555 then

-Insert in the values of corrupted_lob_data (l_list.rj_rowid (indx), c_rec.table_name);

-commit;

dbms_output.put_line (' corrupt tab = ' | c_rec.table_name);

end;

END LOOP;

end loop;

end;

/

change l_list.r_mdata (indx)

TO

.r_mdata l_list (indx)

Each table has a column named m_data?

Tags: Database

Similar Questions

  • bulk collect into the collection of objects

    create or replace type typ_obj as an object
    (l_x number (10),)
    l_y varchar2 (10),
    LZ varchar2 (10)
    );

    Create the type typ_obj_tt is table of the typ_obj;

    / / DESC insert_table;
    c_x number (10)
    C_P number (10)

    temp2_table / / DESC
    doJir number (10)
    c_y varchar2 (10)
    c_z varchar2 (10)

    procedure prc_x (p_obj_out ON typ_obj_tt)
    is
    cursor c1
    is
    Select t1.c_x,
    T2.c_y,
    T2.c_z
    Of
    insert_table t1,
    temp2_table t2
    where
    ....
    ;
    Start
    Open c1;
    collect the fetch c1 into loose in p_obj_out;
    Close c1;

    end;

    raises the error

    can you tell
    How to enter data in this object of type of output table

    Thanks in advance... any help will be much appreciated...

    PL do not spam the forums with topics in double - bulk collect into the collection of objects

  • Subsequentes IN BULK COLLECT in the collection truncates existing lines?

    T_tab_prds TYPE IS the % TYPE my_cursor TABLE;

    v_tab_prds t_tab_prds;

    OPEN my_cursor;
    Fetch the my_cursor COLLECT in BULK IN v_tab_prds;
    NARROW My_cursor

    another session can change/remove lines

    OPEN my_cursor;
    Fetch the my_cursor COLLECT in BULK IN v_tab_prds; -V_tab_prds VA be zapped before second READING or lines will be mixed? I have to
    -manually remove lines of v_tab_prds before the second EXTRACTION?
    NARROW My_cursor

    I answered Yes initially "later in BULK collect into collection truncate existing lines. Then I noticed "another session can change or remove rows" in your message. The collection is in the object memory with PL/SQL unit scope, it is stated in which is obviously not covered by sessions. So even if the collection belongs to the same unit of PL/SQL (package, SP, etc.) in different sessions, it's a different chunk of memory. So the final answer is:

    Later in BULK COLLECT in the collection to the breast within the same instance of PL/SQL unit truncates existing lines. But obviously subsequent TO BULK COLLECT into the collection in another session won't affect collection in the first session.

    SY.

    Published by: Solomon Yakobson, October 13, 2009 14:20

  • Bulk collect into the record type

    Sorry for the stupid question - I do something really simple wrong here, but can not understand. I want to choose a few rows from a table in a cursor, then in bulk it collect in a folder. I'll possibly extended the record to include additional fields that I will select return of functions, but I can't get this simple test case to run...

    PLS-00497 is the main error.

    Thanks in advance.
    create table test (
    id number primary key,
    val varchar2(20),
    something_else varchar2(20));
    
    insert into test (id, val,something_else) values (1,'test1','else');
    insert into test (id, val,something_else) values (2,'test2','else');
    insert into test (id, val,something_else) values (3,'test3','else');
    insert into test (id, val,something_else) values (4,'test4','else');
    
    commit;
    
    SQL> declare
      2   cursor test_cur is
      3   (select id, val
      4   from test);
      5
      6   type test_rt is record (
      7     id   test.id%type,
      8     val      test.val%type);
      9
     10   test_rec test_rt;
     11
     12  begin
     13    open test_cur;
     14    loop
     15      fetch test_cur bulk collect into test_rec limit 10;
     16       null;
     17     exit when test_rec.count = 0;
     18    end loop;
     19    close test_cur;
     20  end;
     21  /
        fetch test_cur bulk collect into test_rec limit 10;
                                         *
    ERROR at line 15:
    ORA-06550: line 15, column 38:
    PLS-00497: cannot mix between single row and multi-row (BULK) in INTO list
    ORA-06550: line 17, column 21:
    PLS-00302: component 'COUNT' must be declared
    ORA-06550: line 17, column 2:
    PL/SQL: Statement ignored

    You must declare an array based on your registration type.

    DECLARE
       CURSOR test_cur
       IS
             SELECT
                id,
                val
             FROM
                test
       ;
    type test_rt
    IS
       record
       (
          id test.id%type,
          val test.val%type);
       type test_rec_arr is table of test_rt index by pls_integer;
       test_rec test_rec_arr;
    BEGIN
       OPEN test_cur;
       LOOP
          FETCH
             test_cur bulk collect
          INTO
             test_rec limit 10;
          NULL;
          EXIT
       WHEN test_rec.count = 0;
       END LOOP;
       CLOSE test_cur;
    END;
     31  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.06
    ME_XE?
    

    Notice that the difference is...

       type test_rec_arr is table of test_rt index by pls_integer;
       test_rec test_rec_arr;
    
  • How to get help with conversion ROCK on the export of PDF?

    How can I get help with the quality of the PDF documents converted to word format export.

    Not likely to have, you're doing a "happy dance" but a scanned image is "the ear of the sow" and (Yes, I'll say).

    You can't have a scholarship of silk in one ear of the sow.

    Make you a picture of the text content. You get a result of OCR of all that is recognized. The character by character recognition accuracy is generally quite good. But - No image/photo file actually holds information on format, layout, fonts, etc. - it's just a picture. Acrobat OCR makes some assumptions about all this.

    -You have a bunch of each of the characters being exported to Word. Individual characters, not paragraphs, sentences no, no words, no values "white space", etc.

    So you get an export that is a "best estimate" of the less desirable source. Sometimes, it isn't so bad. Sometimes it's just awful. In all cases, you will need to do some cleanup of the exported content that landed in the Word file.

    The alternative is to transcribe the hardcopy to the Word file.
    In fact it can often be higher as a workflow rather than the scanning-ocr-export-cleanup shuffle

    .

    For really nice export "spot - we ', you must start with a PDF file from an application of creation (not a scanned image) which is a well-formed tag PDF (for example ISO 14289-1, PDF/UA-1).
    The purpose of the tagged PDF document is not only Accessible PDF is also how PDF supports actively the re-use of content (for example, export).

    Be well...

  • Bulk collect into the statement

    Hi all

    I'm trying to copy data using the database link.

    I'm using the Oracle 11 g on Windows.

    I check the data in the source table and it exists. When I run under block it is running successfully but do return no data in the target database.

    SET SERVEROUTPUT ON

    DECLARE

    TYPE of t_bulk_collect_test_1 IS the TABLE OF NT_PROP % ROWTYPE;

    l_tab1 t_bulk_collect_test_1;

    CURSOR c_data1 IS

    SELECT *.

    OF NT_PROP@dp_copy;

    BEGIN

    OPEN c_data1.

    LOOP

    EXTRACTION c_data1

    LOOSE COLLECTION l_tab1 LIMIT 10000;

    commit;

    WHEN OUTPUT l_tab1.count = 0;

    END LOOP;

    CLOSE C_data1;

    END;

    /

    Could you get it someone please let me know what is the error in this code.

    Thanks in advance

    Bulk operation will not improve performance. Your code is a good example to show how to write code that is a performance nightmare. I'm sorry to say this, but it's the truth.

    Static SQL is the fastest way to do it. As you will transfer the data via a DB connection it will be certain overhead. But the block is not the solution for it. Make a simple INSERT INTO... SELECT... Beh It's the best way to do what you want.

  • In BULK COLLECT IN the Table "Record".

    Hello

    I can't find a solution for this case. I try to extract the data in an array of different records with subtype records.

    -Table example:

    CREATE THE TABLE1 TABLE:

    ("COLUMN1" NUMBER,

    "COLUMN2" NUMBER,

    "COLUMN3" NUMBER,

    "COLUMN4" NUMBER,

    COLUMN '5' NUMBER,

    "COLUMN6" NUMBER

    );

    -Sample data:

    INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('11', '12', '13', '14', 15', 16');

    INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('21', '22', '23', '24', 25', 26');

    INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('31', '32', '33', '34', 35', 36');

    INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('41', '42', '43', '44,' 45', 46');

    INSERT INTO TABLE1 (COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6) VALUES ('51', '52', '53', '54,' 55' 56');

    Here, I stated some of the columns of the table as individual records / use in the RETURN of some of the features clause.

    DECLARE

    TYPE t_col_group1 IS RECORD (col2 of TABLE1. COLUMN2% TYPE

    col3 TABLE1. COLUMN3% TYPE

    );

    TYPE t_col_group2 IS RECORD (col4 TABLE1. COLUMN2% TYPE

    col5 TABLE1. COLUMN3% TYPE

    );

    TYPE t_coll_collection IS RECORD (col1 TABLE1. % TYPE COLUMN1

    col_group1 t_col_group1

    col_group2 t_col_group2

    col6 TABLE1. % TYPE COLUMN1

    );

    TYPE t_table IS the TABLE OF t_coll_collection INDEX DIRECTORY.

    v_table t_table;

    CURSOR c_table IS

    SELECT COLUMN1, COLUMN2, COLUMN3, COLUMN4, COLUMN 5, COLUMN6

    FROM TABLE1;

    BEGIN

    OPEN c_table.

    Get the c_table COLLECT in BULK IN v_table;

    CLOSE C_table;

    END;

    I can ' manage to get the data in the table with the COLLECTION in BULK:

    Fehlerbericht:

    ORA-06550: Line 25, column 35:

    PLS-00597: expression "V_TABLE" in the list IS of the wrong type

    ORA-06550: Line 25, column 3:

    PL/SQL: SQL statement ignored

    06550 00000 - "line %s, column % s:\n%s".

    * Cause: Usually a PL/SQL compilation error.

    * Action:

    Thank you!

    André

    My environment:

    Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE Production 11.2.0.3.0
    AMT for Linux: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    You must define the SQL type

    create or replace type t_col_group1 as an object (col2, col3 number number)
    /
    create or replace type t_col_group2 as an object (col4 number, number col5)
    /
    create or replace type t_coll_collection as an object
    (
    number of col1
    col_group1 t_col_group1
    col_group2 t_col_group2
    number col6
    )
    /
    create or replace type t_table as the t_coll_collection table
    /

    declare
    v_table t_table;

    cursor c_table
    is
    Select t_coll_collection
    (
    Column1
    t_col_group1 (column2, column3)
    t_col_group2 (column4, column5)
    column6
    )
    FROM table1;
    Start
    Open c_table;
    collect the fetch c_table in bulk in v_table;
    close c_table;
    end;
    /

  • Where can I get help for a problem with the language?

    I have 3 languages installed on this computer. It worked fine last night, but today it will not switch between them. Where can I get support for this problem? Thank you!

    Restore point:

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    Do Safe Mode system restore, if it is impossible to do in Normal Mode.

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    See you soon.

    Mick Murphy - Microsoft partner

  • Get help conditional select stmt of the query

    Hi I have the following data set
    with t as 
    (
     select 100 s_id ,'abc' txt,'SH' r_cd,'Z+' symb,1 rt_id,11 m_id ,111 i_id ,'GO' sub_cd,'PC' cd from dual union all
     select 200 s_id,'bcd','SH','Z+',2,22,222 ,'A','PC' from dual union all
     select 200 ,'bcd','SH','Z+',2,22,222 ,'B','AN' from dual
    )     
    select * from t
    Now IF cd = PC for unique s_id then post it, so s_id = 100 should be displayed
    If cd = PC as well as the PC <>for unique s_id then show only the record that is <>PC (YEAR), means s_id = cd = 200 YEAR should be displayed
    Expected results
    s_id =100 with cd = CP 
    s_id=200 with cd =AN
    Could you please help me to achieve this

    If I understand correctly, if there is only one row with PC = cd you want to return this line. If there is a line with cd = 'PC' and another line for the s_id even with a value of different CDs, you want to return this another line. If there is no line with PC = cd then ignore this identifier.

    If this is correct, then something in the sense of:

    SQL> with t as (
      2     select 100 s_id ,'abc' txt,'SH' r_cd,'Z+' symb,
      3            1 rt_id,11 m_id ,111 i_id ,'GO' sub_cd,'PC' cd
      4     from dual union all
      5     select 200 s_id,'bcd','SH','Z+',2,22,222 ,'A','PC' from dual union all
      6     select 200,'bcd','SH','Z+',2,22,222 ,'B','AN' from dual union all
      7     select 300, 'bcd','SH','Z+',2,22,222 ,'B','AN' from dual )
      8  select s_id, txt, r_cd, symb, rt_id, m_id, i_id, sub_cd, cd
      9  from (select t.*,  -- or whatever columns you want
     10               COUNT(DECODE(cd, 'PC', 1, null)) OVER(PARTITION BY  s_id)     AS pc_cnt,
     11               ROW_NUMBER() OVER(PARTITION BY s_id order by DECODE(cd, 'PC', 2, 1)) rn
     12        FROM t)
     13  WHERE rn = 1 and
     14        pc_cnt =1;
    
          S_ID TXT R_ SY      RT_ID       M_ID       I_ID SU CD
    ---------- --- -- -- ---------- ---------- ---------- -- --
           100 abc SH Z+          1         11        111 GO PC
           200 bcd SH Z+          2         22        222 B  AN
    

    If ther could be more than two lines for a s_id, then you can adjust the order by in the row_number() to choose a. If you want several lines for the case where there is a PC line and several lines not PC, then something like:

    SQL> with t as (
      2     select 100 s_id ,'abc' txt,'SH' r_cd,'Z+' symb,
      3            1 rt_id,11 m_id ,111 i_id ,'GO' sub_cd,'PC' cd
      4     from dual union all
      5     select 200 s_id,'bcd','SH','Z+',2,22,222 ,'A','PC' from dual union all
      6     select 200,'bcd','SH','Z+',2,22,222 ,'B','AN' from dual union all
      7     select 200,'bcd','SH','Z+',2,22,222 ,'B','AC' from dual union all
      8     select 300, 'bcd','SH','Z+',2,22,222 ,'B','AN' from dual )
      9  select s_id, txt, r_cd, symb, rt_id, m_id, i_id, sub_cd, cd
     10  from (select t.*,  -- or whatever columns you want
     11               COUNT(DECODE(cd, 'PC', 1, null)) OVER(PARTITION BY  s_id)     AS pc_cnt,
     12               ROW_NUMBER() OVER(PARTITION BY s_id order by DECODE(cd, 'PC', 2, 1)) rn
     13        FROM t)
     14  WHERE      pc_cnt = 1 and
     15        CASE WHEN cd = 'PC' and rn = 1 THEN 'Y'
     16             WHEN cd <> 'PC' and rn > 1 THEN 'N'
     17             ELSE 'Y' END = 'Y';
    
          S_ID TXT R_ SY      RT_ID       M_ID       I_ID SU CD
    ---------- --- -- -- ---------- ---------- ---------- -- --
           100 abc SH Z+          1         11        111 GO PC
           200 bcd SH Z+          2         22        222 B  AN
           200 bcd SH Z+          2         22        222 A  PC
    

    John

  • I just installed win 7 Ult 7 days. In the event viewer, I got 1000 errors and I was wondering where I can get help? TY

    I just installed win 7 Ult 7 days.  In the event viewer, I got 1000 errors and I was wondering where I can get help? TY

    And the list continues to become more mistakes as the months go bye.  Usually after 3 monts, my PC slows to a crawl, and I have to reinstall Windows & Ultimate!

    It is very annoying.  I'm not the smartest when it comes to the PC, but I know enough when I have a problem.

    Now, while I was with PC Cleaner Pro, I allowed a representative to take control of my PC to help set, and he went into the event viewer and showed me the error 1007 in

    the event viewer.  He told me that only a technician 35 Microsoft could fix tis problem.

    I would like to know how to solve these problems myself.  If that means classes or tests, I'm ready to get there!

    But for now, I just want to know how to clean and fix the errors in the event viewer

    So if you could tell me please small whet you need to me to help him with this problem, I'm ready

    It's really annoying tio do reinjstall windows every 3 months.  So if you can help, I would be very happy VERY MUCH!

    Sincreley,

    Joseph M Hart

    Errors and warnings in the event logs are not usually a sign of a major problem.

    Unfortunately, there are many technical support providers who refer clients to the event log in order to convince them to pay for questionable services.

    Use of cleaners and Tune up utilities is not recommended. They can often cause problems.

    Use the construct in Windows utilities

    http://www.Microsoft.com/athome/Setup/optimize.aspx

    Ensure that all remote access program is deleted from your computer.

    Use a search engine to find information on all the events that occur frequently, specifying the event id and source, for example search for "eventid 512 capi2. Try to avoid scam sites that are always asked by this kind of research. Stick to sites of Microsoft or somewhere like www.eventid.net which is a good source of free information.

  • Error: PLS-00103: encountered the symbol 'COLLECT' during the waited in the following way:. (, limiting the symbol)

    Hi all

    I get this error:

    • Error (55,45): PLS-00103: encountered the symbol 'COLLECT' during the waited in the following way:. (, limiting the symbol ".") has been inserted before 'COLLECT' to continue.

    While trying to create this procedure as below:

    If I run the query, I get the result, but in the procedure, I am trying to convert the OUT_REFCURSOR in a table, but this error.

    PROCEDURE SP_GETVALIDATE)

    IN_CASEID IN VARCHAR2,

    IN_REQID IN VARCHAR2,

    OUT_REFCURSOR ON SYS_REFCURSOR)

    AS

    IS OF TYPE RECORDTYPE

    RECORD (COL1, COL2 VARCHAR2 VARCHAR2);

    IS OF TYPE TABLETYPE

    THE REFTABLETYPE TABLE

    INDEX BY PLS_INTEGER;

    BEGIN

    OPEN for SELECT OUT_REFCURSOR c.RCRD_NO, c.STE_NO_TX DE T_LYR_STES c, p of LAND WHERE c.case_id = IN_CASEID AND p.L_NUMBER > 100;

    LOOP

    Look FOR the OUT_REFCURSOR BULK COLLECT outtable;

    WHEN the outtable OUTPUT. COUNT = 0;

    FOR indx IN 1... outtable. COUNTY

    LOOP

    dbms_output.put_line (outtable (indx). ) RCRD_NO);

    END LOOP;

    END LOOP;

    CLOSE OUT_REFCURSOR;

    END SP_GETVALIDATE;

    I could be wrong here.

    any help appreciated.

    Thank you

    Ken

    SEARCH OUT_REFCURSOR BULK COLLECT INTO outtable;

    You've had your BULK COLLECT and the wrong way around

  • Bulk collect using some different column insert a table

    Hi all

    I gave an example of emp table in my original 100 million table record are I need to change group (IE deptno) 10 to 20 copy the same records

    about these codes, I get exception

    ORA-06550: line 11, column 53:

    PLS-00386: concordance that is 'EMP_TAB' between FETCH cursor and IN variables of type

    can help me please for these

    declare

    type row_tab is table emp % rowtype

    INDEX BY PLS_INTEGER;

    emp_tab row_tab;

    cursor cur_emp is select ENAME, 20 DEPTNO, HIREDATE, emp COMM EMPNO;

    Start

    Open cur_emp;

    loop

    Cur_emp fetch bulk collect in the limit emp_tab 2000;

    ForAll i in 1.emp_tab. COUNTY

    Insert / * + APPEND * / into emp (EMPNO, ENAME, DEPTNO, HIREDATE, COMM)

    values (emp_tab (i). EMPNO, emp_tab (i). Ename, emp_tab (i). DEPTNO, emp_tab (i). HIREDATE, emp_tab (i). COMM.) ;

    When the output cur_emp % notfound;

    END LOOP;

    close cur_emp;

    end;

    /

    Thank you

    VSM

    I use the user define the type of record to over come error

    declare

    type emp_rt is record (empno, ename emp.ename%type,deptno NUMBER (2) emp.empno%type, hiredate emp.hiredate%type,comm emp.comm%type);

    TYPE row_type IS the emp_rt INDEX TABLE OF pls_integer;

    emp_tab row_type;

    cursor cur_emp is select empno, ename, 20 deptno, hiredate, comm from emp where deptno = 10;

    Start

    Open cur_emp;

    loop

    Cur_emp fetch bulk collect in the emp_tab limit 2;

    ForAll i in 1.emp_tab. COUNTY

    Insert / * + APPEND * / into EMP (EMPNO, ENAME, DEPTNO, HIREDATE, COMM)

    values (emp_tab (i). EMPNO, emp_tab (i). ENAME, emp_tab (i). DEPTNO, emp_tab (i). HIREDATE, emp_tab (i). COMM.)

    ;

    When the output cur_emp % notfound;

    END LOOP;

    close cur_emp;

    end;

    /

    records are successful inserted, I do not know is not the right approach for 100 million documents?

    Thank you

    VM

  • Bulk collect into a Table nested with Extend

    Hi all
    I want to get all the columns of the table emp and dept. So I use bulk collect into the concept of nested table.

    *) I wrote the function in three different ways. EX: 1 and 2 (DM_NESTTAB_BULKCOLLECT_1 & DM_NESTTAB_BULKCOLLECT_2) does not give the desired result.
    *) It only gives the columns of the EMP table. That means it takes DEPT & columns of the EMP table, but it only gives columns of table EMP.
    ) I think, there is something problem with nested table Extend.
    ) I want to know infested.
    Can we use bulk collect into a table nested with extend?
    If it is yes then fix the below codes (EX: 1 & EX: 2) and can you explain me please?


    Codes are given below *.

    CREATE OR REPLACE TYPE NEST_TAB IS TABLE OF THE VARCHAR2 (1000);

    EX: 1:
    ----
    -Bulk collect into a Table nested with Extend-
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_1
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    l_nesttab.extend;

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_1;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_1);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -----------------------------------------------------------------------------------------------------

    EX: 2:
    -----
    -Bulk collect in the nested with Extend based on County - Table
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_2
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    v_col_cnt NUMBER;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT MAX (column_id)
    IN v_col_cnt
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name;

    l_nesttab. Extend (v_col_cnt);

    SELECT column_name
    bulk collect INTO l_nesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_2;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_2);

    OUTPUT:
    -------
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Only the EMP table columns are there in the nested table.
    -------------------------------------------------------------------------------------------

    EX: 3:
    -----

    -Collect in bulk in a nested Table to expand aid for loop.
    CREATE or replace FUNCTION DM_NESTTAB_BULKCOLLECT_3
    RETURN NEST_TAB
    AS
    l_nesttab NEST_TAB: = NEST_TAB();
    TYPE local_nest_tab
    THE VARCHAR2 ARRAY (1000);
    l_localnesttab LOCAL_NEST_TAB: = LOCAL_NEST_TAB();
    NUMBER x: = 1;
    BEGIN
    FOR tab_rec IN (SELECT table_name
    From user_tables
    WHERE table_name IN ('EMP', 'Department')) LOOP
    SELECT column_name
    bulk collect INTO l_localnesttab
    Of user_tab_columns
    WHERE table_name = tab_rec.table_name
    ORDER BY column_id;

    BECAUSE me IN 1.l_localnesttab. COUNTING LOOP
    l_nesttab.extend;

    L_NESTTAB (x): = L_LOCALNESTTAB (i);

    x: = x + 1;
    END LOOP;
    END LOOP;

    RETURN l_nesttab;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END DM_NESTTAB_BULKCOLLECT_3;

    SELECT *.
    TABLE (DM_NESTTAB_BULKCOLLECT_3);

    OUTPUT:
    ------
    DEPTNO
    DNAME
    LOC
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO

    * Now, I got the desired result set. DEP. and columns of the Emp Table are in the nested Table.




    Thank you
    Ann

    COLLECTION BULK cannot add values to an existing collection. It can only crush.

  • Bulk collect and cursors using rowtype

    Hello

    I'm trying just one big collect of a table and display one of the values.
    It keeps giving me the error:

    dbms_output.put_line ('f_viewed_rec: ' | f_viewed_rec.job_id (i));
    *
    ERROR on line 66:
    ORA-06550: line 66, column 53:
    PLS-00302: component 'JOB_ID' must be declared.


    ----
    cursor f_viewed IS
    Select job_id of the work;

    type f_viewed_type is table of the f_viewed % rowtype;
    f_viewed_rec f_viewed_type;

    Start

    Open f_viewed;

    LOOP

    F_viewed fetch bulk collect within the limit of 5000 f_viewed_rec;

    --------

    I'm in f_viewed_rec.first... f_viewed_rec. Last

    LOOP

    dbms_output.put_line ('f_viewed_rec: ' | f_viewed_rec.job_id (i));

    END LOOP;

    END LOOP;

    end;
    /

    --------------------------

    Any ideas? Thanks much for any help.

    -Jenny

    Difficulty

    dbms_output.put_line('f_viewed_rec: '||f_viewed_rec.job_id(i));
    

    TO

    dbms_output.put_line('f_viewed_rec: '||f_viewed_rec(i).job_id);
    

    Kind regards
    Sayan M.

  • bulk collect with limit

    code is: cursor here can fetch a large amount of data (22000 records). So I have to go with the limit clause. I use two foralls. This code snippet is correct with regard to the two foralls, exit and % bulk_rowcount sql statement? I have to use in production. Is there something that can break the code?

    OPEN c1;
    LOOP
    C1 FETCH BULK COLLECT WITHIN the limits of the 100 id_array;
    FORALL i IN id_array. FIRST... id_array. LAST
    Update statement;
    BECAUSE me IN id_array. FIRST... id_array. LAST
    LOOP
    v_cnt: = v_cnt + SQL % BULK_ROWCOUNT (i);
    END LOOP;
    FORALL i IN id_array. FIRST... id_array. LAST
    Insert statement;
    WHEN id_array EXIT. COUNT = 0;
    END LOOP;
    CLOSE c1;

    In addition, how context switching works when we use the llimit clause?
    without limit:
    collection is completely filled. then prepares to all the DML statements and go to sql and exeutes one by one.
    right?
    tasted clause say limit = 100
    100 indexes collection gets populated.then prepares all the DML statements for these 100 indices and go to the DTF sql and exeutes. And then back to pl/sql. fills the same 100 indices collection with 100 records and prepares the DML and goes to sql to run and returns to pl/sql and so on? Is this true?
    right?

    large volume of data (22000 records)

    This isn't a large volume of data.

    In addition, how context switching works when we use the llimit clause?

    You will find some good explanations here:

    http://www.Oracle.com/technology/tech/pl_sql/PDF/doing_sql_from_plsql.PDF

Maybe you are looking for

  • Firefox 7

    Where can I download firefox 7? Version 8 has removed any possibility of zoom with mac osx 10.6

  • Timeout on while loop

    Hello I need to insert a time-out on a while loop to exit this loop in the case of the device is not able to answer. How can I do? Best regards

  • Hide indicators

    Hello world I have two subvis: subvi1 and subvi2 Subvi1 contains a listbox with three values that the user will choose one of them. Subvi2 contain a number of indicators, and depending on the value chosen, some of them must be hidden. I tried to use

  • How can I increase the buffer size of the StationID variable

    I'm reading the variable string StationID in TestStand, which holds the name of the computer. Currently, it truncates to 14 characters. How can I increase the size? Thanks in advance.

  • Compaq presario CQ43: enter the password administrator or power on password

    Guyz please help ASAP The message DISABLED [34883163]