I have a system where I have split my functionality into several different packages. Currently I am calling functions and procedures using the dot notation of packagename.object
Some of my package names (due to company coding standards) are fairly long
Can I create an alias/synonym for the package to shorten my code?
ie: instead of pkge_member_utilities.CreateMember, I could create a synonym/alias 'util' for the package and then use util.CreateMember throughout my code
I have read up on the documentation for CREATE SYNONYM but it is confusing as it seems to be used against an execute immediate whereas I want to to reference the synonym in my code
Again, apologies for the vague terminology as I'm coming at this from a Java background
Many thanks for your time
Mike
Although I agree with comments above, that largely this is an effort to defeat standards. However, sometimes standards are horrible, and as long as there are suitable unit tests, in the right situation, what is the harm?
create or replace package long_package_name as
function give_me_zero return number;
end;
/
create or replace package body long_package_name as
function give_me_zero return number is begin return 0; end;
end;
/
create or replace synonym pkg for long_package_name;
-- either works the same
select long_package_name.give_me_zero from dual;
select pkg.give_me_zero from dual;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With