Print Thread
How to tell the compiler to distinguish between package name and method name in PL/SQL code
#65859 09/09/24 02:10 PM
Joined: Dec 2005
Posts: 2,015
Roima Denmark
Member
OP Offline
Member
Joined: Dec 2005
Posts: 2,015
Roima Denmark
Note: this is not a question related to PLD, but to the PL/SQL compiler in general. I was thinking since we have some many experienced developers in here, I might get a qualified answer.
So sorry in advance, if this will be regarded as spam.

Here goes:

I have a package PAY with method MY_BILL.

In the same schema, I also have a package MY_BILL with a method named MUST_BE_PAYED (so both a package and a packaged method with the same name, in same schema).

My problem is that I can not call method MY_BILL.MUST_BE_PAYED from within package PAY, as the compiler gives error: PLS-00302: component 'MUST_BE_PAYED' must be declared
The compiler wrongly assumes that MY_BILL is a reference to the method PAY.MY_BILL and not the package method MY_BILL.MUST_BE_PAYED

I know I can force references to e.g. a method variable by prefixing the variable with the method name, but how can I force the compiler to interpret a name as a package name (other than giving either the package or the method different names)? I do not want to prefix the package name with schema name, as our code must be transferable between schemas without changes in code

Re: How to tell the compiler to distinguish between package name and method name in PL/SQL code
Claus Pedersen #65933 09/26/24 04:38 AM
Joined: Feb 2003
Posts: 395
The Netherlands
Member
Offline
Member
Joined: Feb 2003
Posts: 395
The Netherlands
If you fully qualify the procedure it will work, so <schema>.<package>.<procedure> or demo.mybill.mustbepayed.


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.026s Queries: 14 (0.008s) Memory: 2.4997 MB (Peak: 3.0397 MB) Data Comp: Off Server Time: 2024-10-14 10:40:19 UTC
Valid HTML 5 and Valid CSS