PL/SQL procedure to insert data doesn't work and unable to find reason.
citicbjFeb 12 2013 — edited Feb 13 2013Sorry that I couldn't find the best place to post this question. It seems that the forum does not deal with this kind of question. I post here for help.
I have a stored procedure to insert data into one table. SP was compiled without error and executed without error (from log table to get information). But the data was not inserted into
the target table. I have tried different way to figure out the reason. But I failed to get any idea. Please help me to find possible reasons. The smple SP looks like this:
CREATE OR REPLACE PROCEDURE my.sp_insert( P_DATE IN VARCHAR2)
IS
declare section
begin
insert into target_table (column1, column2, column3, column4)
select record1, record2, record3, record4 from table1, table2, table3, table4
where clause;
commit;
exception section
UPDATE PROCESS_LOG_TABLE CLAUSE;
html_email section;
rollback;
end my.sp_insert
/
I have tested that "select record1, record2, record3, record4 from table1, table2, table3, table4" really fetch the 7,000 records. and if I only run part of SQL from SQLPLUS as
insert into target_table (column1, column2, column3, column4)
select record1, record2, record3, record4 from table1, table2, table3, table4
where clause;
It will work and insert 7,000 records into target table. Why did it not insert into target_table when execiting as stored procedure? Please help with your input. Thanks.
Edited by: citicbj on Feb 12, 2013 4:15 PM