Sponsored Content
Top Forums UNIX for Advanced & Expert Users Unable to export delimiter as variable to SQL Post 302514272 by sumoka on Friday 15th of April 2011 10:05:56 AM
Old 04-15-2011
Even in my case, the above code works.. my problem is, when I call it in the SQL using `echo $delm` it prints "\t" Smilie has anybody tried it calling in an sql ?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

2. Shell Programming and Scripting

Export Variable

How to export variable from one script to other? Can anybody give me syntax for that? Thanks (2 Replies)
Discussion started by: navi
2 Replies

3. Shell Programming and Scripting

Export SQL results to .TXT file for emailing

Hi everyone, I am new to unix and bash and in need of some help. I am writing a script that will execute a SQL query. The script runs and the SQl query runs, but I cannot figure out how to save the results as a file that can be emailed to a user. Here is my scripts thus far: #!/bin/sh SID=$1... (2 Replies)
Discussion started by: alpinescott
2 Replies

4. Shell Programming and Scripting

Unable to export Directory paths through Script

Following is the output of .profile file - $ cat /home/estdm2/.profile #!/bin/ksh set -o vi alias l="ls -ltr" umask 002 Following is the path setting script. $ cat DM_ENV_VARS_NEW.ksh #!/bin/ksh . /home/estdm2/.profile sEnv=$1 echo "We are in ${sEnv} environment" echo "STEP010... (3 Replies)
Discussion started by: sumeet
3 Replies

5. Shell Programming and Scripting

Export variable

Hi I have a pass a variable from one script to another. Here are my scripts Script #1 ./profile #!/bin/sh export NAME="Hello" Script #2 ./test #!/bin/sh ./profile echo $NAME when I run ./test .. i am not getting anything .. why is that? (5 Replies)
Discussion started by: arex876
5 Replies

6. Shell Programming and Scripting

where does variable export to?

Hi, Unix Gurus, I have a problem need help. I have a script to generate environment variable code same as following: oracle_sid=abcd export oracle_sid when I execute this code with command ./script_nane it succeeded. when I try to find it with env command or echo $oracle_sid, it does not show... (5 Replies)
Discussion started by: ken002
5 Replies

7. Shell Programming and Scripting

Can't export variable

I am relatively new to exporting variables, and I just can't seem to make this count work. What I have is the following: TOTAL=$($IMAGELIST -backupid $IM -U |gawk '{print $5}' |tail -1)|gawk '{print $6}' RESTORED=$($BPDBJOBS -most_columns -jobid $JOBS |cut -f15 -d,) |gawk '{print $6}' export... (7 Replies)
Discussion started by: newbie2010
7 Replies

8. Shell Programming and Scripting

Shell script to put delimiter for a no delimiter variable length text file

Hi, I have a No Delimiter variable length text file with following schema - Column Name Data length Firstname 5 Lastname 5 age 3 phoneno1 10 phoneno2 10 phoneno3 10 sample data - ... (16 Replies)
Discussion started by: Gaurav Martha
16 Replies

9. UNIX for Advanced & Expert Users

Need help export variable

Hi, Please find my code below. ps -xef | grep 14766 | awk 'BEGIN{X="java_home=";X="weblogic_home="} {for(i=1;i<=NF;i++){if($i ~ /-Dplatform\.home|java$/){split($i,P,"=");s=P?P:$i;print X""s}}}' echo "java_home="$java_home echo "weblogic_home="$weblogic_home Output: Why does... (3 Replies)
Discussion started by: mohtashims
3 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
OCI_GET_IMPLICIT_RESULTSET(3)											     OCI_GET_IMPLICIT_RESULTSET(3)

oci_get_implicit_resultset  -  Returns	the  next  child statement resource from a parent statement resource that has Oracle Database 12c Implicit
Result Sets

