December 31, 2004 at 7:13 am
Hi,
I am an application developer, not a DBA, and I am making a shopping cart for a web site. I need to process the items in the cart as a transaction, and it seems to me that doing the processing as a stored procedure would be the best way. Also, from reading posts in this forum, it should be possible to do the database inserts without resorting to cursors.
So, I have two questions:
1) how can I pass an array of values (orderID, unitPrice, quantity, etc. for each item ordered) to a stored procecure?
2) how can I process the orders without using a cursor? (assuming it is possible to pass the data for multiple items)
Thanks for any help.
David
December 31, 2004 at 9:54 am
You can have multiple parameters, so I'd pass each item in as one call to the stored procedure and handle that in the code. At the end, you can call another stored procedure to check the count of items and handle errors then.
As far as processing, what does that entail? There are many ways to handle multiple items, but it depends on what you are processing
December 31, 2004 at 10:33 am
Steve,
I believe that you have answered my question. I cannot pass multiple items to a stored procedure. If I pass one item per stored procedure, then I have no need for a cursor.
Right now "processing" means that I store the data in the database (real processing details will come later). If I could have passed an array to the stored procedure, I would have wanted to do a bulk insert of all the items. That is clearly not possible.
Thanks for your help.
David
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply