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"
has anybody tried it calling in an sql ?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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
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
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
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
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
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
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
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
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
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
LEARN ABOUT PHP
oci_parse
OCI_PARSE(3) OCI_PARSE(3)
oci_parse - Prepares an Oracle statement for execution
SYNOPSIS
resource oci_parse (resource $connection, string $sql_text)
DESCRIPTION
Prepares $sql_text using $connection and returns the statement identifier, which can be used with oci_bind_by_name(3), oci_execute(3) and
other functions.
Statement identifiers can be freed with oci_free_statement(3) or by setting the variable to NULL.
PARAMETERS
o $connection
- An Oracle connection identifier, returned by oci_connect(3), oci_pconnect(3), or oci_new_connect(3).
o $sql_text
- The SQL or PL/SQL statement. SQL statements should not end with a semi-colon (";"). PL/SQL statements should end with a semi-
colon (";").
RETURN VALUES
Returns a statement handle on success, or FALSE on error.
EXAMPLES
Example #1
oci_parse(3) example for SQL statements
<?php
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
// Parse the statement. Note there is no final semi-colon in the SQL statement
$stid = oci_parse($conn, 'SELECT * FROM employees');
oci_execute($stid);
echo "<table border='1'>
";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>
";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>
";
}
echo "</tr>
";
}
echo "</table>
";
?>
Example #2
oci_parse(3) example for PL/SQL statements
<?php
/*
Before running the PHP program, create a stored procedure in
SQL*Plus or SQL Developer:
CREATE OR REPLACE PROCEDURE myproc(p1 IN NUMBER, p2 OUT NUMBER) AS
BEGIN
p2 := p1 * 2;
END;
*/
$conn = oci_connect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$p1 = 8;
// When parsing PL/SQL programs, there should be a final semi-colon in the string
$stid = oci_parse($conn, 'begin myproc(:p1, :p2); end;');
oci_bind_by_name($stid, ':p1', $p1);
oci_bind_by_name($stid, ':p2', $p2, 40);
oci_execute($stid);
print "$p2
"; // prints 16
oci_free_statement($stid);
oci_close($conn);
?>
NOTES
Note
This function does not validate $sql_text. The only way to find out if $sql_text is a valid SQL or PL/SQL statement is to execute
it.
SEE ALSO
oci_execute(3), oci_free_statement(3).
PHP Documentation Group OCI_PARSE(3)