Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

INSERT INTO...SELECT ... with RETURNING clause

J.KiechleMar 15 2008 — edited Mar 15 2008

I was learning RETURNING...INTO clause. Any idea on why i am getting this error while i try to execute the below block

create table logan as select * from emp where 1=2;
SQL> set serveroutput on
SQL> DECLARE
  2   x emp.empno%TYPE;
  3  BEGIN
  4    INSERT INTO LOGAN (EMPNO,ENAME,sal)
  5    SELECT empno,ename,sal from emp
  6    RETURNING empno
  7    INTO x;
  8    dbms_output.put_line(x);
  9    UPDATE logan
 10    set sal= nvl(sal,0)+12
 11    where empno=x;
 12    
 13   commit;
 14   end;
 15  /
  RETURNING empno
            *
ERROR at line 6:
ORA-06550: line 6, column 13:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 4, column 3:
PL/SQL: SQL Statement ignored

Message was edited by:
J.Kiechle

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 12 2008
Added on Mar 15 2008
4 comments
2,758 views