The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Script not successfull in cron sandeep_kmehra Shell Programming and Scripting 2 09-04-2008 10:33 AM
find -mtime query Rajat UNIX for Dummies Questions & Answers 1 07-09-2008 07:12 AM
Dynamic update loop query on Sybase database Alaeddin Shell Programming and Scripting 10 12-13-2007 06:26 AM
query about find and -exec shriashishpatil UNIX for Advanced & Expert Users 2 04-12-2007 01:16 AM
find -perm query napolayan UNIX for Dummies Questions & Answers 1 11-28-2006 02:28 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-06-2009
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
to find whether update query is successfull or not using Ksh Script

i have a script that performes an update operation. I just wanted to know whether that update statement is successfull or not.

Below the script:
Code:
#!/bin/ksh
. $HOME/conf/systemProperties/EnvSetup.properties
sqlplus -silent sie/da@edn.world <<END
set pagesize 0 feedback off verify off heading off trimspool on echo off
spool /ednadtu3/u01/pipe/naveed/class/Script_Fails.log 
UPDATE SIEBEL.S_ASSET_XM SDPX
SET SDPX.ATTRIB_03   = 'Inactive',
SDPX.LAST_UPD_BY = '1-42V',
SDPX.LAST_UPD    = SYSDATE,
SDPX.ATTRIB_04   = 'SQQ3'
 WHERE SDPX.PAR_ROW_ID  IN (select B.PAR_ASSET_ID from SIEBEL.s_asset_rel B
                                         where B.relation_type_cd= 'SDP-METER' ---- and X_rel_status= 'Active'
                                             and B.asset_id
                                                IN (select A.asset_num from SIEBEL.s_asset A where
                    A.x_electronic_id IN ( '090845086LG')))
   AND SDPX.ATTRIB_01   = 'AMR Ready'
   AND SDPX.ATTRIB_03   = 'Active';
commit;
spool off
exit;
END
I have use the concept of spool file but in my script the generated spool file "Script_Fails.log" is containg null values .Means a 0 byte spool file is getting created . The query works fine in my database and successfully creating spool file but using the script it's creating a 0 byte spool file.please help me in this

Below the spool file in SQL*Plus:
Quote:
SQL> UPDATE SIEBEL.S_ASSET_XM SDPX
2 SET SDPX.ATTRIB_03 = 'Inactive',
3 SDPX.LAST_UPD_BY = '1-42V',
4 SDPX.LAST_UPD = SYSDATE,
5 SDPX.ATTRIB_04 = 'SQQ3'
6 WHERE SDPX.PAR_ROW_ID IN (select B.PAR_ASSET_ID from SIEBEL.s_asset_rel B
7 where B.relation_type_cd= 'SDP-METER' ---- and X_rel_status= 'Active'
8 and B.asset_id
9 IN (select A.asset_num from SIEBEL.s_asset A where
10 A.x_electronic_id IN ( '090845086LG')))
11 AND SDPX.ATTRIB_01 = 'AMR Ready'
12 AND SDPX.ATTRIB_03 = 'Active';
0 rows updated.
SQL> commit;
Commit complete.
SQL> spool off
  #2 (permalink)  
Old 01-06-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by ali560045 View Post
i have a script that performes an update operation. I just wanted to know whether that update statement is successfull or not.

Check the return code which is stored in "$?".
  #3 (permalink)  
Old 01-07-2009
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
Can you just explain me in detail as to where do i need to use that.
  #4 (permalink)  
Old 01-07-2009
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by ali560045 View Post
Can you just explain me in detail as to where do i need to use that.

Code:
sqlplus ... <<END
...
END
case $? in
     0) echo Success;;
     *) echo Failed ;;
esac
Sponsored Links
Closed Thread

Bookmarks

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 07:25 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