05-09-08, 18:05 #1Registered User
- Join Date
- May 2008
Unanswered: Please help... Stored PRocedure return values
I am trying to get the combination of results in my stored procedure, I am not getting what I need. Following are the things which I need to return from my stored proc.
1. I need to select distinct categories and their record count
2. I also need to select the records from the table.
3. Need to send both category, record counts and records.
First is it possible in stored procedure?
Following is helpful information.
Data in tables looks like this.
prod id, prod_name, prod_category
1, T shirts, Mens Apparel
2 , Shirts, Mens Apparel
3 , Pants , Mens Apparel
4, Tops , Women Wear
5, Bangles, Women Wear
And in User Interface I need to show like this.
Mens Apparel (3)
1 T Shirts
Women Wear (2)
Please help me if there is any way to return the complete data structure using stored procedure. If I do something in java code, I can get this, but I am trying to get directly from stored procedure only.
Thanks in advance...
05-09-08, 18:25 #2Wayward Son/Black Sheep
- Join Date
- Feb 2004
- Burbank & Santa Cruz de la Sierra
You can create a local table variable inside your stored procedure, and return the data from the stored procedure as a row in that table. However, that is kind of kludgy and somewhat complex because your return values apparently are random in number (I mean the details under the category summary line).
The interface is probably the one that should be concerned about presentation issues. The stored procedure(s) should return the data.
You could write one proc that returns the summary lines for each prod_category, then another one that returns the individual products within a category.
A couple thoughts, at least.aka "Paul"
Non est ei similis.
I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them