sqlplus -s /nolog << !EOF >> $LOG 2>&1
set serveroutput on size 1000000
whenever sqlerror exit sql.sqlcode
connect apps/$PWD
declare
l_return_status number := 0;
begin
CLONE_SETUP.clone_main('$TargetInstance','$SourceInstance','$Rerun',$ReturnStatus);
l_return_status := $ReturnStatus;
dbms_output.put_line('Return Status : '||l_return_status);
if l_return_status = 0 then
commit;
dbms_output.put_line('Rapid Clone succeeded, Commit performed');
else
rollback;
dbms_output.put_line('Rapid Clone failed, Rollback performed');
end if;
end;
/
exit
!EOF
if [ $ReturnStatus -ne 0 ]; then
exit
fi
When I execute unix script, I get following error
CLONE_SETUP.clone_main('ohfpch','ohfrpd','N',0);
*
ERROR at line 4:
ORA-06550: line 4, column 51:
PLS-00363: expression '0' cannot be used as an assignment target
ORA-06550: line 4, column 2:
PL/SQL: Statement ignored
I want to pass the unix parameter ReturnStatus to the procedure CLONE_SETUP.clone_main. This procedure has parameters (p_target_instance IN varchar2, p_source_instance IN varchar2, p_rerun IN varchar2,
p_return_status IN OUT NUMBER). After this procedure gets executed, I want to return the value of p_return_status back to the Unix script and into the unix variable ReturnStatus which then I assign local pl/sql variable l_return_code which I use to decide whether to commit or rollback. Also, later I use ReturnStatus to decide if I want to exit from the Unix script execution alltogether.
How do I achieve this?
Thanks in advance.
Last edited by samdba; 11-18-2008 at 09:44 AM.
Sam
------------------------
To handle yourself, use your head. To handle others, use your heart
With the above, I am getting NULL in ReturnStatus. Anyway, I found out the simple workaround for this issue. I have added the following.
grep "Failed Clone" $LOG > check_fail_clone.txt
if [ -s check_fail_clone.txt ]; then
error_exit "$LINENO $ER Executing CLONE_MAIN - Clone package has failed. Check Log file for more details"
fi
This resolved the problem.
Thanks for your help.
Sam
------------------------
To handle yourself, use your head. To handle others, use your heart
Bookmarks