![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sed: how to insert tab? | Juha | Shell Programming and Scripting | 2 | 10-29-2007 04:15 AM |
| Insert line break in vi's command mode | Skogsmulle | UNIX for Dummies Questions & Answers | 3 | 07-06-2007 07:47 AM |
| unix command to insert double quotes | berlin_germany | Shell Programming and Scripting | 2 | 01-17-2007 10:07 AM |
| script to run shell command and insert results to existing xml file | littlejon | Shell Programming and Scripting | 5 | 08-12-2005 01:59 PM |
| awk command for INSERT statement | nattynatty | Shell Programming and Scripting | 4 | 05-10-2002 11:11 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sql insert command
Hi,
sqlplus -s / <<EOF > /dev/null insert into table1 (a1, a2, a3) values ('a',1,'b'); commit; EOF in the above code can i pass the values to the insert command from shell script like this: insert into table1 (a1, a2, a3) values ('$a',$b,'$c'); If yes, how is it passed?? Any help greatly appreciated. (I found some similar threads but culdn't find any particular soln to this) thanks, abey |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
The problem is that you require ' characters to delimit strings. Here is a workaround not using a here doc:
Code:
userid=me
pswd=mypassword
command=$(
echo "$userid/$pswd"
printf "insert into table1 (a1, a2, a3) values ('%s','%s','%s');\n" $a $b $c
echo "commit;"
echo "exit")
echo "$command" | sqlplus -s
|
|
#3
|
|||
|
|||
|
Code:
a='abc'
b='def'
sqlplus -s / <<EOF
select '${a}', '${b}' from dual;
EOF
Last edited by tmarikle; 05-19-2006 at 09:07 AM. |
|||
| Google The UNIX and Linux Forums |