eladr
asked on
stored procedures
hi...
i am using stored procedures in oracle db from my asp pages.
let's assume the store procedure is called "update_info".
let's also assume this procedure is getting 2 input variable,and
it's output contain an integer betwean 0 and 4.
well...my questain is...what is my syntsx for that?
remember...it is not ordinary procedure to execute.
it procedure that gets 2 parameters and also return parameter.
this is the first time i do it so please be clear and dont complicates
me...
elad
i am using stored procedures in oracle db from my asp pages.
let's assume the store procedure is called "update_info".
let's also assume this procedure is getting 2 input variable,and
it's output contain an integer betwean 0 and 4.
well...my questain is...what is my syntsx for that?
remember...it is not ordinary procedure to execute.
it procedure that gets 2 parameters and also return parameter.
this is the first time i do it so please be clear and dont complicates
me...
elad
In T-SQL, it was the following. Don't know the syntax for Oracle, sorry.
CREATE PROCEDURE myProc
@param1 int,
@param2 int,
@param3 int OUTPUT -- not being input
AS
SELECT @param3 FROM myTable
RETURN
CREATE PROCEDURE myProc
@param1 int,
@param2 int,
@param3 int OUTPUT -- not being input
AS
SELECT @param3 FROM myTable
RETURN
And here's the sample code to use you stored procedure from ASP. Follwoing code assumes to get two inout parameters from html form, and after execution, saves output value in a variable 'temp'. This is juts a sample code, and you might need to edit this code, according to your needs.
=============
Set DataConn = Server.CreateObject("ADODB .Connectio n")
set DataComm = Server.CreateObject("ADODB .Command")
DataConn.Open "dsn=db1;uid=sa;pwd="
Set DataComm.ActiveConnection= DataConn
DataComm.CommandType = adCMDStoredProc
DataComm.CommandText="sp_D oAllCheck"
'sp_DoAllCheck is name of Stored Procedure
set myFirstParam = DataComm.CreateParameter(" param1", adVarInt, adParamInput, 30)
dataComm.parameters.append myfirstparam
set mySecondParam = DataComm.CreateParameter(" Param2", adVarInt, adParamInput, 13)
dataComm.parameters.append MySecondParam
set myThirdParam = DataComm.CreateParameter(" param3", adChar, adParamOutput, 2)
dataComm.parameters.append MyThirdParam
DataComm("param1")=Request .FORM("val ueOfparam1 ")
DataComm("param2")=Request .FORM("val ueOfparam2 ")
datacomm.execute
temp = datacomm("param3")
=============
Set DataConn = Server.CreateObject("ADODB
set DataComm = Server.CreateObject("ADODB
DataConn.Open "dsn=db1;uid=sa;pwd="
Set DataComm.ActiveConnection=
DataComm.CommandType = adCMDStoredProc
DataComm.CommandText="sp_D
'sp_DoAllCheck is name of Stored Procedure
set myFirstParam = DataComm.CreateParameter("
dataComm.parameters.append
set mySecondParam = DataComm.CreateParameter("
dataComm.parameters.append
set myThirdParam = DataComm.CreateParameter("
dataComm.parameters.append
DataComm("param1")=Request
DataComm("param2")=Request
datacomm.execute
temp = datacomm("param3")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER