|
 |
asp_databases thread: Stored Procedures with Oracle
Message #1 by "Marcia A. Eaton" <msweet@n...> on Fri, 15 Dec 2000 13:39:29 -0000
|
|
Good Morning,
I was wondering if anyone uses Oracle Stored Procedures for select
statements. We use stored procedures for inserts,updates and deletes, but
for Selects we use ASP recordsets. Is there a way to use a stored
procedure and then pass the results to a record set, or something like
that?
Thanks for any info anyone might have...
Marcia
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by Imar Spaanjaars <Imar@S...> on Fri, 15 Dec 2000 15:31:53 +0100
|
|
Yes, this almost works the same as another SP.
Example:
CREATE PROCEDURE spMyProcedure as
SELECT ID from aTable
Then use the following code in ASP:
Set aRecordset = aConnection.Execute("spMyProcedure")
if aRecordset.EOF then
Response.Write("No records found")
else
' Do something with the recordset
end if
This is a very basic example, but you could do more advanced things as well.
If you need parameters, I suggest you use the ADO command object.
Example:
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = sYourConnectionStringOrObjectHere
objCommand.CommandType = adCmdStoredProc
objCommand.CommandText = "spMyProcedure" ' stored procedure spMyProcedure
objCommand.Parameters.Append (objCommand.CreateParameter("iUserID",
adInteger, adParamInput,, iUserID))
Set aRecordset = objCommand.Execute
This creates a command object, sets an input parameter called iUserID and
then stores the results of the execute method in a recordset.
HtH
Imar
At 02:12 PM 12/15/2000 -0800, you wrote:
>Good Morning,
>
>I was wondering if anyone uses Oracle Stored Procedures for select
>statements. We use stored procedures for inserts,updates and deletes, but
>for Selects we use ASP recordsets. Is there a way to use a stored
>procedure and then pass the results to a record set, or something like
>that?
>
>Thanks for any info anyone might have...
>
>Marcia
>
---
FREE SOFTWARE DEVELOPMENT CODE, CONTENT, AND
INSIGHTS IN YOUR INBOX!
Get the latest and best C++, Visual C++, Java, Visual Basic, and XML tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb?s
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |