![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Executing several bash scripts in succession | fantasyland | Shell Programming and Scripting | 7 | 05-16-2009 08:54 PM |
| Specified Ksh but executing in bash | akhilnagpal | UNIX for Dummies Questions & Answers | 7 | 02-04-2009 11:45 AM |
| executing mysql load statement from shell script | DILEEP410 | Shell Programming and Scripting | 4 | 01-22-2009 03:18 AM |
| Executing a Oracle SQL statement in a UNIX script | ganga.dharan | Shell Programming and Scripting | 1 | 12-08-2008 10:44 AM |
| installing Orcale 8i on unix | Parameswaran.AR | UNIX for Dummies Questions & Answers | 1 | 03-15-2006 11:57 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Bash executing Orcale Update statement
Hi All,
Using Solaris box bash-3.00$ echo $BASH_VERSION 3.00.16(1)-release I have a real bummer of a bug, basically Im running a bash script that executes a bash function "dbase_sql". The bash function accepts a parameter in the form of an Oracle update statement eg dbase_sql "update dte_batch_details set row_count='$row_count' , checksum_value='$checksum_value' , load_attempts=NVL(load_attempts,0)+1 , pre_stage_errors='$pre_stage_errors' , message='$sql_err_msg' where object_name='$source_tabin_name'" The function itself is as below dbase_sql() { echo "dbase_sql() 1.1 " local sql="$1" echo "sql="$sql echo "showed ECHO!" sqlplus -s $DBUSER/$DBPASS@$DBNAME<<EOF set serveroutput on size 1000000 set verify off set feedback off VARIABLE vi_err NUMBER declare begin ${sql}; commit; :vi_err:=0; exception when others then :vi_err:=1; end; / EXIT:vi_err EOF } The perplexing thing is that I cannot get the call to the function to work in my main shell script, so I created a simple script that calls the function and that does seem to work! For some reason, the bug is that the echo does not show the full statement in the function and hence it passes the malformed statement to the oracle call which then fails. Error from the shell is as follows: dbase_sql() 1.1 ' , load_attempts=NVL(load_attempts,0)+1 , pre_stage_errors='Y' , message='/#SQL Loader Bad File[/export/home/ORACLE/product/10.2.0/TORPEDO/LOGS/SQLLDR_bad_TOS_TABIN218.bad]' where object_name='TOS_TABIN218' showed ECHO! Thursday, 25 June 2009 14:06:43 BST #Application Error - Abort: Call to dbase_func.dbase_sql() The working version shows: dbase_sql() 1.1 sql=update dte_batch_details set row_count='1' , checksum_value='1' , load_attempts=NVL(load_attempts,0)+1 , pre_stage_errors='Y' , message='None/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]/#SQL Loader Bad File[]' where object_name='TOS_TABIN218' showed ECHO! Any ideas?! Kind Regards Satnam |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|