DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Bulk Collect

  1. #1
    Join Date
    Sep 2005
    Posts
    11

    Thumbs up Bulk Collect

    Here is my code:
    CREATE OR REPLACE PACKAGE BODY XPTO

    IS

    TYPE t_aux_record IS record (
    var1 NUMBER,
    var2 NUMBER,
    var3 NUMBER
    );
    TYPE t_record IS TABLE OF t_aux_record INDEX BY binary_integer;

    .....


    PROCEDURE TRF_VP_BYDAY(
    p_time IN VARCHAR2
    )
    IS
    v_table t_record;
    .....
    BEGIN
    .....
    SELECT x,y,z
    BULK COLLECT INTO v_table.var1, v_table.var2, v_table.var3
    FROM xpto;
    ...

    In "BULK COLLECT INTO v_table.time_key, v_table.dslam_key, v_table.dslam_cli_key,"
    i get the error : "PLS-00302: component 'var1' must be declared".

    Can't I do this is this way?
    In http://www.dbasupport.com/oracle/ora...binds1_2.shtml
    I found an example:
    declare
    type no_t is table of amemp.empno%type;
    type sal_t is table of amemp.sal%type;
    lno no_t;
    lsal sal_t;

    But since I have a lot of columns is a little bit dumb to define variables for all the columns.

    Please help,

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Cool


    No, you need to define a separate table for each column in bulk collect.

    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width