| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL problem
pl/sql table can't be used in sql statement as a whole.
You can define a cursor and select ... into pl/sql table
records within a loop.
...
  cursor c1 is select select user_id, count(*)
    from manager_close
    where when_closed = '13-JUL-99' group by user_id;
...
-- within the loop
  fetch c1 into var_table(j);
-- where j is the loop variable
...
NetComrade wrote:
> declare
> i number;
> k number;
> type var_record is record
> (user manager_close.user_id%type,
>  var  number);
> type var_record_table is table of var_record index by binary_integer;
> var_table var_record_table;
> begin
>   i:=dbms_utility.get_time;
>   select user_id, nvl(count(*),0) into var_table from manager_close
> where when_closed = '13-JUL-99' group by user_id;
>   k:=dbms_utility.get_time;
>   dbms_output.put_line(k-i);
> end;
>
> ORA-06550: line 11, column 1:
> PLS-00393: wrong number of columns in SELECT...INTO statement
> ORA-06550: line 11, column 1:
> PL/SQL: SQL Statement ignored
>
> What am I doing wrong? Thanx.
> ---------------
> Andrey Dmitriev  eFax: (978) 383-5892  Daytime: (917) 373-5417
> AOL: NetComrade  ICQ: 11340726 remove NSPAM to email
Received on Tue Aug 03 1999 - 01:06:25 CDT
![]()  | 
![]()  |