| Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-09-2013, 04:36 AM
|
#1
|
|
LQ Newbie
Registered: Oct 2012
Location: Hyderabad
Posts: 9
Rep: 
|
how do i know sql command is executed or not in unix?
i want to insert new record based on if below record inserted into table.how do i know query is executed or not? please look the below query for reference in unix.
sqlplus -s bscsadm@bscspr/bs#s7Ta0m << EOF
insert into $1 values('ram',222,'hyd');
EOF
|
|
|
|
02-09-2013, 06:55 AM
|
#2
|
|
Member
Registered: Jan 2012
Distribution: Slackware
Posts: 690
Rep: 
|
"Unix" is not executingthat SQL query, the sqlplus executable is.
Most commands return a non-zero exit code if an error condition occurred. Try checking the $? variable immediately after running sqlplus.
|
|
|
|
02-09-2013, 07:44 AM
|
#3
|
|
Moderator
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 10,356
|
Moderator Response
Moved: This thread is more suitable in <Other *NIX> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
|
|
|
02-10-2013, 03:51 AM
|
#4
|
|
LQ Newbie
Registered: Dec 2012
Posts: 3
Rep: 
|
Quote:
Originally Posted by Ser Olmy
"Unix" is not executingthat SQL query, the sqlplus executable is.
Most commands return a non-zero exit code if an error condition occurred. Try checking the $? variable immediately after running sqlplus.
|
You left out a bit of detail. You can check the $? variable by running this in a terminal as root.
Code:
// harmful shell statement removed.
Last edited by crabboy; 02-12-2013 at 08:26 AM.
|
|
|
|
02-10-2013, 08:32 AM
|
#5
|
|
Moderator
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.4 OpenSuSE 12.2
Posts: 9,897
|
Please, ignore the post above. It will be deleted soon.
|
|
|
|
02-12-2013, 08:31 AM
|
#6
|
|
Moderator
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,816
Rep: 
|
You may have problems with your statement depending on if sqlplus will auto commit your transaction when you exit. I think the default behavior is to rollback any changes. You would likely have to add a commit; after your insert statement.
I'd be best to capture an error condition in your script and set the exit code when your script terminates. Search around for sqlplus exit code.
|
|
|
|
| Thread Tools |
Search 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
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|