Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display PL/SQL function warnings

I have the following function:

CREATE OR REPLACE Function pode_levar( pedidos NUMBER, viagens  NUMBER)
   RETURN NUMBER
IS
x NUMBER:=0;
y NUMBER:=0;
TRUE NUMBER:=0;
BEGIN

BEGIN
    Select id_pedido into x
    from pedido
    where id_pedido = pedidos;
    EXCEPTION 
    WHEN NO_DATA FOUND THEN 
    RAISE_APPLICAITON_ERROR(-20305,'PEDIDO TRANSPORTE ENIXISTENTE');
END;

BEGIN
    select lim_vei_vol - volume_total_viagem(viagens)  into y
    from v viagem , ve veiculo
    where v.id_viagem = ve.id_viagem
    and id_viagem = viagens;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    TRUE:=0;
    RAISE_APPLICATION_ERROR(-20304,'Viagem Enixistente');
    RETURN(TRUE);
END;

BEGIN 
    IF y <> 0 
    TRUE := 1;
    RETURN(TRUE);
    ELSE
    TRUE := 0;
    RETURN(TRUE);
    ENDIF;

END;

END;

The function compiles with one warning, how can I see it? show errors does not work

This is for school,

like image 382
Emanuel Bicho Avatar asked Nov 17 '25 10:11

Emanuel Bicho


1 Answers

You should use SQL* Plus and set

ALTER SESSION SET PLSQL_WARNINGS = 'ENABLE:ALL';

before you create your function. This setting will show you any warnings by using

SHOW ERRORS;

Read: http://docs.oracle.com/cd/B28359_01/server.111/b28320/initparams186.htm#REFRN10249

like image 54
Toru Avatar answered Nov 19 '25 10:11

Toru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!