Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Should be sumply but...
Here's some sample code which should help... Included you will find
PROCEDURE sp_GetDivision (pDivisionID IN NUMBER,
io_cursor IN OUT t_cursor);
END Pkg_Divisions;
CREATE OR REPLACE PACKAGE BODY Pkg_Divisions AS PROCEDURE sp_GetDivision (pDivisionID IN NUMBER,
io_cursor IN OUT t_cursor) IS d_cursor t_cursor;iNumChildren NUMBER;
SELECT COUNT(fk_DivisionID) INTO iNumChildren FROM ROLETITLES WHERE fk_DivisionID = pDivisionID; OPEN d_cursor FOR SELECT d.DivisionID, d.DivisionName, d.GraphicOSName, d.Priority, iNumChildren FROM DIVISIONS d WHERE d.DivisionID = pDivisionID;
<% Response.Buffer = true %>
<%
'Connect to the database using Microsoft OLEDB provider (Others will work too)
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionTimeout = 60
Conn.Open "Provider=MSDAORA.1;Data Source=;User ID=;Password="
' Extract the filters from the Request object
Dim strDivisionID, blnAllowDeletes
strDivisionID = 1 ' You can get this through the request object or the
querystring object etc.
' Call the sproc for our recordset, and
Dim cmd, rs, aRS, prmDivisionID, sSQL, iRowCount
set cmd = Server.CreateObject("ADODB.Command")
set rs = Server.CreateObject("ADODB.Recordset")
aRS = null ' we typically return the recordset into an array, but
you could handle it in the native recordset if you like
sSQL = "{Call Pkg_Divisions.sp_GetDivision(?, {resultset 0, io_cursor})}"
with cmd
.ActiveConnection = conn
.CommandType = adCmdText
.CommandText = sSQL
set prmDivisionID = .CreateParameter("pDivisionID", adInteger,
adParamInput,,strDivisionID)
with .Parameters
.Append prmDivisionID
end with
end with
with rs
.CursorLocation = AdUseClient
.CacheSize = 10
.Open cmd, , adOpenForwardOnly, adLockReadOnly
if (.State = adStateOpen) then
if (NOT .EOF) then
aRS = .GetRows
iRowCount = .RecordCount
end if
.Close
end if
end with
with cmd.Parameters
.Delete "pDivisionID"
end with
set prmDivisionID = nothing
set cmd.ActiveConnection = nothing
set cmd = nothing
set rs = nothing
%>
Now you can work with the recordset
Hope this helps,
Gord
'"rdf" <deficis_at_show.it> wrote in message
news:8u8get$g5e$1_at_nslave3.tin.it...> Hi,
> this is my question:
> How can I execute a oracle procedure (with input and output parameters)
from
> asp script ? > I tried with th ado connection object: Conn.Execute("myprocedure"), but I > received a 'Catastrofic Failure' error. > Thanks. > >Received on Tue Nov 07 2000 - 12:58:29 CST
![]() |
![]() |