08-21-2008
How to pass pl/sql table values to shell script
Hello,
i am using '#!/bin/bash', i want to make a loop in pl/sql, this loop takes values from a table according to some conditions, each time the loop choose 3 different variables. What i am not able to do is that during the loop i want my shell script to read this 3 variables and run a shell script.
Here is a clarification:
My pl/sql is:
-----------------------------------------------------------------------
DECLARE
gn_bossid NUMBER(38);
gn_bossaccountid NUMBER(38);
gn_bossaddress NUMBER(38);
gn_voip_directoraddress NUMBER(38);
value1 NUMBER(38);
value2 NUMBER(38);
value3 NUMBER(38);
BEGIN
FOR voip_cparty IN (SELECT V.boss_id, V.bossaccount_id, V.bossaddress
INTO gn_bossid, gn_bossaccountid, gn_bossaddress
FROM Tbossesdata V
WHERE STATE IN ('A')
)
LOOP
BEGIN
value1 := gn_bossid;
value2 := gn_bossaccountid;
value3 := gn_bossaddress;
(1- here i want the shell to read this values
2- Call this same script to perform some other actions according to this values)
END;
END LOOP;
END;
---------------------------------------------------------------------------------------------------
I want the values value1, value2, and value3 to be readen by a shell script inside the loop where the loop is searching and calling the script to run.
what commands should be written in pl/sql and shell to perform this?
I appreciate your kind help.
Thanks!
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
how to pass values from oracle sql plus to unix shell script (2 Replies)
Discussion started by: trichyselva
2 Replies
2. Shell Programming and Scripting
only the arguments that are written to the file,
my script is (sh /u01app/wkf.sh"$start_no","$name","$Condition","$file_name") like that
when ever I run my script I need to write into a new file every time,
like wise I have upto10 files with different names.bec my $start_no and $name will... (1 Reply)
Discussion started by: sai123
1 Replies
3. Shell Programming and Scripting
Hi,
I am using SYBASE database. in my script i am connecting to DB via using isql.
isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL
i am taking a ABC.sql file to use the queries written in it and storing the output in... (3 Replies)
Discussion started by: dazdseg
3 Replies
4. Shell Programming and Scripting
hi,
Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable...
Thanks in advance... (5 Replies)
Discussion started by: funonnet
5 Replies
5. Shell Programming and Scripting
i have a Oracle table like
col1 col2
---- -----
a 1
b 2
c 3
when i write a script for it , it gives me all the data in one column.
Please give me the solution which gives the exact result like we see in sql editors.
for a in `echo "
set feedback off;
set pagesize 40;... (1 Reply)
Discussion started by: ss135r
1 Replies
6. Shell Programming and Scripting
Hi,
is it possible to pass more values from web form like textbox to shell script and if yes,how to do that.:confused::confused::confused: (2 Replies)
Discussion started by: tdev457
2 Replies
7. Shell Programming and Scripting
There are 4 parameters that I have to pass from korn shell to sql script.
1) I have to check if $1 , $2 , $3 and $4 are null values or not .
How can I do that ?
2) Once its determined that these values are null (in the sense they are empty) how can I pass null values to sql script... (11 Replies)
Discussion started by: megha2525
11 Replies
8. Shell Programming and Scripting
Hi,
I need a shell script, which would search the result values from another files.
1)execute " select column1 from table_name" query on the table.
2)Based on the result, need to be grep from .wft files.
could please explain about this.Below is the way i am using.
#!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies
9. Shell Programming and Scripting
Hi all,
$ echo $SHELL
/bin/bash
Requirement - How to pass oracle sql script as argument to unix shell script?
$ ./output.sh users.sql
Below are the shell scripts and the oracle sql file in the same folder.
Shell Script
$ cat output.sh
#!/bin/bash
.... (7 Replies)
Discussion started by: a1_win
7 Replies
10. Shell Programming and Scripting
Hi All,
I am new to shell script. I am trying to pass value from .sh file to .sql file .
But I am able to run the .sql file from .sh file with values in sql file.
But I am unable to pass the values from .sh file. can some one please help to resolve this.
here is my .sh file
s1.sh
... (4 Replies)
Discussion started by: reddy298599
4 Replies
LEARN ABOUT PHP
oci_field_scale
OCI_FIELD_SCALE(3) OCI_FIELD_SCALE(3)
oci_field_scale - Tell the scale of the field
SYNOPSIS
int oci_field_scale (resource $statement, mixed $field)
DESCRIPTION
Returns the scale of the column with $field index.
For FLOAT columns, precision is nonzero and scale is -127. If precision is 0, then column is NUMBER. Else it's NUMBER(precision, scale).
PARAMETERS
o $statement
- A valid OCI statement identifier.
o $field
- Can be the field's index (1-based) or name.
RETURN VALUES
Returns the scale as an integer, or FALSE on errors.
EXAMPLES
Example #1
oci_field_scale(3) Example
<?php
// Create the table with:
// CREATE TABLE mytab (c1 NUMBER, c2 FLOAT, c3 NUMBER(4), c4 NUMBER(5,3));
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
if (!$conn) {
$m = oci_error();
trigger_error(htmlentities($m['message']), E_USER_ERROR);
}
$stid = oci_parse($conn, "SELECT * FROM mytab");
oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows
$ncols = oci_num_fields($stid);
for ($i = 1; $i <= $ncols; $i++) {
echo oci_field_name($stid, $i) . " "
. oci_field_precision($stid, $i) . " "
. oci_field_scale($stid, $i) . "<br>
";
}
// Outputs:
// C1 0 -127
// C2 126 -127
// C3 4 0
// C4 5 3
oci_free_statement($stid);
oci_close($conn);
?>
NOTES
Note
In PHP versions before 5.0.0 you must use ocicolumnscale(3) instead. This name still can be used, it was left as alias of
oci_field_scale(3) for downwards compatability. This, however, is deprecated and not recommended.
SEE ALSO
oci_field_precision(3), oci_field_type(3).
PHP Documentation Group OCI_FIELD_SCALE(3)