teradata

General

teradata

DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
 SET p_proc_status= SQLCODE;
END;

when i write this in proc it is show ing error as:SPL1027:E(L74), Missing/Invalid SQL statement'E(3707):Syntax error, expected something like a 'CONTINUE' keyword or an 'EXIT' keyword between the 'declare' keyword and the word 'CDC_CURSOR'.'.

problem : i should write condition such a way that when a procedure is stoped then it should show an exception why it stoped  

1 REPLY
Teradata Employee

Re: teradata

It's not clear what you are asking. Some thoughts:

  • If you simply don't "handle" the exception, it will be propagated back to the caller.
  • If your procedure needs to take some action first, you can handle the exception and either RESIGNAL the original exception or SIGNAL some other exception at the end of the handler.
  • The 3707 error near line 74 seems to be a cursor declaration that is out of sequence (within the same block, cursor declarations should precede any handler declarations).