Sponsored Content
Full Discussion: Shell Script And SQLPLUS
Top Forums UNIX for Dummies Questions & Answers Shell Script And SQLPLUS Post 302133761 by robotronic on Saturday 25th of August 2007 10:10:20 AM
Old 08-25-2007
Quote:
Originally Posted by radoulov
It's because those are errors with SQL*Plus commands and not SQL commands,PL/SQL blocks (SQLERROR) or OS (OSERROR) errors.
For this reason, I suggest you exiting with a good return status different from 0, and test this value for successful completion of the sql script.
Every exit status is good, only dont' use 0 Smilie

Here at work we have a whole bunch of sql programs made in this way for avoiding this problem.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

passing parameters from a shell script to sqlplus

Hi , I want to pass parameters from a shell script to a sql script and use the parameter in the sql query ..and then I want to spool a particular select query on to my unix box... for 4 different locations by writing only one sql script Right now no file is generated on the unix box...it is a... (2 Replies)
Discussion started by: phani
2 Replies

2. Shell Programming and Scripting

running shell script from sqlplus

I have a script which connects to different database servers using sqlplus. Is there a way by which I can run a shell command on that host from sqlplus? I know about 'host' command but it runs script on the local machine where the original script is running. Is there a way to run command on the... (9 Replies)
Discussion started by: dkr123
9 Replies

3. Shell Programming and Scripting

help me in sending parameters from sqlplus script to unix shell script

Can anybody help me out in sending parameters from sql*plus script to unix shell script without using flat files.. Initially in a shell script i will call sql*plus and after getting some value from some tables, i want that variable value in unix shell script. How can i do this? Please tell me... (2 Replies)
Discussion started by: Hara
2 Replies

4. Shell Programming and Scripting

Call sqlplus in the shell script

Hi, I am writing a script to test database connection. If the first try fails, it will wait for 1 minutes and then try again. The script is as following: ........ for i in $ORACLE_SID do $ORACLE_HOME/bin/sqlplus $username/$password@$i <<! >/dev/null select * from tab; exit if ; then... (3 Replies)
Discussion started by: beaniebear
3 Replies

5. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

6. Shell Programming and Scripting

SQLPLUS within shell script

Hi I want to connect to the Oracle database using a username/password and get back the query result(a numeric value) in a variable, which I can then compare using a conditional. Can anybody help me with this. Thanks Gaurav (4 Replies)
Discussion started by: gaurav_1711
4 Replies

7. Shell Programming and Scripting

Want to learn/use SQLPLUS in shell script

Hi All, How i will use sqlplus in shell script? Can any one provide sample code which explain following: 1. Connect to oracle DB 2. Exceute select * from tablename 3. Release connection to the DB 4. Append output in file everytime when query executes. Thanks in advance (1 Reply)
Discussion started by: poweroflinux
1 Replies

8. Shell Programming and Scripting

SQLplus and Shell script problem

