Sponsored Content
Top Forums Shell Programming and Scripting Need to capture error of sybase isql in unix Post 302587059 by aksar on Wednesday 4th of January 2012 08:21:19 PM
Old 01-04-2012
Need to capture error of sybase isql in unix

Hi Gurus,

I am very new in Unix,
I have 1 script, in which I am truncating the table , then BCP the data in Sybase table, and then loading the data from sybase table to sybase table.

every thing is working fine, but the problem is with Error.

I made some hanges in my insert statement so that it failed , but I am not getting any error msg. I dont know how to put error msg.

pls help me out.
Code:
retu_statu=`$SYBASE/OCS-15_0/bin/isql -S$DSQUERY -U$AAAUSER -P$AAAUSERPWD <<-END_SQL | grep "ERRORLEVEL" | cut -d ";" -f 2 
use $AAAREPDB
truncate table $AAAREPDB..CTF_EXTRACT_PTF
go
END_SQL`

bcp $AAAREPDB..CTF_EXTRACT_PTF in /oams/w_ctcb/ctcb2ta/data_extract/${BatchScript}.$$.out -U$AAAUSERPWD -P$AAAUSERPWD -S$DSQUERY -f portfolio.fmt -Y -F

    
err_code=$?
    if [[ $err_code != 0 ]]; then
        echo "ERROR: Data Loading failed!!!\n\n\n"
        exit 255
    fi

retu_statu=`$SYBASE/OCS-15_0/bin/isql -S$DSQUERY -U$USER -P$USERPWD <<-END_SQL | grep "ERRORLEVEL" | cut -d ";" -f 2 
use $AAAREPDB

insert into $REPDB..uob_dwh_portfolio
select *,getdate) from $REPDB..CTF_EXTRACT_PTF

select 'ERRORLEVEL',';',@@error,';'
go


END_SQL`

I am not getting any error Problem in query is Getdate()
It should give me error

---------- Post updated 01-05-12 at 09:21 AM ---------- Previous update was 01-04-12 at 05:06 PM ----------

any sollution

Last edited by zaxxon; 01-04-2012 at 05:08 AM.. Reason: "awaiting your replies" is similar as "urgent". removed that - I guess you don't want to post it again and again.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to connect to sybase from Unix(AIX)

I have a script given below so can anyone explain me what it does? echo "use $DSQUERY\n go\n insert into ff.SmartCareLogin (username, password, userrole, fullname) values ('$1', '$1', '$2', '$3') go"|isql -Uff -P what is the use of $DSQUERY and go. When i am firiing isql command... (0 Replies)
Discussion started by: sachin.gangadha
0 Replies

2. Shell Programming and Scripting

Isql query in unix shell

Hi i want write a script for list of sysbase are having access or open. then i wrote like: USER="abc" PASS="xyz" SERVER="SCCS" DB="blue" WORK_DIR="/usr/home/ramakrishna" set -x isql -U${USER} -P${PASS} -S${SERVER}<<EOF>$WORK_DIR/output.log go use blue (database name) go use... (0 Replies)
Discussion started by: koti_rama
0 Replies

3. Shell Programming and Scripting

unix capture oracle function error

Hi, I want to execute an oracle function from unix script so for that I created a sample oracle function as below: create or replace function test_fn(test_date out varchar2) RETURN varchar2 IS BEGIN select to_char(sysdate,'DD-MON-YY') into test_date from dual; return test_date;... (5 Replies)
Discussion started by: dips_ag
5 Replies

4. Shell Programming and Scripting

How do i access sybase using isql and how do i get result set in perl script?

Hi, How do i get result set in perl script using isql while connecting sybase server. I have a perl script which connected to sybase and get the result set. but i wanted to get the result set. How do i get the result set in perl script not unix shell script.. $server ="ServerName"; open... (1 Reply)
Discussion started by: solo123
1 Replies

5. Shell Programming and Scripting

Need to capture error of sybase sql in unix

Hi Gurus, I am very new in Unix, I have 1 script, in which I am truncating the table , then BCP the data in Sybase table, and then loading the data from sybase table to sybase table. every thing is working fine, but the problem is with Error. I made some hanges in my insert statement so... (1 Reply)
Discussion started by: aksar
1 Replies

6. Shell Programming and Scripting

Sybase isql writing spaces to file

I'm running isql in sybase on a Linux box to read a table, and write the contents to a file. It needs to be a nice comma delimited file for input into another system. It reads the DB fine and writes the file. However, I have two issues. 1) I don't want the line width to be limited in any... (2 Replies)
Discussion started by: Cynthia
2 Replies

7. Shell Programming and Scripting

How to assign value from isql to UNIX variable

I want output to be assigned to UNIX variables echo "Enter RRS ID: " read rrs isql -SPROD_DDS -USYBUSER -PSYBPASS -b -osfg.out << EOF use sip go set nocount on select issuerId, legalStructTxt, productName, issuerName from sf_product where rrsId = $rrs go EOF (1 Reply)
Discussion started by: JayDoshi
1 Replies

8. Shell Programming and Scripting

Error in Sybase connectivity via UNIX

Helo Experts, I have an issue in connecting to sybase from UNIX. PFB, my code : #!/bin/ksh ############################################################################### # # Filename: docflo_split.sh # # Description:docflo_split.sh WrapperScript splits the temporary file... (1 Reply)
Discussion started by: Nits
1 Replies

9. Shell Programming and Scripting

Isql syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (1 Reply)
Discussion started by: Suresh
1 Replies

10. UNIX for Advanced & Expert Users

Isql and If Exist syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (7 Replies)
Discussion started by: Suresh
7 Replies
isql(1) 							UnixODBC Reference							   isql(1)

NAME
isql - utility to submit SQL queries to a data source. iusql - Unicode version of isql. SYNOPSIS
isql DSN [UID [PWD]] [options] DESCRIPTION
isql can be used to submit SQL to a data source and to format/output results. It can be used in batch or interactive mode. OPTIONS
DSN Name of the data source you want to connect to. UID Your login to connect the DSN. PWD Your password needed to login to the DSN. -b Batch mode. It will not do any prompting. -dx Delimit columns with x. -x0xXX Delimit columns with XX, where XX is in hex. For example -x0x09 will use a tab. -w Wrap results in an HTML table -c Print column names on first row. This options only has effect in combination with the -d option. -mn Limit column display width to n -v Verbose output. --version This prints the version. EXAMPLES
cat My.sql | isql WebDB MyID MyPWD -w Each line in My.sql must contain exactly 1 SQL command except for the last line which must be blank. AUTHOR
This manual page was written by Kurt Roeckx <kurt@roeckx.be> for the Debian package of unixODBC. UnixODBC Dec 2004 isql(1)
All times are GMT -4. The time now is 09:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy