Hi All,
I just want to clarify one development practice.
Is it a good practice to define thousands of CONSTANT at package level to define the error number which is stored in a table.
CREATE PACKAG _public_pkg IS
my_constant1 CONSTANT INTEGER := 999;
my_constant2 CONSTANT INTEGER := 998;
Then you this constant in individual function to return the error number then one common function will be called to read the error message from the table base on the number and display the message.
My suggation is that
create package abc_public_pkg is
Function f1 return number ;
end;
create package body abc_public_pkg is
Function f1 return number
as
begin
if 1!=2 then
return 999;
else
return 998;
end if ;
END;
END;
end;
Other people
create package abc_public_pkg is
c1 CONSTANT INTEGER := 1;
...
c999 CONSTANT INTEGER := 999;
c998 CONSTANT INTEGER := 998;
-- more than 1000 error messages are there and it will grow.
end;
create package body abc_public_pkg is
Function f1 return number
as
begin
if 1!=2 then
return c999;
else
return c998;
end if ;
end;
END;