473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Get Ref Cursor from procedure in ASP

1
Hi!
I'm developing a classic ASP application in which I'm supposed to retrieve a recordset from an Oracle procedure.

The Oracleprocedure only has one parameter, an out parameter of type REF CURSOR. The provider we are using is "ASPOraOLEDB.Oracle.1".

I can retrieve strings and other types from the procedures in the same Oracle database but I cannot get the ref cursor to work from ASP.

This is the code in ASP:
Dim lcConnectionString, loConn
lcConnectionString = "Provider=OraOLEDB.Oracle.1;Data Source={Datasource};Persist Security Info=True;Password=[password};User ID={user}"

Set loConnection = Server.CreateObject("ADODB.Connection")
loConnection.Open lcConnectionString
Dim loRS
Set loRS = Server.CreateObject("ADODB.RecordSet")

Set CMD = Server.CreateObject("ADODB.Command")
CMD.ActiveConnection = loConnection
cmd.CommandType = adCmdStoredProc
CMD.CommandText = "{call package.utdata()}"

Set loRS = CMD.Execute()

I am receiving the following error:
OraOLEDB error '80040e14'

ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'UTDATA' ORA-06550: line 1, column 7: PL/SQL: Statement ignored

If I use the following syntax for the command.commantext: CMD.CommandText = "{call package.utdata(?)}" I only get an empty resultset which is closed.

I also tried to add an out Parameter to the Command object such as:
CMD.Parameters.Append CMD.CreateParameter("varde", adVarChar, adParamOutput)
where "varde" is the name of the out parameter in the Oracle procedure. But got the same error.

I know that we have succeded to get data from the same procedure in VBA/Excel but not from ASP.

I will be really thankful if anyone has a solution to this.
Feb 13 '08 #1
1 5109
CroCrew
564 Expert 512MB
Hello andeke,

Here is what I use when banging away at a Microsoft SQL server Stored Proc. I think hitting an Oracle Stored Proc would be very similar. Take a look and see if it helps you out. If not then we can look at your problem in more detail.

Hope this helps~

Expand|Select|Wrap|Line Numbers
  1. <%            
  2.     Set Conn = Server.CreateObject("ADODB.Connection")
  3.     Conn.Open Application("myConnectionString") 'connection string here
  4.     Set Cmd = Server.CreateObject("ADODB.Command")
  5.  
  6.     With CMD
  7.         .ActiveConnection = conn    'You can also just specify a connection string here
  8.         .CommandText = "certificates" 'Name of procedure
  9.         .CommandType = adCmdStoredProc 'Requires the adovbs.inc file or typelib meta tag
  10.  
  11.         'Add Input Parameters
  12.         .Parameters.Append .CreateParameter("@MyValue", adInteger, adParamInput, ,LocalValue)
  13.  
  14.         'Add Output Parameters
  15.         .Parameters.Append .CreateParameter("@ProcValue", adInteger, adParamOutput, ,0)    
  16.  
  17.         'Note: 
  18.         '    Make sure you are setting the correct type in both Input and Output Parameters.
  19.         '    I am passing in and receiving an integer.
  20.  
  21.         'Execute the function
  22.         .Execute, ,adExecuteNoRecords
  23.  
  24.         'Setting new local variables 
  25.         MyNewValue = .Parameters("@ProcValue")
  26.     End With
  27.  
  28.     Response.Write("Here is the value that i got: " & MyNewValue )
  29. %>
  30.  
  31.  
Feb 13 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Philip Mette | last post by:
Does anyone have any good references they could recommend on Cursor based SQL writing? I have to create SQL that can loop though records simular to VB loops and I have been told that this is the...
15
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
10
by: Neil | last post by:
I need to get two values from a complex SQL statement which returns a single record and use those two values to update a single record in a table. In order to assign those two values to variables...
2
by: ansonee | last post by:
I wrote a stored procedure that contains some COMMIT logic, but keep runnign into an odd problem. As soon as the procedure gets to the COMMIT statement, the CURSOR closes. Here's the procedure: ...
8
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY...
12
by: Lucky | last post by:
Hi guys! i want to create one cursor in the t-sql. the problem is i want to use stored procedure instead of select command in cursor. can anyone tell me how can i use stored procedure's o/p to...
10
by: 4.spam | last post by:
Hello. v8.2.7, windows xp. --- create procedure cursor_test() language sql dynamic result sets 1 begin declare c1 cursor
2
by: BilalGhazi | last post by:
Hi All, I have this strange problem. I am user of two different database (both are same version 9i). I created a procedure and within this procedure i used a cursor to select the values, this is...
1
by: love2livedislife | last post by:
I have a requirement as follows: while executing the procedure for first time i'll open a cursor and read the first row from it and return the value through OUT parameter of procedure without...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.