I want to pass a variable to a script which will execute a a sql script to read a table that contains env. variables. I want to read and then somehow export at unix level variables
example
for every row selected from the table build export command line
field1 := 'export SHELL = /app/pasf/sqr; ';
I some how need to get these back to unix korn script so I can create the variable at the unix level. It will be valid only while the session is open.
Not sure the best way to do this.
So far I created a the following(its just a start):
output is
EXPORT PARMS= /unixsxxx/apps/psf/zzz/CCC/
EXPORT SHELL= /unixsxxx/apps/psf/zzz/CCC/
EXPORT SQL= /unixsxxx/apps/psf/zzz/CCCC/
EXPORT SQR= /unixsxx/apps/psf/zzz/
Last edited by TimHortons; 04-14-2009 at 08:50 AM..
Reason: code tag added
Hi All,
I am executing the following code :-
sqlplus -s ${DATABASE_USER} |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on size 1000000'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from... (2 Replies)
Hi all,
Iam facing a lot of problem while calling Oracle 10g SQLPLUS files from shell.
What is the standard procedures to be taken care.
Any help would be useful for me.
Thanks in advance,
Ganapati. (2 Replies)
i'm not new to programming, but i AM new to unix scripting. here's my deal.
this works:
#!/bin/ksh
echo "HELLO"
/oracle_home/bin/sqlplus username/password@MYDB<<EOF
SELECT COUNT(*) FROM EMPLOYEES;
EOF
exit
echo "GOODBYE"
this doesn't:
#!/bin/ksh
echo "HELLO"
for x in 1 2... (4 Replies)
Hi,
I want to use sqlplus from server1
sqlplus usr1/pass1@dns1
and I want to connect to an Oracle database from a server2.
Unfortunately the database was created on the server1 and on server2.
So when I use the command just like that...it connects to the database from the server2. ... (2 Replies)
Hi,
I am facing the following error in calling the stored procedure from SQLPLUS in unix environment.
SQL> set serveroutput on
SQL> var store number;
SQL> exec test_proc(:store, 200);
BEGIN TEST_PROC(:store, 200); END;
*
ERROR at line 1:
ORA-01858: a non-numeric character was found... (8 Replies)
I want to execute a shell script from sqlplus prompt and get its output back to sqlplus. Is this possible?
if yes just give me an example for doing that. (2 Replies)
Hi,
I am facing an issue wherein some temporary files (here docs) are getting created in /tmp and are not getting deleted automatically.
When i check the list of open files with below command i can see one file is getting appended continuously.(In this case /tmp/sfe7h.34p)
The output is... (4 Replies)
I want to truncate a table using sqlplus where the table name is in shell variable:
I am using :
sqlplus -s / <<end
truncate table $TABLE
end (2 Replies)
Hi All,
we have requirement, i am created a shell script , inside i am connecting sqlplus and execute the query. below my code for your reference.
get_sqlid ()
{
sqlid=$(
sqlplus -s $PBDW_USERID/$PBDW_PW@$PBDW_SID <<EOF
DEFINE TBLNAME=$1
set feedback off
set serverout on size... (4 Replies)
Hello All,
Could you please help me if i am doing anything wrong in below script, especially the sqlplus part performance wise or anything else i could improvise in the script. Thank you.
#!/bin/ksh
## Batch Obj Id
MP_BCH_OBJ_ID=$1
PASS=$2
partition=$3
## script dir... (6 Replies)
Discussion started by: Ariean
6 Replies
LEARN ABOUT PHP
oci_fetch_object
OCI_FETCH_OBJECT(3)OCI_FETCH_OBJECT(3)oci_fetch_object - Returns the next row from a query as an objectSYNOPSIS
object oci_fetch_object (resource $statement)
DESCRIPTION
Returns an object containing the next result-set row of a query. Each attribute of the object corresponds to a column of the row. This
function is typically called in a loop until it returns FALSE, indicating no more rows exist.
For details on the data type mapping performed by the OCI8 extension, see the datatypes supported by the driver
PARAMETERS
o $statement
-A valid OCI8 statement identifier created by oci_parse(3) and executed by oci_execute(3), or a REF CURSOR statement identifier.
RETURN VALUES
Returns an object. Each attribute of the object corresponds to a column of the row. If there are no more rows in the $statement then FALSE
is returned.
Any LOB columns are returned as LOB descriptors.
DATE columns are returned as strings formatted to the current date format. The default format can be changed with Oracle environment vari-
ables such as NLS_LANG or by a previously executed ALTER SESSION SET NLS_DATE_FORMAT command.
Oracle's default, non-case sensitive column names will have uppercase attribute names. Case-sensitive column names will have attribute
names using the exact column case. Use var_dump(3) on the result object to verify the appropriate case for attribute access.
Attribute values will be NULL for any NULL data fields.
EXAMPLES
Example #1
oci_fetch_object(3) example
<?php
/*
Before running, create the table:
CREATE TABLE mytab (id NUMBER, description VARCHAR2(30));
INSERT INTO mytab (id, description) values (1, 'Fish and Chips');
COMMIT;
*/
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT id, description FROM mytab');
oci_execute($stid);
while (($row = oci_fetch_object($stid)) != false) {
// Use upper case attribute names for each standard Oracle column
echo $row->ID . "<br>
";
echo $row->DESCRIPTION . "<br>
";
}
// Output is:
// 1
// Fish and Chips
oci_free_statement($stid);
oci_close($conn);
?>
Example #2
oci_fetch_object(3) with case sensitive column names
<?php
/*
Before running, create the table with a case sensitive column name:
CREATE TABLE mytab (id NUMBER, "MyDescription" VARCHAR2(30));
INSERT INTO mytab (id, "MyDescription") values (1, 'Iced Coffee');
COMMIT;
*/
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT id, "MyDescription" FROM mytab');
oci_execute($stid);
while (($row = oci_fetch_object($stid)) != false) {
// Use upper case attribute names for each standard Oracle column
echo $row->ID . "<br>
";
// Use the exact case for the case sensitive column name
echo $row->MyDescription . "<br>
";
}
// Output is:
// 1
// Iced Coffee
oci_free_statement($stid);
oci_close($conn);
?>
Example #3
oci_fetch_object(3) with LOBs
<?php
/*
Before running, create the table:
CREATE TABLE mytab (id NUMBER, description CLOB);
INSERT INTO mytab (id, description) values (1, 'A very long string');
COMMIT;
*/
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT id, description FROM mytab');
oci_execute($stid);
while (($row = oci_fetch_object($stid)) != false) {
echo $row->ID . "<br>
";
// The following will output the first 11 bytes from DESCRIPTION
echo $row->DESCRIPTION->read(11) . "<br>
";
}
// Output is:
// 1
// A very long
oci_free_statement($stid);
oci_close($conn);
?>
SEE ALSO oci_fetch(3), oci_fetch_all(3), oci_fetch_assoc(3), oci_fetch_array(3), oci_fetch_row(3).
PHP Documentation Group OCI_FETCH_OBJECT(3)