PORQUE ESTE ERROR?

RONALD
02 de Marzo del 2004
TENGO EL SIGUIENTE SELECT DENTRO DE UN BOTON CON UN TRIGGER WHEN BUTTON PRESSED:

select num_serv into :mae_servicio.num_serv
from mae_servicio
where num_serv = :mae_servicio.num_serv
for update;

Y ME DA EL SIGUIENTE ERROR ORA-01403

In a host language program, all records have been fetched. The return code from the fetch was +4, indicating that all records have been returned from the SQL query.

ESTOY USANDO FORM 5, Y SE QUE ESTO ME DA PORQUE TODOS LOS REGISTROS FUERON TRAIDOS DE LA BBDD PERO COMO HAGO PARA QUE NO ME MANDE NINGUN ERROR.

SALUDOS DESDE VENEZUELA.

hngb
02 de Marzo del 2004
ese error es por que no encontro datos que cumplieran con el select.. para oviar este tipo de errores debes usar los EXCEPTION... asi:

Begin
select num_serv
into :mae_servicio.num_serv
from mae_servicio
where num_serv = :mae_servicio.num_serv
for update;
exception
when no_data_found then
:mae_servicio.num_serv := [un valor por defecto]
when too_many_rows then
:mae_servicio.num_serv := [un valor por defecto]
end;

En [un valor por defecto] debes colocar un valor por defecto que tu defines en caso de encontrar un registro que cumpla con la clausula WHERE..

Espero te sirva....