-
Cursor to Table
Hi,
Please let me know how to insert data from a cursor to a table
-
what code have you tried so far? what is your cursor definition?
-
Cursor to Table
Slimdave,
For example: I created a table:EMP_1 with data in it and table:EMP_2 with NO data in it. Structures are same.
AND, I used the following code to insert data from EMP_1 to EMP_2.
-------------
BEGIN
DECLARE
CURSOR prev_rec IS
SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO,SEQ_ID
FROM EMP_1;
BEGIN
FOR cur_rec IN prev_rec
LOOP
INSERT INTO EMP_2 values(cur_rec.EMPNO,cur_rec.ENAME,cur_rec.
JOB,cur_rec.MGR,cur_rec.HIREDATE,
cur_rec.SAL,cur_rec.COMM,cur_rec.DEPTNO,
cur_rec.SEQ_ID);
END LOOP;
END;
END;
------------------------
When I used at SQL prompt, it is working OK (inserting data from EMP_1 to EMP_2).
BUT...
When I used the same code in a Oracle Form Trigger, it is not working, WHY& What am I missing ?
-
Cursor to Table
Slimdave,
Nevermind........I got it
Thanks anyway
-
Why not just Select Into ? or CTAS ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|