Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Oracle Stored FUNCTION from ASP

Status
Not open for further replies.

RobNisbet

Programmer
Jul 10, 2001
22
GB
Hi,
I am having probs calling my Oracle function. I am aware of the whole process of calling an Oracle SP from ASP and returning a recordset, however this one is slightly different.
My Stored function goes like this...
FUNCTION next_nah_status
(p_status IN NUMBER,
p_change_code in VARCHAR2
,p_change_code2 in VARCHAR2
,next_status out NUMBER)
RETURN NUMBER
IS
etc....
END
--------------
Aside - to get result from function in SQL I'd use -
select next_nah_status(3,'WO',null) from dual
NOT exec next_nah_status(3,'WO',null) as for
stored procs.
----------
And I've tried the following ways to get my number back to my ASP:
1- Using a recordset since it's only a select really:)
Set OracRS3 = Server.CreateObject("ADODB.Recordset")
sql_next_status="select next_nah_status(3,'WO',null) from dual"
OracRS3.Open sql_next_status, conn, 1, 2
next_status=OracRS3.fields(0)

No joy, Invalid SQL error

2- Full on parameter stuff

Set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection=conn
objCmd.CommandType=adcmdstoredproc
objCmd.CommandText="next_nah_status"

objCmd.Parameters.Append objCmd.CreateParameter("p_status",adNumeric,adParamInput, 2,3)
objCmd.Parameters.Append objCmd.CreateParameter("p_change_code",adVarchar,adParamInput, 2,"WO")
objCmd.Parameters.Append objCmd.CreateParameter("p_change_code2",adVarchar,adParamInput, 2,null)
objCmd.Parameters.Append objCmd.CreateParameter("next_status",adNumeric, adParamOutput, 2)

objCmd.Execute
next_status=objCmd.Parameters("next_status")

I get a Syntax error with this chappie.

Any help very very much appreciated...
Cheers!!
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top