Home » Infrastructure » Unix » SQLPLUS form UNIX KSH
SQLPLUS form UNIX KSH [message #110703] Wed, 09 March 2005 14:19 Go to next message
gmmike
Messages: 2
Registered: March 2005
Junior Member
Hi I have the script below which calls SQLPLUS from UNIX KSH.

The sqlplus command does not work (no errors) and I get no value in the variable rc

The script is supposed to truncate a table where the table name is stored in the first passed parameter.

Pleas help.
Thanks.

GMMIKE
-------------------------------------------------------------

TEMPDIR="/u13/backup_temp"
d1=`date`
echo $d1
of=purgeerr.$$.txt
scriptfile="$TEMPDIR\purgecmd.txt.$$" # This file contains the truncate command - Uniquely named every run
echo "Truncate Table $1;" > $scriptfile # Overwrite contents if exists
rc=`$ORACLE_HOME/bin/sqlplus -s A/B@myinstance @ $scriptfile < /dev/null > $of 2> $1.err.nnn.log`
echo "========"
echo $rc #<-- SHOWS NO VALUE
echo "========"
#----- Remove the temp file after execution
rm -f $scriptfile
cat $of
rm -f $of
echo "-----------------run end."

[Updated on: Thu, 10 March 2005 05:01]

Report message to a moderator

Re: SQLPLUS form UNIX KSH [message #110786 is a reply to message #110703] Thu, 10 March 2005 05:50 Go to previous messageGo to next message
Uwe
Messages: 260
Registered: February 2003
Location: Z├╝rich, Switzerland
Senior Member
Where did you set the environment varables for Oracle ? Sometimes a called script does not get ORACLE_HOME, ORACLE_BASE and ORA_NLS33. For ksh you need to export them

export ORACLE_HOME = /.......

Uwe
Re: SQLPLUS form UNIX KSH [message #110798 is a reply to message #110786] Thu, 10 March 2005 07:04 Go to previous message
gmmike
Messages: 2
Registered: March 2005
Junior Member
OK thanks.
Previous Topic: How to read the out variables of a oracle stored procedure
Next Topic: password script in UNIX..
Goto Forum:
  


Current Time: Sat Jan 23 06:58:33 CST 2021