Not sure what I am doing wrong. Pretty sure it is something silly.
Wondering why the row is not inserting:
scott@ORA11GR2> create table dept1 as select * from dept where rownum < 2;
Table created.
scott@ORA11GR2> select * from dept1;
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
scott@ORA11GR2> create table dept2 as select * from dept1 where 1=2;
Table created.
scott@ORA11GR2> select * from dept2;
no rows selected
scott@ORA11GR2>
declare
v_deptno NUMBER;
v_dname dept1.dname%TYPE;
v_loc dept1.loc%TYPE;
begin
select deptno, dname, loc
into v_deptno, v_dname, v_loc
from dept1;
end;
/
PL/SQL procedure successfully completed.
scott@ORA11GR2> select * from dept2;
DEPTNO DNAME LOC
---------- -------------- -------------
declare
v_deptno NUMBER;
v_dname dept2.dname%TYPE;
v_loc dept2.loc%TYPE;
begin
insert into dept2 (deptno, dname, loc) values (v_deptno, v_dname, v_loc);
end;
/
PL/SQL procedure successfully completed.
scott@ORA11GR2> select * from dept2;
no rows selected