ora2pg icon indicating copy to clipboard operation
ora2pg copied to clipboard

Support to Oracle custom exception is broken

Open darold opened this issue 6 years ago • 1 comments

Reported by Hafiz, for example:

DECLARE 
   c_id customers.id%type := &cc_id; 
   c_name customerS.Name%type; 
   c_addr customers.address%type;  
   -- user defined exception 
   ex_invalid_id  EXCEPTION; 
BEGIN 
   IF c_id <= 0 THEN 
      RAISE ex_invalid_id; 
   ELSE 
      SELECT  name, address INTO  c_name, c_addr 
      FROM customers 
      WHERE id = c_id;
      DBMS_OUTPUT.PUT_LINE ('Name: '||  c_name);  
      DBMS_OUTPUT.PUT_LINE ('Address: ' || c_addr); 
   END IF; 

EXCEPTION 
   WHEN ex_invalid_id THEN 
      dbms_output.put_line('ID must be greater than zero!'); 
   WHEN no_data_found THEN 
      dbms_output.put_line('No such customer!'); 
   WHEN others THEN 
      dbms_output.put_line('Error!');  
END; 
/

darold avatar Apr 21 '20 13:04 darold

I don't find any problem on user defined exception but I see that code block with DECLARE is not supported. Added it to my todo list.

darold avatar Sep 27 '20 07:09 darold