Skip to content

Hints on function return

Function without RETURN statement

Editor provides errors if the return statement is missing in functions.

Example of Incorrect Code:

FUNCTION Finite_State_Events__ (  
���db_state_ IN VARCHAR2 ) RETURN VARCHAR2  
IS  
BEGIN  
���IF (db_state_ IS NULL) THEN  
������RETURN NULL;  
���ELSIF (db_state_ = 'Invalid') THEN  
������RETURN 'SetValid^';  
���END IF;  
END Finite_State_Events__;  

Example of Correct Code:

FUNCTION Finite_State_Events__ (  
   ���db_state_ IN VARCHAR2 ) RETURN VARCHAR2  
   IS  
   BEGIN  
   ���IF (db_state_ IS NULL) THEN  
   ������RETURN NULL;  
   ���ELSIF (db_state_ = 'Invalid') THEN  
   ������RETURN 'SetValid^';  
   ���END IF;  
������RETURN NULL;  
   END Finite_State_Events__;  

Actions Available:

  1. Add an IgnoreFunctionReturn marker.

Unreachable statement

Editor provides errors for unreachable statements in functions.

Example of Incorrect Code:

FUNCTION Finite_State_Events__ (  
   ���db_state_ IN VARCHAR2 ) RETURN VARCHAR2  
   IS  
   BEGIN  
   ���IF (db_state_ IS NULL) THEN  
   ������RETURN NULL;  
   ���ELSE  
   ������RETURN 'SetValid^';  
   ���END IF;  
������RETURN NULL;  
   END Finite_State_Events__;  

Example of Correct Code:

FUNCTION Finite_State_Events__ (  
   ���db_state_ IN VARCHAR2 ) RETURN VARCHAR2  
   IS  
   BEGIN  
   ���IF (db_state_ IS NULL) THEN  
   ������RETURN NULL;  
   ���ELSIF (db_state_ = 'Invalid') THEN  
   ������RETURN 'SetValid^';  
   ���END IF;  
   END Finite_State_Events__;  

Actions Available:

  • Add an IgnoreUnreachable.