Sponsored Content
Top Forums Shell Programming and Scripting to find whether update query is successfull or not using Ksh Script Post 302273897 by ali560045 on Tuesday 6th of January 2009 05:45:13 AM
Old 01-06-2009
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
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

passing result of query to a varibale in ksh script

Hi, I have a scenario where in i have to extarct max of one column and pass it to a variable. i have tried to export the result as .dat file and read from that file.But my database is mainframe and it is not permitting me to export in .dat file.I have tried using .ixf file but reading from... (2 Replies)
Discussion started by: ammu
2 Replies

2. Shell Programming and Scripting

Script not successfull in cron

Hi, I have a script to FTP the files to other unit. Manually this script is running fine & files are getting transferred. But running the same script using crontab does not transfer files, although the cron log shows that the file was executed. PLz suggest (2 Replies)
Discussion started by: sandeep_kmehra
2 Replies

3. Shell Programming and Scripting

Tables to query to find users for database from shell script

I am coding shell script. I need to connect to different databases like DB2, Oracle and Sybase. I would then need to query tables where it has all the groups, users for that database. I would also need who has what kind of permissions. EG: I know for DB2 some TABAUTH table needs to be... (0 Replies)
Discussion started by: pinnacle
0 Replies

4. Shell Programming and Scripting

Exit for loop in a shell script if a condition is successfull

Hi All, I am stuch in a script where a for loop is running to execute some commands for some values. Now my problem is i have to have an if condition that if the first iteration is successful then it has to exit the for loop otherwise it has to continue normally. my code is this: for... (5 Replies)
Discussion started by: usha rao
5 Replies

5. Shell Programming and Scripting

trying to run this script from unix but the script is not successfull

Hi I am trying to run the below unix script in informatica comamnd task the script is in placed in the path (this script checks if the files are present in other server ) ------------------------------------------------------------------... (1 Reply)
Discussion started by: laxmi131
1 Replies

6. Shell Programming and Scripting

calling another script if it's contains SUCCESSFULL how?

Hi all, i'm a newbie here, I'm just wondering how can i call my second script if it's contain successfull. script1.sh how can i call my 2nd script if he contain SUCCESSFULL script2.sh SUCCESSFULL please advise, Thanks, (10 Replies)
Discussion started by: nikki1200
10 Replies

7. Shell Programming and Scripting

How to write a update query in perl script?

can any one suggest me on how to write a update query in perl script for Oracle database and also tell me abt how we can write a code for sending mails with report as attachment to appropriate persons? (1 Reply)
Discussion started by: Ramesh V Kumar
1 Replies

8. Shell Programming and Scripting

Shell Script (ksh) - SQLPlus query filter using a string variable

Using ksh, I am using SQLPlus to execute a query with a filter using a string variable. REPO_DB=DEV1 FOLDER_NM='U_nmalencia' FOLDER_CHECK=$(sqlplus -s /nolog <<EOF CONNECT user/pswd_select@${REPO_DB} set echo off heading off feedback off select subj_name from subject where... (5 Replies)
Discussion started by: nkm0brm
5 Replies

9. UNIX for Dummies Questions & Answers

Extract only the data from ksh script running netezza query

Hi I searched this forum before posting the question, but couldnt find it, the issue i'm facing is, i'm trying to select a column from a netezza table from a korn shell script, but the query runs var=$(nzodbcsql -q "select MAX(millcount) from table1";) echo $var it returns the value like... (10 Replies)
Discussion started by: maximus_jack
10 Replies
update(n)						       Tcl Built-In Commands							 update(n)

__________________________________________________________________________________________________________________________________________________

NAME
update - Process pending events and idle callbacks SYNOPSIS
update ?idletasks? _________________________________________________________________ DESCRIPTION
This command is used to bring the application "up to date" by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed. If the idletasks keyword is specified as an argument to the command, then no new events or errors are processed; only idle callbacks are invoked. This causes operations that are normally deferred, such as display updates and window layout calculations, to be performed imme- diately. The update idletasks command is useful in scripts where changes have been made to the application's state and you want those changes to appear on the display immediately, rather than waiting for the script to complete. Most display updates are performed as idle callbacks, so update idletasks will cause them to run. However, there are some kinds of updates that only happen in response to events, such as those triggered by window size changes; these updates will not occur in update idletasks. The update command with no options is useful in scripts where you are performing a long-running computation but you still want the applica- tion to respond to events such as user interactions; if you occasionally call update then user input will be processed during the next call to update. EXAMPLE
Run computations for about a second and then finish: set x 1000 set done 0 after 1000 set done 1 while {!$done} { # A very silly example! set x [expr {log($x) ** 2.8}] # Test to see if our time-limit has been hit. This would # also give a chance for serving network sockets and, if # the Tk package is loaded, updating a user interface. update } SEE ALSO
after(n), interp(n) KEYWORDS
event, flush, handler, idle, update Tcl 7.5 update(n)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy