Results 1 to 2 of 2
  1. #1
    Join Date
    May 2008
    Posts
    4

    Arrow Unanswered: Please help... Stored PRocedure return values

    Hi,
    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
    2 Shirts
    3 Pants

    Women Wear (2)
    4 Tops
    5 Bangles

    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...
    Chandrasekhar

  2. #2
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •