Hello all,
I have one query on how to use shell script arguments ($1 $2) , and use these values as input parameters to pkg.function(errmsg,$1,$2);
!#/bin/ksh
function load_iloc
{
echo "set feedback off
set heading off
set serveroutput on size 1000000
VARIABLE GV_return_code NUMBER;
VARIABLE s_loc NUMBER;
VARIABLE e_loc NUMBER;
VARIABLE GV_script_error CHAR(600);
EXEC :GV_return_code := 0;
EXEC :s_loc := $1 ;
EXEC :e_loc := $2 ;
WHENEVER SQLERROR EXIT 1
DECLARE
FUNCTION_ERROR EXCEPTION;
L_exist VARCHAR2(1);
L_error_type VARCHAR2(255):= NULL;
L_err_msg VARCHAR2(1000);
L_loc number;
BEGIN
if NOT pkg.function(L_err_msg,:s_loc,:e_loc) then
raise FUNCTION_ERROR;
end if;
EXCEPTION
when FUNCTION_ERROR then
ROLLBACK;
:GV_return_code := 1;
:GV_script_error := L_err_msg;
when OTHERS then
ROLLBACK;
:GV_script_error := L_err_msg;
:GV_return_code := 1;
END;
/
print :GV_script_error;
exit :GV_return_code;
/" | sqlplus -s ${connectStr} >> ${logFile}
return $?
}
--------------------------------------------------------------
But this code is not working , kindly do the needful by suggesting a solution.
Thanks
Vijay