Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Passing integer values from shell script to a .sql file

Passing integer values from shell script to a .sql file

From: anju <anjani.unix.help_at_gmail.com>
Date: 6 Jun 2006 06:53:32 -0700
Message-ID: <1149602011.892794.319880@h76g2000cwa.googlegroups.com>


Hi All,

        i'm facing the below problem in passing integer values.



$ ./ex5.sh

insert into emp values ($1,'$2',$3,'$4')
                        *

ERROR at line 1:
ORA-00911: invalid character

Script



$cat ex5.sh

#!/usr/bin/bash

# this is a sample file to insert data into a table

USERNAME="system"
PASSWD="passwd"
SID="orcl"
declare -i val1=102
val2="tom"
declare -i val3=40000
val4="boston"

# database connection and updation.

        sqlplus -s $USERNAME/$PASSWD <<EOF
        @"/home/abc/second.sql" $val1 $val2 $val3 $val4
EOF

SQL file

++++++++++++++++++++++++

insert into emp values ($1,'$2',$3,'$4') /
++++++++++++++++++++++++



How can i pass integer values to the sql script.

Thanks in advance,
an Received on Tue Jun 06 2006 - 08:53:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US