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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data from stored procedure Oracle, plz help. 1

Status
Not open for further replies.

gold2000

Programmer
Jul 25, 2000
4
0
0
CZ
Ok here it goes.<br>I have some stored procedure in Oracle database and I would like to retrieve single values and cursor from it and display in ASP-page. <br><br>&nbsp;PROCEDURE proc1(a_str1 OUT varchar2,a_str2 OUT varchar2)AS <br>&nbsp;BEGIN&nbsp;&nbsp;a_str1:='bla'; a_str2:='bla'; END;<br><br>OR<br><br>&nbsp;TYPE cur IS REF CURSOR;<br>&nbsp;PROCEDURE proc2(a_num IN number, a_cur IN OUT cur) AS<br>&nbsp;BEGIN<br>&nbsp;&nbsp;OPEN a_cur FOR<br>&nbsp;&nbsp;&nbsp;SELECT colname1 FROM tablename WHERE colname2=a_num;<br>&nbsp;END;<br><br>Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)<br>objConn.Open &quot;dsn=asptest;uid=scott;pwd=tiger;&quot;<br>...???<br>plz example.<br>
 
I normally call my procedures in the following manner:<br><br>Go through the normal ADO connection criteria, then I do the following.<br><br>set rs = dbConn.Execute(&quot;GetProcedure &quot; & paramater & &quot;, &quot; & paramater)<br><br>Then proceed with the normal population and cleanup process.<br><br>I hope this helps!
 
You need to use the Command object to return OUTPUT parameters from a stored procedure.<br><br>'assumes you have the ado constants defined<br>Dim Cmd<br>Set Cmd = Server.CreateObject(&quot;ADODB.Command&quot;)<br>With Cmd<br>&nbsp;&nbsp;&nbsp;&nbsp;.ActiveConnection = sDSN 'insert your DSN here<br>&nbsp;&nbsp;&nbsp;&nbsp;.CommandType = adCmdStoredProc<br>&nbsp;&nbsp;&nbsp;&nbsp;'&nbsp;&nbsp;CreateParameter (name, type, direction, size, value)<br>&nbsp;&nbsp;&nbsp;&nbsp;.Parameters.Append .CreateParameter (&quot;@param1&quot;, adVarChar, adParamOutput, 15)<br>&nbsp;&nbsp;&nbsp;&nbsp;.Parameters.Append .CreateParameter (&quot;@param2&quot;, adVarChar, adParamOutput, 15)<br>&nbsp;&nbsp;&nbsp;&nbsp;.Execute<br>End With<br><br>Dim sVal1, sVal2<br>sVal1 = Cmd.Parameters(0).Value<br>sVal2 = Cmd.Parameters(1).Value<br> <p> Jeff Friestman<br><a href=mailto: > </a><br><a href= View my Brainbench transcript</a><br>Brainbench 'Most Valuable Professional' for ASP<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top