Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Calling Stored Proc with Cursor from ASP
Marek Suchomski wrote in message <7fighv$jos$1_at_autumn.news.rcn.net>...
>I'm trying to use ASP to call several stored procedures that return
>ref_cursors. I created a function to call the procedure and return the
>cursor, but I have no idea what to do with it in ASP. What I've got so far
>looks like this:
>
>cmd.CommandText = "{ ? = call cur_pkg.www_func('" & userid & "')}"
>
>This appears to be correct, but how do I get the results into a recordset?
>Please help.
>
>
>
>Marek Suchomski
>suchomski_at_bsr.com
>
>
>
Using RDO 2.0 from Visual Baisc and the Oracle ODBC 8.0.5 driver (the first version to support this) you would have the following code, first the PL/SQL package, then the Visual Basic code:
create or replace package ref_cur_demo as
create or replace package body ref_cur_demo as function func(ename in varchar2) return ref_cur is
result ref_cur;
begin
return(result);
end;
procedure proc(ename in varchar2, result in out ref_cur) is
begin
Option Explicit
Dim ResultSet As rdoResultset
Dim DataBase As rdoConnection
Dim Query As rdoQuery
Dim RDOEnv As rdoEnvironment
Private Sub Form_Load()
Set RDOEnv = rdoEnvironments(0)
' Set username, password andconnect.
prompt:=rdDriverNoPrompt)
' Create call to stored procedure. Set Query = DataBase.CreateQuery("Query", _ "{ ? = call ref_cur_demo.func('S%') }") ' Call stored procedure and openresult.
If Not ResultSet Is Nothing Then
' We have a result, iterate allrows.
While Not ResultSet.EOF
Debug.Print CStr(ResultSet!EMPNO), ResultSet!ENAME, ResultSet!JOB, _ ResultSet!MGR, CStr(ResultSet!HIREDATE), CStr(ResultSet!SAL), _ CStr(IIf(IsNull(ResultSet!COMM), 0, ResultSet!COMM)), _ CStr(ResultSet!DEPTNO) ResultSet.MoveNext
Private Sub Form_Unload(Cancel As Integer)
DataBase.Close
End Sub
I'm sure you can easily adapt the code above to VBScript.
HTH. Finn Received on Wed Apr 21 1999 - 04:37:08 CDT