Sponsored Content
Top Forums Shell Programming and Scripting Variable not found error for a variable which is returned from stored procedure Post 302505993 by michaelrozar17 on Friday 18th of March 2011 06:59:27 AM
Old 03-18-2011
As you would know the error is related to Oracle. Please check the procedure you have written, it has some syntax errors. Or explain what your trying to achieve with the procedure. If your trying to read the row count of a table to a unix shell variable then try/compile either of the below procedures..
Code:
create or replace NEW_PROC is
begin
select count(*) from table;
end;

or

create or replace NEW_PROC is
cnt int;
begin
select count(*) into cnt from table;
dbms_output.put_line(cnt);
end;


Last edited by michaelrozar17; 03-18-2011 at 08:33 AM.. Reason: typo
This User Gave Thanks to michaelrozar17 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assign the returned value of a function to a variable

Hi, Can anyone please show me how to assign the returned value of a function to a variable? Thanks. (2 Replies)
Discussion started by: trivektor
2 Replies

2. Shell Programming and Scripting

script or piece of code where the data returned by a stored procedure you are writing

hi fndz. Can you please help me with the code if I call a stored procedure from my shell script and stored procedure returns a cursor, cursor output should be saved to a file (3 Replies)
Discussion started by: enigma_83
3 Replies

3. Shell Programming and Scripting

How to assign value to a variable with row(using -n) returned by sed

Hi Friends, REQUIREMENT: Want to delete files from the current directory match with the same in the file test.txt set -x i=1 echo "i=$i" COUNT=`sed -n '$=' test.txt` echo "Count=$COUNT" while do "## Here is error##" FILETOREMOVE=`sed -n \'$i,1p\' test.txt` echo $FILETOREMOVE... (5 Replies)
Discussion started by: sourabhsharma
5 Replies

4. UNIX for Dummies Questions & Answers

Loop on array variable returning error: 0 not found

I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong. #!/usr/bin/ksh set -A MtPtArray /u03 /u06 tUbound=${#MtPtArray } echo $tUbound i=0 while ($i -lt $tUbound) do print... (4 Replies)
Discussion started by: KME
4 Replies

5. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies

6. UNIX for Dummies Questions & Answers

Assigning the output of a command to a variable, where there may be >1 line returned?

Hello I am using unix CLI commands for the Synergy CM software. The command basically searches for a folder ID and returns the names of the projects the folder sits in. The result is assigned to a variable: FIND_USE=`ccm folder -fu -u -f "%name"-"%version" ${FOLDER_ID}` When the command... (6 Replies)
Discussion started by: Glyn_Mo
6 Replies

7. Shell Programming and Scripting

check variable value when nothing is returned

Hi all, I am wondering how can I check when a variable has nothing returned in it. I am trying to store a pid in this variable to see if a script is running in the background. So I am using something like that proc_pid=`ps -ef |grep script.sh|grep -v grep|awk '{print $2}'` if then ... (1 Reply)
Discussion started by: geovas
1 Replies

8. UNIX for Dummies Questions & Answers

Variable not found error

Hi, I get a "FILEPATH: not found" error on the 3rd line and the line where it is within the case. Any idea as to why I'm getting this error time and time again? Oh and FILEPATH will store the directory of the file. I appreciate any help! IAM=`basename $0` RC=0 FILEPATH = ""... (1 Reply)
Discussion started by: MIA651
1 Replies

9. Shell Programming and Scripting

Getting value of variable whose name is stored in another variable

Unix OS : Linux 2.6x Shell type : Korn I am stuck in weird problem . In my shell script I am setting an environment variable using the following command : EMP="KUMARJIT"; export EMP In the following sections of the script , what I did is : I created and initialized a new shell variable "type"... (5 Replies)
Discussion started by: kumarjt
5 Replies

10. Shell Programming and Scripting

Variable not found error in while loop

I am unable to use the value of a variable. while ] do LstFldDataPart =`head -n "$LstFldDataPartCntr" "${FeedFileDir}/${FeedFileBadRecs}" | tail -1 | tr -d '\n'` echo $LstFldDataPart JndLstFldDataPart="${JndLstFldDataPart}${LstFldDataPart}" LstFldDataPartCntr=... (3 Replies)
Discussion started by: TomG
3 Replies
OCI_NEW_CURSOR(3)														 OCI_NEW_CURSOR(3)

oci_new_cursor - Allocates and returns a new cursor (statement handle)

SYNOPSIS
resource oci_new_cursor (resource $connection) DESCRIPTION
Allocates a new statement handle on the specified connection. PARAMETERS
o $connection - An Oracle connection identifier, returned by oci_connect(3) or oci_pconnect(3). RETURN VALUES
Returns a new statement handle, or FALSE on error. EXAMPLES
Example #1 Binding a REF CURSOR in an Oracle stored procedure call <?php // Precreate: // create or replace procedure myproc(myrc out sys_refcursor) as // begin // open myrc for select first_name from employees; // end; $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $curs = oci_new_cursor($conn); $stid = oci_parse($conn, "begin myproc(:cursbv); end;"); oci_bind_by_name($stid, ":cursbv", $curs, -1, OCI_B_CURSOR); oci_execute($stid); oci_execute($curs); // Execute the REF CURSOR like a normal statement id while (($row = oci_fetch_array($curs, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { echo $row['FIRST_NAME'] . "<br /> "; } oci_free_statement($stid); oci_free_statement($curs); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocinewcursor(3) instead. This name still can be used, it was left as alias of oci_new_cursor(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_NEW_CURSOR(3)
All times are GMT -4. The time now is 01:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy