Click to See Complete Forum and Search --> : Sql or PL./SQL question


John90245
03-04-2003, 01:37 PM
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

stecal
03-04-2003, 04:12 PM
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)?

ccastaneda
03-04-2003, 11:48 PM
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???