control cannot go to exception [message #404419] |
Thu, 21 May 2009 14:44 |
nastyjillu
Messages: 211 Registered: February 2009
|
Senior Member |
|
|
hi, in a procedure i have below code ( didnot write complete code)
SELECT min(seq)
INTO p_seq
FROM table_a
WHERE id = p_id
AND stat = p_stat;
EXCEPTION
WHEN no_data_found THEN
p_seq := 99999;
if i pass value(p_id) to the procedure, and if there is no value for seq for the passed p_id, then the control should go to exception and assign 99999 to p_seq. but its not hapenning.
if i select seq instead of min(seq) in the select query, then the control is going to exception and assigning 99999 to p_seq.
cant we use exception if we are using group functions like min,max etc??
thanks
jillu
|
|
|
|
|
|
Re: control cannot go to exception [message #404543 is a reply to message #404425] |
Fri, 22 May 2009 03:57 |
cookiemonster
Messages: 13961 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
nastyjillu wrote on Thu, 21 May 2009 21:14 | if we use aggregate function in select query, it always return a value or a null value.
|
That should be if we use aggregate function without a group by.
If you use a group by you can get no_data_found.
|
|
|