prompt Create a function F_getprocname
CREATE ORREPLACEFUNCTION f_getprocname RETURN VARCHAR2
-- gets the name and caller of the function or stored procedure itself
is
L_ownerVARCHAR2( 30);
L_nameVARCHAR2( 30);
L_linenonumber;
L_typeVARCHAR2( 30);
BEGIN
Owa_util.Who_called_me(l_owner , l_name< Span style= "Color:navy" > , L_lineno , L_type );
RETURN L_ Owner | | '. ' | | L_name ;
end;
/
promptis in the execution Create a tableT_proc_logs
Declare
???? V_count Number:=0;
???? V_tb_namevarchar2( 1000):=' T_proc_logs ';
begin
????SELECTCount(*) intoV_count fromUser_objectsWHEREobject_name=UPPER( V_tb_name);
????ifV_count>0 Then
????????ExecuteImmediate' Drop table '||UPPER( V_tb_name);
????Endif;
end;
/
CreateTableT_proc_logs
(
log_idnumber( 10)default0 notnull,
Proc_mcVARCHAR2( 100)default‘ ‘ notnull,
TITLEVARCHAR2( 4000)default‘ ‘ notnull,
CONTENTVARCHAR2( 4000)default‘ ‘ not null
Log_type varchar2 ( 10< Span style= "Color:navy" > ) default " not null
Log_time DATE
Span style= "Color:navy" > );
promptis in the execution Create a sequenceseq_log_id
Declare
???? V_countnumber;
???? V_sequence_namevarchar2( 1000):=' seq_log_id ';
begin
SelectCount(*) intoV_count fromUser_sequences AwhereA.Sequence_name=Upper( V_sequence_name);
if(V_count=0) Then
ExecuteImmediate' Create sequence '||V_sequence_name | |
' increment by 1 start with 1 ' | |
' maxvalue 2100000000 minvalue 1 ' | |
' cycle nocache Noorder ' ;
end < Span style= "Color:blue" > if
end;
/
?
?
?
?
?
?
?
Oracle Stored Procedure Code logging