Tags

, , , , ,

here is sample code to:

  • call oracle sql statements in UNIX and
  • use UNIX variable in SQL statement. See the variable ‘”$FILE”‘

#Sample code

for FILE in `ls`
do
echo $FILE
TEMP=`echo ”
set heading off;
set TERMOUT off;
set echo off;
Insert Into FILES_IN_DIRECTORY_TABLE
Values(SEQUENCE_S.NEXTVAL,
‘”$FILE”‘,
‘IN_PROCESS’,
NULL,
SYSDATE,
‘49238’,
SYSDATE,
‘49238’,
‘49238’);
COMMIT;
exit;” | sqlplus -s user/password@host:port/service`
echo “$TEMP”
done

Advertisements