DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Sql or PL./SQL question

  1. #1
    Join Date
    Mar 2003
    Posts
    1

    Sql or PL./SQL question

    Hi Guys,

    First time post...

    I have a requirement which will have to check different combinations to get result.

    Example: Assume that the table data looks like this

    Col1 Col2 Col3 Col4
    1 A 1.5
    2 B 0.5
    3 C 2.5
    4 D 1.5
    5 E 0.5

    I pass a parameter to the procedure which should update the table like the following. In this case I pass 4 as the parameter and the procedure updates Col4 with EXT where SUM(Col3) = 4. There could be more than 1 combinations, but I just need 1 combination.

    Col1 Col2 Col3 Col4
    1 A 1.5 EXT
    2 B 0.5 EXT
    3 C 2.5
    4 D 1.5 EXT
    5 E 0.5 EXT
    6
    7
    ...

    Any suggestions?

    -John

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    I pass a parameter to the procedure which should update the table like the following. In this case I pass 4 as the parameter and the procedure updates Col4 with EXT where SUM(Col3) = 4. There could be more than 1 combinations, but I just need 1 combination.


    What????

    Why does the procedure update column 4? Based on what criteria (where condition)?

  3. #3
    Join Date
    Sep 2001
    Posts
    37
    Originally posted by stecal
    Why does the procedure update column 4? Based on what criteria (where condition)?
    I think that the name of the update column (Col4)is hardcoded for this case as a program requirement.. at least that is what i understood..

    Originally posted by John90245
    I pass a parameter to the procedure which should update the table like the following. In this case I pass 4 as the parameter and the procedure updates Col4 with EXT where SUM(Col3) = 4.
    Traslation: There is a table with certain amount of rows and is needed to define a PL/SQL function that find one group (combination) of rows, which have the sum of the value of Col3 equal to a parameter passed to the function. The function have to update all the rows included in the group founded with the value 'EXT' in the Col4 column.
    Am i right???...

    Originally posted by John90245
    There could be more than 1 combinations, but I just need 1 combination.
    [/B]
    The first one that the function finds???

Posting Permissions

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


Click Here to Expand Forum to Full Width