hello all,
I am new to shell scripting and to unix... so the following is my assignment..
here i am trying to insert a values into sqlplus database using shell script.
the following is my shell script
InsertDelete.sh
#! /bin/sh
echo "*The MENU
1.Insert The Values Into DataBase
2.Delete The Values From DataBase
Enter Your Option:"
read choice
case "$choice" in
1)echo "The Insert Operation"
echo "Enter the Name"
read name
echo "Enter the age"
read age
sqlplus scott/tiger @secondScript.sql;;
2)echo "The Delete Operation";;
*)echo "Invalid Operation";;
esac
and this is my secondScript.sql
DEFINE name=$name
DEFINE age=$age
SPOOL secondScript.lst
SET LINESIZE 100
SET PAGESIZE 50
INSERT INTO PRADEEP_DATA (name,age) VALUES ('&name','&age');
commit
SPOOL OFF
The Problem is the values of name and age, is not passing to the .sql file ?
and when i check the database,
instead of values for name and age
$name and $age is inserting into the database!!
can anyone help me in this regard... ?
thanks in advance !!!