Re: Need help with PL/SQL's bulk collect.

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 18 Mar 2002 18:42:07 -0800
Message-ID: <a768hv046n_at_drn.newsguy.com>


In article <3C961657.DA3B021_at_lucent.com>, Duncan says...
>
>Hi,
>
>I need help with using bulk collect in PL/SQL. The code I'm using is:
>
>DECLARE
> TYPE EmpnoTab IS TABLE OF emp.empno%TYPE;
> emp_nos EmpnoTab;
>BEGIN
> SELECT empno BULK COLLECT INTO emp_nos
> FROM emp;
>END;
>
>
>But I get:
>
>
> SELECT empno BULK COLLECT INTO emp_nos
> *
>ERROR at line 5:
>ORA-06550: line 5, column 23:
>PLS-00103: Encountered the symbol "COLLECT" when expecting one of the
>following:
>, from into
>The symbol "," was substituted for "COLLECT" to continue.
>
>
>
>I can't see why this shouldn't work. Any ideas anyone?
>
>Thanks in advance,
>Duncan

scott_at_ORA817DEV.US.ORACLE.COM> DECLARE

  2      TYPE EmpnoTab IS TABLE OF emp.empno%TYPE;
  3      emp_nos EmpnoTab;
  4  BEGIN
  5      SELECT empno BULK COLLECT INTO emp_nos
  6        FROM emp;

  7 END;
  8 /

PL/SQL procedure successfully completed.

scott_at_ORA806.WORLD> DECLARE

  2      TYPE EmpnoTab IS TABLE OF emp.empno%TYPE;
  3      emp_nos EmpnoTab;
  4  BEGIN
  5      SELECT empno BULK COLLECT INTO emp_nos
  6        FROM emp;

  7 END;
  8 /
    SELECT empno BULK COLLECT INTO emp_nos
                      *

ERROR at line 5:
ORA-06550: line 5, column 23:
PLS-00103: Encountered the symbol "COLLECT" when expecting one of the following: , from into
The symbol "," was substituted for "COLLECT" to continue.

[Quoted] you have been reading the Oracle8i plsql guide but programming in Oracle8.0

Bulk collect is a new 8i feature (new being a relative term here as 815 is pretty old now)

--
Thomas Kyte (tkyte_at_us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Tue Mar 19 2002 - 03:42:07 CET

Original text of this message