开发者

How in ColdFusion with in variables get a Oracle stored procedure to return values?

开发者 https://www.devze.com 2023-03-23 00:57 出处:网络
ORACLE 11g - COLDFUSION 9 - REF CURSOR - WITH at least one in variable. How in ColdFusion with in variables get a Oracle stored procedure to return values?

ORACLE 11g - COLDFUSION 9 - REF CURSOR - WITH at least one in variable.

How in ColdFusion with in variables get a Oracle stored procedure to return values?

We have tried several things, we can get a stored procedure to return a result set if we are not passing in variables but we cannot get them when we are passing in variables.

We know how to do it calling MS SQL.

Thanks for any help

P.S. we have heard this may not be possible with the current Oracle Driver is there a d开发者_如何转开发ifferent Oracle driver?

From what I have been reading online I am thinking this is not just a coding issue. I hope I am wrong about that. This is just an example I was working on as a proof of concept so I can start creating all of them. I can get it work if I am not using a ref cusor.

Error Executing Database Query.

[Macromedia][Oracle JDBC Driver]The specified SQL type is not supported by this driver.

The error occurred in D:\apache\htdocs\test\index.cfm: line 86

84 : 85 : 86 : 87 : 88 :

CF Call to procedure

<cfstoredproc procedure="BWNGDBADEV.PACK_REFCURSOR.GETALL" datasource="mydatasourcename" returncode="no">
    <cfprocparam type="InOut" cfsqltype="CF_SQL_INTEGER" variable="pPERSONNELID" value="4" null="No">
    <cfprocparam type="Out" cfsqltype="CF_SQL_REFCURSOR" variable="AnyVarName">
    <!--- *** This name ties StoredProc results to the query below *** --->
    <cfprocresult name="myvar">
</cfstoredproc>

Oracle Package

CREATE OR REPLACE
PACKAGE PACK_REFCURSOR
AS
TYPE EMP_TableRows
IS
  REF
  CURSOR
    RETURN BWNGDBADEV.PER_PERSONNEL%ROWTYPE;
PROCEDURE GETALL(
      pPERSONNELID IN OUT BWNGDBADEV.PER_PERSONNEL.PERSONNELID%type,
      OUTTABLE OUT EMP_TableRows);
END PACK_REFCURSOR ;
  /


CREATE OR REPLACE
PACKAGE BODY PACK_REFCURSOR
AS
PROCEDURE GETALL(
      pPERSONNELID IN OUT BWNGDBADEV.PER_PERSONNEL.PERSONNELID%type,
      OUTTABLE OUT EMP_TableRows)
IS
BEGIN 
-- implicit cursor is opened - no close needed ***    
OPEN OUTTABLE FOR 
SELECT * 
FROM BWNGDBADEV.PER_PERSONNEL 
WHERE PERSONNELID = pPERSONNELID;

END GETALL ;

END PACK_REFCURSOR ;
/


do you have the latest DataDirect JDBC drivers ?

v 3.5 drivers and release notes here: http://kb2.adobe.com/cps/000/42dcb10a.html

the release notes suggest it fixes your exact problem


There's a small note in the docs stating: "You cannot use the cfprocparam tag for Oracle 8 and 9 reference cursors. Instead, use the cfprocresult tag."

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d52.html

Try something along these lines:

<cfstoredproc 
    procedure = "BWNGDBADEV.PACK_REFCURSOR.GETALL" 
    dataSource = "mydatasourcename" 
    returnCode = "Yes"> 

    <!--- cfprocparam tags ---> 
    <cfprocparam type="InOut" cfsqltype="CF_SQL_INTEGER" variable="pPERSONNELID" value="4" null="No">
    <cfprocparam type="Out" cfsqltype="CF_SQL_REFCURSOR" variable="AnyVarName">

    <!--- cfprocresult tags ---> 
    <cfprocresult name="RS1" resultSet="1"> 
    <cfprocresult name="RS2" resultSet="2"> 

</cfstoredproc> 
0

精彩评论

暂无评论...
验证码 换一张
取 消