sql_rows=`sqlplus -s / <<EOF set heading off set pagesize 1000 set tab off set linesize 120 wrap off column "Path" format a15 --column "No_Of_files" format a10 select tablespace_name, substr(file_name,1,instr(file_name,'/',1,2)) as "Path" , count(*) as "No_Of_files" from dba_data_files ... (7 Replies)
Discussion started by: desibabu
7 Replies

9. Shell Programming and Scripting

sqlplus in shell script

Hi When I use sqlplus in shell script, I get sqlplus: command not found. ORACLE_HOME is not set. How to set ORACLE_HOME in unix? Thanks (3 Replies)
Discussion started by: vinoth_kumar
3 Replies

10. Shell Programming and Scripting

Sqlplus in shell script

Hi All, Please let me know what i am missing in the following code (part of my script) Schemas=(AWQM WFCONTROLLER PROVCO PRISM) for s in "${Schemas}" do sch="${s}_$tol" if || ;then echo "This is AD or TD region" sqlplus -s $sch/$tpwd@$ttns <<EOF... (7 Replies)
Discussion started by: pvmanikandan
7 Replies
SQL::Abstract::Test(3pm)				User Contributed Perl Documentation				  SQL::Abstract::Test(3pm)

NAME
SQL::Abstract::Test - Helper function for testing SQL::Abstract SYNOPSIS
use SQL::Abstract; use Test::More; use SQL::Abstract::Test import => [qw/ is_same_sql_bind is_same_sql is_same_bind eq_sql_bind eq_sql eq_bind /]; my ($sql, @bind) = SQL::Abstract->new->select(%args); is_same_sql_bind($given_sql, @given_bind, $expected_sql, @expected_bind, $test_msg); is_same_sql($given_sql, $expected_sql, $test_msg); is_same_bind(@given_bind, @expected_bind, $test_msg); my $is_same = eq_sql_bind($given_sql, @given_bind, $expected_sql, @expected_bind); my $sql_same = eq_sql($given_sql, $expected_sql); my $bind_same = eq_bind(@given_bind, @expected_bind); DESCRIPTION
This module is only intended for authors of tests on SQL::Abstract and related modules; it exports functions for comparing two SQL statements and their bound values. The SQL comparison is performed on abstract syntax, ignoring differences in spaces or in levels of parentheses. Therefore the tests will pass as long as the semantics is preserved, even if the surface syntax has changed. Disclaimer : the semantic equivalence handling is pretty limited. A lot of effort goes into distinguishing significant from non- significant parenthesis, including AND/OR operator associativity. Currently this module does not support commutativity and more intelligent transformations like Morgan laws, etc. For a good overview of what this test framework is capable of refer to "t/10test.t" FUNCTIONS
is_same_sql_bind is_same_sql_bind($given_sql, @given_bind, $expected_sql, @expected_bind, $test_msg); Compares given and expected pairs of "($sql, @bind)", and calls "ok" in Test::Builder on the result, with $test_msg as message. If the test fails, a detailed diagnostic is printed. For clients which use Test::More, this is the one of the three functions ("is_same_sql_bind", "is_same_sql", "is_same_bind") that needs to be imported. is_same_sql is_same_sql($given_sql, $expected_sql, $test_msg); Compares given and expected SQL statements, and calls "ok" in Test::Builder on the result, with $test_msg as message. If the test fails, a detailed diagnostic is printed. For clients which use Test::More, this is the one of the three functions ("is_same_sql_bind", "is_same_sql", "is_same_bind") that needs to be imported. is_same_bind is_same_bind(@given_bind, @expected_bind, $test_msg); Compares given and expected bind values, and calls "ok" in Test::Builder on the result, with $test_msg as message. If the test fails, a detailed diagnostic is printed. For clients which use Test::More, this is the one of the three functions ("is_same_sql_bind", "is_same_sql", "is_same_bind") that needs to be imported. eq_sql_bind my $is_same = eq_sql_bind($given_sql, @given_bind, $expected_sql, @expected_bind); Compares given and expected pairs of "($sql, @bind)". Similar to "is_same_sql_bind", but it just returns a boolean value and does not print diagnostics or talk to Test::Builder. eq_sql my $is_same = eq_sql($given_sql, $expected_sql); Compares the abstract syntax of two SQL statements. Similar to "is_same_sql", but it just returns a boolean value and does not print diagnostics or talk to Test::Builder. If the result is false, the global variable "$sql_differ" will contain the SQL portion where a difference was encountered; this is useful for printing diagnostics. eq_bind my $is_same = eq_sql(@given_bind, @expected_bind); Compares two lists of bind values, taking into account the fact that some of the values may be arrayrefs (see "bindtype" in SQL::Abstract). Similar to "is_same_bind", but it just returns a boolean value and does not print diagnostics or talk to Test::Builder. GLOBAL VARIABLES
$case_sensitive If true, SQL comparisons will be case-sensitive. Default is false; $parenthesis_significant If true, SQL comparison will preserve and report difference in nested parenthesis. Useful while testing "IN (( x ))" vs "IN ( x )". Defaults to false; $sql_differ When "eq_sql" returns false, the global variable $sql_differ contains the SQL portion where a difference was encountered. SEE ALSO
SQL::Abstract, Test::More, Test::Builder. AUTHORS
Laurent Dami, <laurent.dami AT etat geneve ch> Norbert Buchmuller <norbi@nix.hu> Peter Rabbitson <ribasushi@cpan.org> COPYRIGHT AND LICENSE
Copyright 2008 by Laurent Dami. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-12-21 SQL::Abstract::Test(3pm)
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy