Skip to main content
Inspiring
April 10, 2007
Question

CFSTORED_PROC

  • April 10, 2007
  • 5 replies
  • 1567 views
What is wrong with this Stored Proc ? It works fine in sqlplus but not with a CF call..I have created a simple Hello proc , and called from CF it works fine...Any help ? Thanks.

Attach Code

::::::::::::The CF call ::::::::::::::::::
<CFSTOREDPROC DATASOURCE="#FormVector#" PROCEDURE="your_pkg.your_proc" returncode="yes">
<CFPROCPARAM TYPE="IN" CFSQLTYPE="CF_SQL_NUMERIC" VALUE="2" NULL="No">
<CFPROCRESULT NAME="view">
</CFSTOREDPROC>
<cfdump var="#view#">
::::::::::::::The proc::::::::::::

CREATE OR REPLACE PACKAGE your_pkg IS

-- Global declaration for ref_cursor
TYPE ref_cur_type
IS REF CURSOR;

PROCEDURE your_proc(in_id IN NUMBER, out_rec OUT ref_cur_type);

END your_pkg;
/

CREATE OR REPLACE PACKAGE BODY your_pkg IS

PROCEDURE your_proc(in_id IN NUMBER, out_rec OUT ref_cur_type)

IS

BEGIN

OPEN out_rec
FOR
SELECT *
FROM BPAR
WHERE UN = in_id;

END your_proc;

END your_pkg;
/
This topic has been closed for replies.

5 replies

Participant
August 25, 2017

Year 2017, CF version 2016 (patch 4).

Found a good post here by Bill which worked for me. Colons in front of the variable names (with Oracle)

CF 11 AND STORED PROCEDURES WITH NAMED PARAMETERS &vert; IN THE TRENCHES

emmim44Author
Inspiring
April 13, 2007
Noap...It wasnt working before and after...Here is the errr...

Error Executing Database Query.
[Macromedia][Oracle JDBC Driver]Incorrect parameter bindings for stored procedure call. Check your bindings against the stored procedure's parameters.

The error occurred in /apps/www/html/StoreProc.cfm: line 12

10 : <CFSTOREDPROC DATASOURCE="#FormVector#" PROCEDURE="your_pkg.your_proc" returncode="yes">
11 : <CFPROCPARAM TYPE="IN" CFSQLTYPE="CF_SQL_NUMERIC" VALUE="2" NULL="No">
12 : <CFPROCRESULT NAME="view">
13 : </CFSTOREDPROC>
14 : <cfdump var="#view#">


--------------------------------------------------------------------------------

SQL { (param 1) = call your_pkg.your_proc( (param 2) )}
DATASOURCE Oracle9i_OtherForms
SQLSTATE HY000

Resources:
Participating Frequently
April 13, 2007
Found it. You need to set returncode = "No" instead of yes in your cfstoredproc tag. This will mess you up when calling Oracle stored procedures.

(You know how you look at something 100 times and don't see it. I have always automatically set this to No in my own code, so my eyes must have just kept skipping over it.... sorry)

Phil
Participant
April 12, 2007
Are you perhaps running 7.0.2 with Cumulative Hot Fix 1 (chf7020001.jar) installed? I've just been pulling my hair out with something similar myself --

[Macromedia][Oracle JDBC Driver][Oracle]ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at line 1

-- whenever I try cfstoredproc with Oracle stored procedures. Worked fine before patch, and works now that it's been removed. Tested DataDirect v3.4 and v3.5 drivers, Windows and Solaris platforms and more than one procedure call. All failed when CHF 1 is installed. I'm back to individual hot fixes.

Hope that helps (Currently running CF Version 7,0,2,142559),

Dean


emmim44Author
Inspiring
April 12, 2007
Yes I checked the advance settings..How am going to check this :
>>You don't happen to be using Oracle's ThinClient JDBC drivers by any chance, are you? (Or , perhaps ODBC with Microsoft drivers?)
Participating Frequently
April 10, 2007
Looks OK to me. You don't happen to be using Oracle's ThinClient JDBC drivers by any chance, are you? (Or , perhaps ODBC with Microsoft drivers?) What is the actual error that you are seeing?

TechNote
Note: Oracle Ref Cursors are only supported with the DataDirect Technologies Oracle JDBC Driver.

Phil
Participating Frequently
April 10, 2007
..or, prehaps you may want to take a look at this TechNote if you are using Oracle 10g R2.

Issue 61145 - Oracle 10g R2 not supported. cfstoredproc calls that return result sets hang the server with both the 3.3, 3.4 and 3.5 drivers until this version. The 3.5 build 13 drivers support Oracle 10g R2.

Also, have you verified that Stored Procedures under Allowed SQL is checked under your Advanced Settings for your data source?

Phil