Stored proc to fetch row from 1 table and insert into another and delete from the 1st
create or replace package lcp_archive
as
procedure lcp_archive_proc (check_id_var in number, status_var out varchar(1));
end lcp_archive;
create or replace package body lcp_archive
as
procedure lcp_archive_proc (check_id_var in number, status_var out varchar(1))
as
fee_var number;
closed_date_var date;
addedby_var varchar2(30);
amount_var number;
begin
select fee
,closed_date
,addedby
,amount
into fee_var
,closed_date_var
,addedby_var
,amount_var
from lc_check
where check_id = check_id_var;
insert into lc_check_archive values (check_id_var ,fee_var ,closed_date_var ,addedby_var ,amount_var);
delete from lc_check where check_id = check_id_var;
exception when (no_data_found)
then status_var := 'f';
else status_var := 't';
end lcp_archive_proc;
end lcp_archive;
begin
lcp_archive.lcp_archive_proc(12345,st_v);
dbms_output.put_line('status is'||st_v);
end
Re: Stored proc to fetch row from 1 table and insert into another and delete from the
This section is for saying hi, not for asking questions. See the sticky at the top of this section, and read the forum rules.
Also use [code=java] before your code and [/code] after your code.
Re: Stored proc to fetch row from 1 table and insert into another and delete from the
Thread moved from Members introductions. I don't see a question, or any java related code. Unless specified as related to java, this may be moved to the Other Programming Languages forum
I'd recommend reading Announcements - JDBC & Databases