Search This Blog

Monday, March 29, 2010

How to complete Host(Unix Shell Script) Concurrent Program with Warning

If we have a concurrent program as of type host(Unix Shell Script), then the program by default either completes Normal or in Error.
If we return from shell script using text exit 0, program completes in normal and if we use any value other value e.g. exit 1, exit 2, exit 10 etc then the program completes in error.
Below is the code that can be used if requirement is to complete it in warning.


sqlplus -s $p_usr_pwd <<-EOF
set feedback off
declare
l_stat Boolean;
l_session_id Number;
begin
fnd_global.initialize(session_id => l_session_id
, user_id => fnd_global.user_id
, resp_id => fnd_global.resp_id
, resp_appl_id => fnd_global.resp_appl_id
, security_group_id => null
, site_id => null
, login_id => null
, conc_login_id => null
, prog_appl_id => null
, conc_program_id => null
, conc_request_id => $p_req_id
, conc_priority_request => null);
l_stat := fnd_concurrent.set_completion_status('WARNING','Completed in Warning. Review log for details.');
commit;
end;
/
exit;
EOF

In the example above $p_usr_pwd stores database username/password, $p_req_id stores the request ID for concurrent request that needs to complete in warning.

Related Post:
Concurrent program parameter in Unix Shell Script
Calling SQLPLUS from unix shell script

4 Comments:

OS said...
This comment has been removed by the author.
Suresh Vaishya said...

How are you passing parameters. If you are doing that using conc. program, then should not be a problem.

Unknown said...

This is not working for me -- my request ends with a status of Success. Would you mind posting an entire shell script, so we can see which shell you are using, which environment variables you might be exporting, etc.

I've seen an example on a Metalink Community page in which the author has exec-ed ksh, and then exported several parameters, and when I copy his script it does work. I'm seeking to understand which of these additional pieces from his script are the "key" to making this work.

Thanks for your help,
Jennie

Nagaraj said...

Hi Suresh,

In my ksh script, I don't have a sql statement but do some connections using certificates. So if for some reason , the connection fails, how do i return an error or a warning. Infact I dont seem to have a way to capture exceptions when connections fail in the linux script.

Any pointers, Please do let me know.

Regards:
Nagaraj.s

Copyright (c) All rights reserved. Presented by Suresh Vaishya