If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Scripts and Databases

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-27-03, 04:57
sweevo sweevo is offline
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 9
Scripts and Databases

Hi,

I want to write a Unix script to prompt the user for inputs, then perform two SQL routines (check one of the inputs is valid against a database, then batch update the DB incorporating the inputs).

I am pretty new to Unix scripting so only have experience of getting inputs and manipulating strings. I have no idea on how to query and update databases from the scripts, so any help would be appreciated (eg. starting points or tutorials etc)

Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-27-03, 05:13
ndu35 ndu35 is offline
Registered User
 
Join Date: May 2003
Location: France
Posts: 112
Re: Scripts and Databases

Here's a beginning for your script, hope this will help you.


echo "My Question ?\c"
read response

sql_response=`sqlplus -s $ORACLE_LOGIN/$ORACLE_PWD@$ORACLE_ALIAS @my_batch.sql $response`

if [ "$sql_response" = ....

Quote:
Originally posted by sweevo
Hi,

I want to write a Unix script to prompt the user for inputs, then perform two SQL routines (check one of the inputs is valid against a database, then batch update the DB incorporating the inputs).

I am pretty new to Unix scripting so only have experience of getting inputs and manipulating strings. I have no idea on how to query and update databases from the scripts, so any help would be appreciated (eg. starting points or tutorials etc)

Thanks.
Reply With Quote
  #3 (permalink)  
Old 10-28-03, 05:12
sweevo sweevo is offline
Registered User
 
Join Date: Oct 2003
Location: UK
Posts: 9
Hi,

Thanks for that - though sorry, I should have said it's an Ingres DB I'm working with. Are the fundamentals the same?

Cheers
Reply With Quote
  #4 (permalink)  
Old 10-28-03, 05:45
ndu35 ndu35 is offline
Registered User
 
Join Date: May 2003
Location: France
Posts: 112
Hi,
i do no know ingres db but i think the fondamentals are the same;
be careful of the output of "sqlplus" to store correctly the result in the variable sql-response


Quote:
Originally posted by sweevo
Hi,

Thanks for that - though sorry, I should have said it's an Ingres DB I'm working with. Are the fundamentals the same?

Cheers
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On