SYNOPSIS
resource oci_get_implicit_resultset (resource $statement) DESCRIPTION
Used to fetch consectutive sets of query results after the execution of a stored or anonymous Oracle PL/SQL block where that block returns query results with Oracle's DBMS_SQL.RETURN_RESULT PL/SQL function. This allows PL/SQL blocks to easily return query results. The child statement can be used with any of the OCI8 fetching functions: oci_fetch(3), oci_fetch_all(3), oci_fetch_array(3), oci_fetch_object(3), oci_fetch_assoc(3) or oci_fetch_row(3) Child statements inherit their parent statement's prefetch value, or it can be explicitly set with oci_set_prefetch(3). PARAMETERS
o $statement -A valid OCI8 statement identifier created by oci_parse(3) and executed by oci_execute(3). The statement identifier may or may not be associated with a SQL statement that returns Implicit Result Sets. RETURN VALUES
Returns a statement handle for the next child statement available on $statement. Returns FALSE when child statements do not exist, or all child statements have been returned by previous calls to oci_get_implicit_resultset(3). EXAMPLES
Example #1 Fetching Implicit Result Sets in a loop <?php $conn = oci_connect('hr', 'welcome', 'localhost/pdborcl'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'DECLARE c1 SYS_REFCURSOR; BEGIN OPEN c1 FOR SELECT city, postal_code FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); OPEN c1 FOR SELECT country_id FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); END;'; $stid = oci_parse($conn, $sql); oci_execute($stid); while (($stid_c = oci_get_implicit_resultset($stid))) { echo "<h2>New Implicit Result Set:</h2> "; echo "<table> "; while (($row = oci_fetch_array($stid_c, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { echo "<tr> "; foreach ($row as $item) { echo " <td>".($item!==null?htmlentities($item, ENT_QUOTES|ENT_SUBSTITUTE):"&nbsp;")."</td> "; } echo "</tr> "; } echo "</table> "; } // Output is: // New Implicit Result Set: // Beijing 190518 // Bern 3095 // Bombay 490231 // New Implicit Result Set: // CN // CH // IN oci_free_statement($stid); oci_close($conn); ?> Example #2 Getting child statement handles individually <?php $conn = oci_connect('hr', 'welcome', 'localhost/pdborcl'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'DECLARE c1 SYS_REFCURSOR; BEGIN OPEN c1 FOR SELECT city, postal_code FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); OPEN c1 FOR SELECT country_id FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); END;'; $stid = oci_parse($conn, $sql); oci_execute($stid); $stid_1 = oci_get_implicit_resultset($stid); $stid_2 = oci_get_implicit_resultset($stid); $row = oci_fetch_array($stid_1, OCI_ASSOC+OCI_RETURN_NULLS); var_dump($row); $row = oci_fetch_array($stid_2, OCI_ASSOC+OCI_RETURN_NULLS); var_dump($row); $row = oci_fetch_array($stid_1, OCI_ASSOC+OCI_RETURN_NULLS); var_dump($row); $row = oci_fetch_array($stid_2, OCI_ASSOC+OCI_RETURN_NULLS); var_dump($row); // Output is: // array(2) { // ["CITY"]=> // string(7) "Beijing" // ["POSTAL_CODE"]=> // string(6) "190518" // } // array(1) { // ["COUNTRY_ID"]=> // string(2) "CN" // } // array(2) { // ["CITY"]=> // string(4) "Bern" // ["POSTAL_CODE"]=> // string(4) "3095" // } // array(1) { // ["COUNTRY_ID"]=> // string(2) "CH" // } oci_free_statement($stid); oci_close($conn); ?> Example #3 Explicitly setting the Prefetch Count <?php $conn = oci_connect('hr', 'welcome', 'localhost/pdborcl'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'DECLARE c1 SYS_REFCURSOR; BEGIN OPEN c1 FOR SELECT city, postal_code FROM locations ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); END;'; $stid = oci_parse($conn, $sql); oci_execute($stid); $stid_c = oci_get_implicit_resultset($stid); oci_set_prefetch($stid_c, 200); // Set the prefetch before fetching from the child statement echo "<table> "; while (($row = oci_fetch_array($stid_c, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { echo "<tr> "; foreach ($row as $item) { echo " <td>".($item!==null?htmlentities($item, ENT_QUOTES|ENT_SUBSTITUTE):"&nbsp;")."</td> "; } echo "</tr> "; } echo "</table> "; oci_free_statement($stid); oci_close($conn); ?> Example #4 Implicit Result Set example without using oci_get_implicit_resultset(3) All results from all queries are returned consecutively. <?php $conn = oci_connect('hr', 'welcome', 'localhost/pdborcl'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $sql = 'DECLARE c1 SYS_REFCURSOR; BEGIN OPEN c1 FOR SELECT city, postal_code FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); OPEN c1 FOR SELECT country_id FROM locations WHERE ROWNUM < 4 ORDER BY city; DBMS_SQL.RETURN_RESULT(c1); END;'; $stid = oci_parse($conn, $sql); oci_execute($stid); // Note: oci_fetch_all and oci_fetch() cannot be used in this manner echo "<table> "; while (($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { echo "<tr> "; foreach ($row as $item) { echo " <td>".($item!==null?htmlentities($item, ENT_QUOTES|ENT_SUBSTITUTE):"&nbsp;")."</td> "; } echo "</tr> "; } echo "</table> "; // Output is: // Beijing 190518 // Bern 3095 // Bombay 490231 // CN // CH // IN oci_free_statement($stid); oci_close($conn); ?> NOTES
Note For queries returning a large number of rows, performance can be significantly improved by increasing oci8.default_prefetch or using oci_set_prefetch(3). PHP Documentation Group OCI_GET_IMPLICIT_RESULTSET(3)
All times are GMT -4. The time now is 08:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy