The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Call sqlplus in the shell script beaniebear Shell Programming and Scripting 3 05-13-2008 10:30 AM
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 03:31 PM
Shell Script: want to insert values in database when update script runs ring Shell Programming and Scripting 1 10-25-2007 04:06 AM
Shell Script And SQLPLUS maco_home UNIX for Dummies Questions & Answers 6 08-25-2007 01:05 PM
running shell script from sqlplus dkr123 Shell Programming and Scripting 9 07-20-2006 11:52 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2009
pradeept pradeept is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 1
Unhappy insert values into sqlplus database using shell script

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 !!!
 

Bookmarks

Tags
passing variables to sqlplus

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0