I have one table called INTER
and I want to transfer some data from INTER
to FINAL
(a new table which is already created and empty) using a procedure.
I have to make use of sequence as a primary key for the FINAL
table. INTER
is the parent table and it has all columns present in FINAL
.
I have created a sequence M_SQ
. Here is what I tried:
create or replace
PROCEDURE STAGING_TO_CUSTOMER
AS
BEGIN
INSERT INTO FINAL (C_ID,C_NAME,C_PHONE,C_ADDRESS)
SELECT M_SQ.NEXTVAL,C_NAME,C_PHONE,C_ADDRESS FROM INTER;
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
END;
This procedure gets compiled but no records are transferred to FINAL
.
Can somebody help? I am using sqldeveloper 11g.