PROCEDURE Procname (
VariableName1 IN Table1.Col1%TYPE,
......
VariableNamen IN Tablen.Coln%TYPE
)
IS
processed number;
NewSeqID Tablea.ID_SEQ%TYPE;
CURSOR cursorname IS
SELECT columns
FROM
tablea a,
tableb b
WHERE a.colx = b.colx
AND a.coly = VariableName2
AND a.colz = b.tableB_PK
AND b.colx = VariableName3
;
BEGIN
FOR i IN cursorname LOOP
INSERT INTO tablea a (col1,col2,col3,col4,col5...............)
VALUES (ID_SEQ.NEXTVAL,i.col1,i.col2,i.col3,i.col4,i.col5,.....................);
processed := myCur%ROWCOUNT;
END LOOP;
dbms_output.put_line('total records processed: ' || processed);
END Procname;
|