Home » SQL & PL/SQL » SQL & PL/SQL » REG:Variable declaration in procedure
REG:Variable declaration in procedure [message #632098] Sat, 24 January 2015 23:25 Go to next message
chavva.kiru@gmail.com
Messages: 23
Registered: April 2012
Location: hyderabad
Junior Member
Hi

Im creating procedure,in that im checking one query if output is 'n' then Im calling exception.Inside that exception Im calling the same procedure after it went for sleep of 5 mins and incrementing counter value(gn_restart_ctr).like that if the counter is greater than 15 it has to come out.But while calling that procedure every time the counter initating to zero.

How to I avoide iniating the counter to zero if im calling the same procedure within that procedure.I tried to declare that counter variable in package specification also.But no use.

I require that variable has to increment if im calling the same proceure within the procedure.

awaiting for reply.

Exception not_ok_to_run

when not_ok_to_run then
if(gn_restart_cntr<=ln_sleep_cnt)
then
ln_err_num=-20000;
ls_err_msg:='INFO ONLY:'||'IN user
defined exception not ok_to_run';
ls_app_msg:='sleep#'||to_char(gn_restart_cntr)||'of max'||
to_char(ln_sleep_cnt);
spu_log_errors(ln_err_num,ls_err_msg,ls_app_id,ls_app_msg);
sp_log(gs_log_file,ls_app_msg);
dbms_lock.sleep(ln_sleep_time);
/*Calling the same procedure*/
upd_mon_reg_4_extracts(ais_type,ais_subtype,ais_rept_date,ais_app_code,aos_status);
else
rollback;
ln_err_num:=-20000;
ls_err_msg:='user defined error not_ok_to_run:slept max number');
ls_app_msg:='Failure max sleeps reached while waiting for iteration to finish';
spu_log_errors(ln_err_num,ls_err_msg,ls_app_id,ls_app_msg);
sp_log(gs_log_file,ls_err_msg);
aos_status:=substr(ls_err_msg,1,100);
end if;
raise

[Updated on: Sat, 24 January 2015 23:35]

Report message to a moderator

Re: REG:Variable declaration in procedure [message #632099 is a reply to message #632098] Sat, 24 January 2015 23:33 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: REG:Variable declaration in procedure [message #632104 is a reply to message #632098] Sun, 25 January 2015 01:06 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

From your previous topic:

Michel Cadot wrote on Mon, 19 January 2015 07:22

From your previous topic:

Michel Cadot wrote on Thu, 16 August 2012 16:20
From your previous topics:

BlackSwan wrote on Wed, 11 April 2012 16:43
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/


BlackSwan wrote on Wed, 11 April 2012 20:29
...
READ & FOLLOW the Posting Guidelines! http://www.orafaq.com/forum/t/88153/0/


With any SQL question, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Regards
Michel


In addition, Barbara helped you so much in your previous topics providing you codes and examples and you did never feedback and thank her.
Are you the kind of parasite we saw too much in these days?
Or are you a valuable person who deserves to be helped?


Previous Topic: error while running procedure
Next Topic: sql query to get avg value
Goto Forum:
  


Current Time: Fri Apr 26 01:49:54 CDT 2024