Вот эти 3 процедуры. В данной теме я чайник!
- Код: Выделить всё
CREATE OR REPLACE PACKAGE BODY TREST.pack_control_zag AS
/******************************************************************************
NAME: pack_control_zag
PURPOSE:
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 08.10.2009 1. Created this package.
******************************************************************************/
PROCEDURE p_select_t_author
( m_id_author int default null ,
m_type int default null,
P_CURSOR OUT sys_refcursor )
as
begin
if m_id_author is null then
if m_type is null then
open P_CURSOR for SELECT t.ID, T.NAME, T.TYPE FROM TREST.T_AUTHOR T order by name ;
else
open P_CURSOR for SELECT t.ID, T.NAME, T.TYPE FROM TREST.T_AUTHOR T where type = m_type order by name ;
end if;
else
open P_CURSOR for SELECT t.ID, T.NAME, T.TYPE FROM TREST.T_AUTHOR T where t.id = m_id_author;
end if;
end;
PROCEDURE p_ins_up_t_author ( m_id_author in out int ,
m_name t_author.name%type,
m_type t_author.type%type
)
as
begin
if m_id_author is null then
insert into t_author ( name, type) values ( m_name, m_type) returning id into m_id_author;
else
update t_author set name = m_name,
type= m_type where id = m_id_author;
end if ;
exception
when no_data_found then
insert into t_author ( name, type) values ( m_name, m_type) returning id into m_id_author;
when others then
my_code := SQLCODE;
my_errm := SQLERRM;
raise_application_error (-20201, substr ( my_code , 1 , 300 ));
end;
PROCEDURE p_del_t_author ( m_id_author int)
as
begin
if m_id_author is not null then
delete t_author where id = m_id_author;
end if;
end;
END pack_control_zag;
/