PLS-00363: expression '0' cannot be used as an assignment target
Hi all,
I have a Unix shell script something like this.
TargetInstance=""
SourceInstance=""
Rerun="N"
ReturnStatus=0
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.