Dans mon code, je saisis le salaire qui n'est pas disponible dans la table des employés, puis j'insère le doublet employee_id dans la colonne clé primaire de la table employee dans le bloc d'exception où je gère l'exception No data found
fin aussi?L'exception No_data_found se propage également au bloc externe?
SORTIE venir:
Enter some other sal
ORA-01400: cannot insert NULL into ("SCOTT"."EMPLOYEES"."LAST_NAME")
ORA-01403: no data found --This should not come according to logic
Voici le code:
DECLARE
v_sal number:=&p_sal;
v_num number;
BEGIN
BEGIN
select salary INTO v_num from employees where salary=v_sal;
EXCEPTION
WHEN no_data_found THEN
DBMS_OUTPUT.PUT_LINE('Enter some other sal');
INSERT INTO employees (employee_id)values(100) ;
END;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(sqlerrm);
END;
Techniquement, votre exception d'origine n'a pas été traitée, elle a jeté une autre exception. Cela me semble un comportement attendu. – David