Need to capture error of sybase sql in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to capture error of sybase sql in unix
# 1  
Old 01-04-2012
Network 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 that it failed , but I am not getting any error msg. I dont know how to put error msg.

pls help me out, Its an urgent issue.
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

Moderator's Comments:
Mod Comment Please use code tags!

Last edited by zaxxon; 01-04-2012 at 04:59 AM.. Reason: code tags, see PM
# 2  
Old 01-04-2012
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.

If you have posted a question in the regular forum with a subject "Urgent" "Emergency" or similar idea, we will, more-than-likely, close your thread and post this reply, redirecting you to the proper forum.

Of course, you can always post a descriptive subject text, remove words like "Urgent" etc. (from your subject and post) and post in the regular forums at any time.


Thank you.

The UNIX and Linux Forums
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX Sqlplus - Capture the sql statement about to run and execution status

Greetings Experts, I am on AIX using ksh. Created a unix script which generates the CREATE OR REPLACE VIEW ... and GRANT .. statements, which are placed in a single .txt file. Now I need to execute the contents in the file (there are around 300 view creation and grant statements) in Oracle and... (4 Replies)
Discussion started by: chill3chee
4 Replies

2. 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

3. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: aksar
3 Replies

4. Shell Programming and Scripting

Need to Capture Sql Failures

Hi guys, I am inserting and updating records in Oracle database using shell Script based on business logic. Now Whenever the insert or Update fails, i want to capture it. i tried to capture the return code ($?), but it is not reflecting it.... (3 Replies)
Discussion started by: mac4rfree
3 Replies

5. UNIX for Dummies Questions & Answers

Capture Error In SQL Plus

Hi I am trying to fetch the data from Oracle Table More my_query.sql | sqlplus -s 'scott/tiger@OrcaleSID ' | sed 's///g;s///g' > sample_file Now if the table passed in the my_query.sql is wrong or there is some other error insied SQL how i can caputure that i tried More... (1 Reply)
Discussion started by: max_hammer
1 Replies

6. 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

7. UNIX for Dummies Questions & Answers

how to capture no. of rows updated in update sql in unix db2

hi, i am a new user in unix..and we have unix db2. i want to capture the no. of rows updated by a update db2 sql statement and redirect into a log file. I've seen db2 -m...but not sure how the syntax should be. The update sql that I'm going to run is from a file... Can you please share... (1 Reply)
Discussion started by: j_rymbei
1 Replies

8. Shell Programming and Scripting

Bourne shell script with embedded Sybase SQL

Hi, I need a simple (as possible) Bourne shell script that takes an input file of adminID's and spits out a list of adminID's and related tradeID's. Both adminID and tradeID are columns in a Sybase database table called "trades", in which they have a one-to-one relationship. adminID is a... (3 Replies)
Discussion started by: chatieremerrill
3 Replies

9. Programming

Need help with complex SQL query (Sybase)

Hello, I have three tables. I need an SQL query (preferably Sybase) that will return all of the stringID values of table B where the following conditions exist: (1) B.intID = A.intID (2) B.intID != C.intID or (B.intID = C.intID and (C.v1 = 0 or C.v2... (2 Replies)
Discussion started by: chatieremerrill
2 Replies

10. UNIX for Advanced & Expert Users

Need sybase sql command help

Guys, My question is on the Sybase sql query, command 'sp_help' shows me list of all the tables. but I can not view them page by page. So is there any command to view them page by page as in our unix 'ls | less'. and one more thing command/procedure to store output into the file. Any... (4 Replies)
Discussion started by: jagdish.machhi@
4 Replies
Login or Register to Ask a Question