Shell script internally call another shell script and doesnot return the ouput to main script when i use the external table

Multi tool use
Multi tool use


Shell script internally call another shell script and doesnot return the ouput to main script when i use the external table



My main script api_call.sh internally calls config.sh and should pass the parameter value to the main script.
The script works fine when I execute it in Linux. But when I queries through external table the second script does not return the output to the main script.



Can anyone please tell me.
Do I need to specify the location when I call the second script when I queried via external table..?
And how can I return the value from the second script to the first one.



Script1: apicall.sh


export SourceName FileName
. ./config.sh "$SourceName" "$FileName"



get the application type from the config file to the main script
v_application_type=$application_type



Script2: config.sh


while :
do
case $1 in
xxx)
application_type=application/json
done
break
;;
*)
paramexist=0
break
;;
esac
done

CREATE TABLE XXX_XT
(
SCRIPT_OUTPUT VARCHAR2(4000 BYTE)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY TMP_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
preprocessor edw_bin_dir : 'apicall.sh'
skip 1
LOGFILE LOG_DIR:'api_call_xt.log'
fields terminated by ','
)
LOCATION (TMP_DIR:'xxx.json')
)
REJECT LIMIT UNLIMITED
PARALLEL ( DEGREE DEFAULT INSTANCES DEFAULT );





how are you running the query/sql statements? I don't even see a sqlplus connection in the script.
– Kaushik Nayak
Jul 2 at 6:33






@Ajitha : You are exporting two variables, but you never use them in a child process. Hence you can drop your export command. Also I don't see that you provide values for SourceName and FileName (but maybe this is in a part of apicall.sh which you didn't show here).
– user1934428
Jul 2 at 10:00



export


SourceName


FileName


apicall.sh





Am running select XT table sql in oracle where in the preprocessor section am using the apicall.sh script. so when I run sql the xt table ran the shell script.
– Ajitha
Jul 3 at 1:06





Two variables from the main script actually passed the parameter to the child process and using it in case statement $1 and $2 I haven't pasted the script relates to $2 that is filename. sourcename and filename am passing it as input when I run the script. The script run well if I ran in Linux environment but when I ran the same script through external table it behaves differently
– Ajitha
Jul 3 at 1:11









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

T5v8D4h0L0jYVA T2mnHn,EhQQVwTi jEUXR,Pa3a9KgjhwOP pY7h4N64lotlbFJF
pKxb ci0V7K tTK1abhAcqclTmsQQ9 yGp26eM,0me9Na GJT,R cqtsJ5 U6t,sLvpUIq8AUWEkaVghVaIaljKg,Jw8lebYQX

Popular posts from this blog

Rothschild family

Boo (programming language)