01-08-2009
Calling unix script from sql or plsql
Hi
Can anyone please let me know how to call unix scripts from sql or plsql ASAP.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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. UNIX for Dummies Questions & Answers
Hi, I need help again. When I run this shell script, it only runs the unld_date.sql piece and exits. How can I structure this to run all the way to the end? When I don't have the unld_date.sql piece in here, everything runs fine from the date compare piece all the way to the end. Thanks in... (5 Replies)
Discussion started by: siog
5 Replies
3. UNIX for Advanced & Expert Users
Could anyone please help me. I have a function in plsql that returns a number. But i am listing some records through that function using DBMS_OUTPUT.PUT_LINE. I want to catch those records by executing this function through a unix script. The following shows what i did
echo "Connected from... (2 Replies)
Discussion started by: cobroraj
2 Replies
4. Shell Programming and Scripting
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
5. Programming
Hi All,
I am supposed to present the documentation for the PLSQL code (PACKAGES, PROCEDURE, FUNCTIONS) of my application. There are sufficient comments in my code. Has anyone written any Shell Script Utility which can parse the PLSQL code and generate some kind of document ( preferrably HTML not... (1 Reply)
Discussion started by: gauravsachan
1 Replies
6. Shell Programming and Scripting
Hi
This is my bash script.i am calling validation.sql and passing a value to it using ${flds}.
i want the cnt variable in plsql script to be passed to unix.
LOADREC=`sqlplus -s $ORACLE_USR <<-EOF
spool $ORACLE_LOG_FILE;
echo "barani"
@validation.sql #calling the plsql script
${flds}... (6 Replies)
Discussion started by: barani75
6 Replies
7. Shell Programming and Scripting
Hi,
I want to call a sql file in my shell script. see the below code:-
if ]
then
(
isql -U${S_USER} -S${S_SERV} -w100 -b -h0 <<ENDSQL | sed -e "s/Password://"
${S_PWD}
set nocount on
go
use ${S_DB}
go
// need to call a file name... (16 Replies)
Discussion started by: dazdseg
16 Replies
8. Shell Programming and Scripting
I have a plsql procedure inside a package which is having one IN parameter .I want to call that procedure through a shell script and that IN parameter is a column of a table in the database. So my requirement is that i need to loop all the entries of that IN parameter from the table through shell... (4 Replies)
Discussion started by: rspnf
4 Replies
9. UNIX for Dummies Questions & Answers
Hello Experts,
I have the following questions to be discussed here at this esteemed discussion forum.
I have two Excel sheets which contain Unix Commands llike creating directory the structure/ftp/Copy/Zip etc to basically create an environment. I need help in understanding some of... (1 Reply)
Discussion started by: faizsaadq
1 Replies
10. Shell Programming and Scripting
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
LEARN ABOUT PHP
db2_fetch_row
DB2_FETCH_ROW(3) 1 DB2_FETCH_ROW(3)
db2_fetch_row - Sets the result set pointer to the next row or requested row
SYNOPSIS
bool db2_fetch_row (resource $stmt, [int $row_number])
DESCRIPTION
Use db2_fetch_row(3) to iterate through a result set, or to point to a specific row in a result set if you requested a scrollable cursor.
To retrieve individual fields from the result set, call the db2_result(3) function.
Rather than calling db2_fetch_row(3) and db2_result(3), most applications will call one of db2_fetch_assoc(3), db2_fetch_both(3), or
db2_fetch_array(3) to advance the result set pointer and return a complete row as an array.
PARAMETERS
o $stmt
- A valid stmt resource.
o $row_number
- With scrollable cursors, you can request a specific row number in the result set. Row numbering is 1-indexed.
RETURN VALUES
Returns TRUE if the requested row exists in the result set. Returns FALSE if the requested row does not exist in the result set.
EXAMPLES
Example #1
Iterating through a result set
The following example demonstrates how to iterate through a result set with db2_fetch_row(3) and retrieve columns from the result
set with db2_result(3).
<?php
$sql = 'SELECT name, breed FROM animals WHERE weight < ?';
$stmt = db2_prepare($conn, $sql);
db2_execute($stmt, array(10));
while (db2_fetch_row($stmt)) {
$name = db2_result($stmt, 0);
$breed = db2_result($stmt, 1);
print "$name $breed";
}
?>
The above example will output:
cat Pook
gold fish Bubbles
budgerigar Gizmo
goat Rickety Ride
Example #2
i5/OS recommended alternatives to db2_fetch_row/db2_result
On i5/OS it is recommended that you use db2_fetch_both(3), db2_fetch_array(3), or db2_fetch_object(3) over
db2_fetch_row(3)/db2_result(3). In general db2_fetch_row(3)/db2_result(3) have more issues with various column types in EBCIDIC to
ASCII translation, including possible truncation in DBCS applications. You may also find the performance of db2_fetch_both(3),
db2_fetch_array(3), and db2_fetch_object(3) to be superior to db2_fetch_row(3)/db2_result(3).
<?php
$conn = db2_connect("","","");
$sql = 'SELECT SPECIFIC_SCHEMA, SPECIFIC_NAME, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE, ROUTINE_CREATED, ROUTINE_BODY, IN_PARMS, OUT_PARMS, INOUT_PARMS, PARAMETER_STYLE, EXTERNAL_NAME, EXTERNAL_LANGUAGE FROM QSYS2.SYSROUTINES FETCH FIRST 2 ROWS ONLY';
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_both($stmt)){
echo "<br>db2_fetch_both {$row['SPECIFIC_NAME']} {$row['ROUTINE_CREATED']} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_array($stmt)){
echo "<br>db2_fetch_array {$row[1]} {$row[5]}";
}
$stmt = db2_exec($conn, $sql, array('cursor' => DB2_SCROLLABLE));
while ($row = db2_fetch_object($stmt)){
echo "<br>db2_fetch_object {$row->SPECIFIC_NAME} {$row->ROUTINE_CREATED}";
}
db2_close($conn);
?>
The above example will output:
db2_fetch_both MATCH_ANIMAL 2006-08-25-17.10.23.775000 2006-08-25-17.10.23.775000
db2_fetch_both MULTIRESULTS 2006-10-17-10.11.05.308000 2006-10-17-10.11.05.308000
db2_fetch_array MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_array MULTIRESULTS 2006-10-17-10.11.05.308000
db2_fetch_object MATCH_ANIMAL 2006-08-25-17.10.23.775000
db2_fetch_object MULTIRESULTS 2006-10-17-10.11.05.308000
SEE ALSO
db2_fetch_array(3), db2_fetch_assoc(3), db2_fetch_both(3), db2_fetch_object(3), db2_result(3).
PHP Documentation Group DB2_FETCH_ROW(3)