English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

From a table called "temp" we have to fetch records to table "emp" such that e_id starts from the next value of the maximum e_id in table "emp" but all the remaining fields should be fetched from table"temp" using a cursor in PL/SQL language

2007-02-28 16:33:25 · 1 answers · asked by sanjana 2 in Computers & Internet Software

1 answers

how about something like this?

CREATE OR REPLACE PROCEDURE proc
v_eid emp.eid%TYPE;
CURSOR c1 IS
SELECT t.*
FROM temp t;
c1r c1%ROWTYPE;
BEGIN
select max(e_id) into v_eid from emp;
FOR c1r IN c1 LOOP
v_eid := v_eid+1;
insert into emp values (v_eid, put here all the required values
in the form c1r.tempcol)
END LOOP;
END;

I'm not sure of all the syntax but it is pretty close.

2007-03-01 05:36:50 · answer #1 · answered by Elizabeth Howard 6 · 0 0

fedest.com, questions and answers