Sponsored Content
Top Forums Shell Programming and Scripting any possible solution on sql calling scripts Post 302146733 by manas_ranjan on Thursday 22nd of November 2007 04:01:16 AM
Old 11-22-2007
Hammer & Screwdriver

thankx Cameron.

I have gone thru the all the search...but not reffered anyone......as any of them not met my requirements
since i post it with confusing statements...sorry for that.

actually i should ask, even though whenever sqlerror exit SQL.SQLCODE is there why i am not able to catch that SQL.SQLCODE after executing the function ???? why rc is showing 0 as we all know i am executing wrong ddl(s) , why not SQL.SQLCODE as rc ????? i will be thankful if you can explain me....

NOTE : i have not used any spool file, o/p logging file..rather than i checked the ERROR/output by passing the o/p to v_cnt as follows,

HTML Code:
if [ `echo "$v_cnt" | grep "ORA-" | wc -l` -ne 0 ]
then
echo "`basename $0` wrong execution possible reason is :-`echo "$v_cnt" | grep "ORA-" | awk -F":" '{print $2}'`"
exit 1
fi
again sorry for misleading/confusing statements......next time i will try to take care of this.

Last edited by manas_ranjan; 11-22-2007 at 05:08 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling SQL scripts through Shell Script

Oracle and Scripting gurus, I need some help with this script... I am trying to add the query SELECT * FROM ALL_SYNONYMS WHERE SYNONYM_NAME = 'METADATA' in the current script.... Read the result set and look for the TABLE_NAME field. If the field is pointing to one table eg.... (18 Replies)
Discussion started by: madhunk
18 Replies

2. Shell Programming and Scripting

Calling SQL LDR and SQL plus scripts in a shell script

Hi- I am trying to achieve the following in a script so I can schedule it on a cron job. I am fairly new to the unix environment... I have written a shell script that reads a flat file and loads the data into an Oracle table (Table1) via SQLLDR. This Works fine. Then, I run a nested insert... (5 Replies)
Discussion started by: rajagavini
5 Replies

3. Shell Programming and Scripting

calling .sql in .sh file

Hi All , I have created .sql script in unix.this script contains 4 sql queries. Now I want to craete .sh file based on .sql script. So please let me know the steps to craete .sh file Thank you. (1 Reply)
Discussion started by: user71408
1 Replies

4. Shell Programming and Scripting

Difference between calling the sub scripts

What is the difference between calling the sub scripts of below two line. /home/scripts/devdb.sh . /home/scripts/devdb.sh sh /home/scripts/devdb.sh We are using the suse 2.0 version (4 Replies)
Discussion started by: kingganesh04
4 Replies

5. Shell Programming and Scripting

Calling scripts within script

Hi, I have written a some six scripts to move large files and re-size them. This has been done step by step, taking backup, creating the new files, merging the files, removing the temporary files created. Since these files are around 500 MB, each step takes somewhere between 1 to 5 mins. ... (1 Reply)
Discussion started by: baanprog
1 Replies

6. Shell Programming and Scripting

Calling scripts from other script.

I need to call 3 different shell scripts from 2 different scripts, one is a perl script and other is Shell script. In Case -1 : The perl script is myperlscript.pl and the name of three shell scripts which need to be called from the perl script are a1.sh, a2.sh and a3.sh. Each shell script... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

7. Shell Programming and Scripting

Execute multiple SQL scripts from single SQL Plus connection

Hi! I would like to do a single connection to sqlplus and execute some querys. Actually I do for every query one connection to database i.e echo 'select STATUS from v$instance; exit' > $SQL_FILE sqlplus user/pass@sid @$SQL_FILE > $SELECT_RESULT echo 'select VERSION from v$instance;... (6 Replies)
Discussion started by: guif
6 Replies

8. UNIX for Advanced & Expert Users

Call parallel sql scripts from shell and return status when both sql are done

Hi Experts: I have a shell script that's kicked off by cron. Inside this shell script, I need to kick off two or more oracle sql scripts to process different groups of tables. And when both sql scripts are done, I will continue in the shell script to do other things like checking processing... (3 Replies)
Discussion started by: huasheng8
3 Replies

9. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

10. Shell Programming and Scripting

UNIX Solution - Calling SQL*Plus scripts

I have a requirement of bash shell script calling SQL*Plus script. Shell Script sqlplus <user>/<pwd> @sqlscript1 parameters sqlplus <user>/<pwd> @sqlscript2 parameters Now I need the values generated by sqlscript1 in sqlscript2. But it is more like a huge dataset in a table and not one... (7 Replies)
Discussion started by: uuuunnnn
7 Replies
PG_QUERY(3)															       PG_QUERY(3)

pg_query - Execute a query

SYNOPSIS
resource pg_query ([resource $connection], string $query) DESCRIPTION
pg_query(3) executes the $query on the specified database $connection. pg_query_params(3) should be preferred in most cases. If an error occurs, and FALSE is returned, details of the error can be retrieved using the pg_last_error(3) function if the connection is valid. Note Although $connection can be omitted, it is not recommended, since it can be the cause of hard to find bugs in scripts. Note This function used to be called pg_exec(3). pg_exec(3) is still available for compatibility reasons, but users are encouraged to use the newer name. PARAMETERS
o $connection - PostgreSQL database connection resource. When $connection is not present, the default connection is used. The default connection is the last connection made by pg_connect(3) or pg_pconnect(3). o $query - The SQL statement or statements to be executed. When multiple statements are passed to the function, they are automatically exe- cuted as one transaction, unless there are explicit BEGIN/COMMIT commands included in the query string. However, using multiple transactions in one function call is not recommended. Warning String interpolation of user-supplied data is extremely dangerous and is likely to lead to SQL injection vulnerabilities. In most cases pg_query_params(3) should be preferred, passing user-supplied values as parameters rather than substituting them into the query string. Any user-supplied data substituted directly into a query string should be properly escaped. RETURN VALUES
A query result resource on success or FALSE on failure. EXAMPLES
Example #1 pg_query(3) example <?php $conn = pg_pconnect("dbname=publisher"); if (!$conn) { echo "An error occurred. "; exit; } $result = pg_query($conn, "SELECT author, email FROM authors"); if (!$result) { echo "An error occurred. "; exit; } while ($row = pg_fetch_row($result)) { echo "Author: $row[0] E-mail: $row[1]"; echo "<br /> "; } ?> Example #2 Using pg_query(3) with multiple statements <?php $conn = pg_pconnect("dbname=publisher"); // these statements will be executed as one transaction $query = "UPDATE authors SET author=UPPER(author) WHERE id=1;"; $query .= "UPDATE authors SET author=LOWER(author) WHERE id=2;"; $query .= "UPDATE authors SET author=NULL WHERE id=3;"; pg_query($conn, $query); ?> SEE ALSO
pg_connect(3), pg_pconnect(3), pg_fetch_array(3), pg_fetch_object(3), pg_num_rows(3), pg_affected_rows(3). PHP Documentation Group PG_QUERY(3)
All times are GMT -4. The time now is 04:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy