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_bind_array_by_name
OCI_BIND_ARRAY_BY_NAME(3)OCI_BIND_ARRAY_BY_NAME(3)oci_bind_array_by_name - Binds a PHP array to an Oracle PL/SQL array parameter
SYNOPSIS
bool oci_bind_array_by_name (resource $statement, string $name, array &$var_array, int $max_table_length, [int $max_item_length = -1],
[int $type = SQLT_AFC])
DESCRIPTION
Binds the PHP array $var_array to the Oracle placeholder $name, which points to an Oracle PL/SQL array. Whether it will be used for input
or output will be determined at run-time.
PARAMETERS
o $statement
- A valid OCI statement identifier.
o $name
- The Oracle placeholder.
o $var_array
- An array.
o $max_table_length
- Sets the maximum length both for incoming and result arrays.
o $max_item_length
- Sets maximum length for array items. If not specified or equals to -1, oci_bind_array_by_name(3) will find the longest element
in the incoming array and will use it as the maximum length.
o $type
- Should be used to set the type of PL/SQL array items. See list of available types below:
o SQLT_NUM - for arrays of NUMBER.
o SQLT_INT - for arrays of INTEGER (Note: INTEGER it is actually a synonym for NUMBER(38), but SQLT_NUM type won't work in
this case even though they are synonyms).
o SQLT_FLT - for arrays of FLOAT.
o SQLT_AFC - for arrays of CHAR.
o SQLT_CHR - for arrays of VARCHAR2.
o SQLT_VCS - for arrays of VARCHAR.
o SQLT_AVC - for arrays of CHARZ.
o SQLT_STR - for arrays of STRING.
o SQLT_LVC - for arrays of LONG VARCHAR.
o SQLT_ODT - for arrays of DATE.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
oci_bind_array_by_name(3) example
<?php
$conn = oci_connect("hr", "hrpwd", "localhost/XE");
if (!$conn) {
$m = oci_error();
trigger_error(htmlentities($m['message']), E_USER_ERROR);
}
$create = "CREATE TABLE bind_example(name VARCHAR(20))";
$stid = oci_parse($conn, $create);
oci_execute($stid);
$create_pkg = "
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
PROCEDURE iobind(c1 IN OUT ARRTYPE);
END ARRAYBINDPKG1;";
$stid = oci_parse($conn, $create_pkg);
oci_execute($stid);
$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
CURSOR CUR IS SELECT name FROM bind_example;
PROCEDURE iobind(c1 IN OUT ARRTYPE) IS
BEGIN
-- Bulk Insert
FORALL i IN INDICES OF c1
INSERT INTO bind_example VALUES (c1(i));
-- Fetch and reverse
IF NOT CUR%ISOPEN THEN
OPEN CUR;
END IF;
FOR i IN REVERSE 1..5 LOOP
FETCH CUR INTO c1(i);
IF CUR%NOTFOUND THEN
CLOSE CUR;
EXIT;
END IF;
END LOOP;
END iobind;
END ARRAYBINDPKG1;";
$stid = oci_parse($conn, $create_pkg_body);
oci_execute($stid);
$stid = oci_parse($conn, "BEGIN arraybindpkg1.iobind(:c1); END;");
$array = array("one", "two", "three", "four", "five");
oci_bind_array_by_name($stid, ":c1", $array, 5, -1, SQLT_CHR);
oci_execute($stid);
var_dump($array);
?>
PHP Documentation Group OCI_BIND_ARRAY_BY_NAME(3)