Advertisement
econz

Firebird - Exception com parâmetros

Sep 6th, 2018
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.50 KB | None | 0 0
  1.  
  2. CREATE exception EX_DATA 'O valor @1 não é uma data válida!';
  3.  
  4. CREATE exception EX_VAL_CAMPO 'O Campo @1 não pode receber o valor @2';
  5.  
  6.  
  7. CREATE OR ALTER PROCEDURE SP_TESTE (
  8.    inCodigo INTEGER,
  9.    inData   DATE
  10. )
  11. AS BEGIN
  12.  
  13.    IF (:inData IS NULL) THEN
  14.       exception EX_DATA USING (:inData);
  15.  
  16.    IF (:inData < CURRENT_TIMESTAMP) THEN
  17.       exception EX_VAL_CAMPO USING ('DATA',:inData);
  18.  
  19.    IF (:inCodigo IS NULL) THEN
  20.       exception EX_VAL_CAMPO USING ('CODIGO','NULO');
  21.  
  22. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement