Can not call a static function with-in a instance of the object.

Another FYI.
I wanted to keep all of the "option" input parameters values for a new object that
i am creating in one place. I thought that the easiest way would be to use a
static function that returns a value; one function for each option value.
I was looking for a way to define "constants" that are not stored in
the persistent data of the object, but could be reference each time
the object is used.
After creating the static functions in both the "type" and "body" components,
I created the method that acutally receives the option input values.
In this method I used a "case" statement. I tested the input parameter
value, which should be one of the option values.
I used a set of "WHEN conditions" that called the same
static functions to get the exact same values that the user should
pass in.
When I try to store this new version, I get the error:
"PLS-00587: a static method cannot be invoked on an instance value"
It points to the first "when statifc_function()" of the case function.
This seems weird!
If I can call the static method from the "type object" without creating
and instance of an object, then why can't I call it within the body
of a method of an instance of the object type?
This doesn't seem appropriate,
unless this implementation of objects is trying to avoid some type
of "recursion"?
If there is some other reason, I can not think of it.
Any ideas?

Sorry for the confusion. Here is the simplest example of what
I want to accomplish.
The anonymous block is a testing of the object type, which definition follows.
declare
test audit_info;
begin
test := audit_info(...);
test.testcall( audit_info.t_EMPLOYER() );
end;
-- * ========================================== * --
create or replace type audit_info as object
( seq_key integer
, static function t_EMPLOYER return varchar2
, member procedure test_call(input_type varchar2)
instantiable
final;
create or replace type body audit_info
as
( id audit_info
static function t_EMPLOYER return varchar2
as
begin
return 'EMPLOYER';
end;
member procedure test_call(input_type varchar2)
as
begin
CASE input_type
WHEN t_EMPLOYER()
select * from dual;
WHEN ...
end case;
end;
end;
The error occurs on the "WHEN t_EMPLOYER()" line. This code is only
an example.
Thanks.

Similar Messages

  • How can I call a static function in another static function?

    /** = d, as a String, using exactly 5 characters.
    Precondition: 0 <= d <= 999.
    The truncated d will have one of the forms: ddd.d, dd.dd, and d.ddd.
    Examples are: 360.1, 29.50, 4.003, 0.001, and 0.000
    public static String truncateTo5(double d) {
    // To get the desired output, do the following
    // 1. If d < 0.001, set d to 0.
    // This prevents d appearing in scientific notation, e.g. 1.5E-6.
    // 2. Convert d to a string s, in the usual way.
    // s is guaranteed to have a decimal point in it a digit before
    // and after the decimal point.
    // 3. Append zeros to s (if necessary) until s has 5 digits.
    // 4. Return s.
    String s= "" + d;
    if (d < 0.001) {
    d= 0;
    return "0.000";
    if (s.length() > 5) {
    return s.substring(0,5);
    if (s.length() == 3) {
    int l= s.length();
    return s.substring(0, l) + "00";
    if (s.length() == 4) {
    int l= s.length();
    return s.substring(0, l) + "0";
    return s;
    /** = d, but rounded (if necessary) to its first 5 characters.
    PreconditionL 0 <= d <= 360.
    E.g. round 1.3546 to 1.355. round 1.3544 to 1.354.
    E.g. round 21.995 to 22.00. round 21.994 to 21.99.
    E.g. round 130.59 to 130.6. round 130.54 to 120.54.
    public static String roundTo5(double d) {
    // Hint. Rounding to an integer j is usually done by
    // truncating the value j + 0.5.
    // E.g. Change 10.6 to 11.1 and truncate to 11
    // E.g. Change 10.4 to 10.9 and truncate to 10
    // You need to do this sort of thing, but what you add may depend
    // on how big d is.
    What I need to do is call the truncateTo5() in the roundTo5() in order for this to work properly but I dont know how. Can someone help?

    @captfoss: If they're static methods in the same class, you don't even need to do that. You can just call the method unquallified.
    @OP: First off, when you paste code, wrap it in code tags. You can find them between Quote and Help.
    As for your error, you have defined truncateTo5() to take a double as an argument. When you call it, you are not passing it a double and you get that error.

  • How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk

    How to log in with my old Apple account? I forgot my pass and I did change my apple ID before canceling first?? I am from Croatia so did folow al the discussion and the to resolve the problem but no luck. Can not call from Croatia the Apple help desk.i did try all the options but I can not find the phone number to call from Croatia,
    I can not change my Apple ID to the old mail (not possible!)
    The old mail don't accept the new password..
    I can not delete the Icloud all the time asking my the password of the old mail!
    I realy need help

    You can not merge accounts.
    Apps are tied to the Apple ID used to download them, you can not transfer them.

  • My iphone is gray or black it is functioning but you can not see the screen so I can not call or text or anything

    My iphone is gray or black it is functioning but you can not see the screen so I can not call or text or anything,  I have a child that is very ill and I have to have access to a phone at all times can someone help me?  It happened one other time when I plugged it in to my to listen to music.  I know it is working it said something on voice control.  I tried the press the circle button and the top button but the screen only turned white?

    Try the following:
    - A reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory settings/new iPod.
    If you still have the problem that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order

  • IOS Cangjie input method can not be used. Original with Space Bar word selection function is invalid, as soon as possible to solve, it will affect the most users in Taiwan and Hong Kong.

    iOS Cangjie input method can not be used. Original with Space Bar word selection function is invalid, as soon as possible to solve, it will affect the most users in Taiwan and Hong Kong.

    No PR1.2 Firmware update, No update for Nokia Messaging, No updates for Ovi Maps .... Why is the N900 the forgotten stepchild ?
    "PR1.2 is still being tested - http://twitter.com/luovanto/statuses/13087245356"
    Hong Kong Launch http://www.youtube.com/watch?v=pY8zCBzvQLo

  • Why not to use static methods - with example

    Hi Everyone,
    I'd like to continue the below thread about "why not to use static methods"
    Why not to use static methods
    with a concrete example.
    In my small application I need to be able to send keystrokes. (java.awt.Robot class is used for this)
    I created the following class for these "operations" with static methods:
    public class KeyboardInput {
         private static Robot r;
         static {
              try {
                   r = new Robot();
              } catch (AWTException e) {
                   throw new RuntimeException(e + "Robot couldn't be initialized.");
         public static void wait(int millis){
              r.delay(millis);
         public static void copy() {
              r.keyPress(KeyEvent.VK_CONTROL);
              r.keyPress(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_CONTROL);
         public static void altTab() {
              r.keyPress(KeyEvent.VK_ALT);
              r.keyPress(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_ALT);
                   // more methods like  paste(), tab(), shiftTab(), rightArrow()
    }Do you thinks it is a good solution? How could it be improved? I've seen something about Singleton vs. static methods somewhere. Would it be better to use Singleton?
    Thanks for any comments in advance,
    lemonboston

    maheshguruswamy wrote:
    lemonboston wrote:
    maheshguruswamy wrote:
    I think a singleton might be a better approach for you. Just kill the public constructor and provide a getInstance method to provide lazy initialization.Thanks maheshguruswamy for advising on the steps to create a singleton from this class.
    Could you maybe advise also about why do you say that it would be better to use singleton? What's behind it? Thanks!In short, it seems to me that a single instance of your class will be able to coordinate actions across your entire application. So a singleton should be enough.But that doesn't answer why he should prefer a singleton instead over a bunch of static methods. Functionally the two are almost identical. In both cases there's only one "thing" on which to call methods--either a single instance of the class, or the class itself.
    To answer the question, the main reason to use a Singleton over a classful of static methods is the same reason the drives a lot of non-static vs. static decisions: Polymorphism.
    If you use a Singleton (and and interface), you can do something like this:
    KeyboardInput kbi = get_some_instance_of_some_class_that_implements_KeyboardInput_somehow_maybe_from_a_factory();And then whatever is calling KBI's public methods only has to know that it has an implementor of that interface, without caring which concrete class it is, and you can substitute whatever implementation is appropriate in a given context. If you don't need to do that, then the static method approach is probably sufficient.
    There are other reasons that may suggest a Singleton--serialization, persistence, use as a JavaBean pop to mind--but they're less common and less compelling in my experience.
    And finally, if this thing maintains any state between method calls, although you can handle that with static member variables, it's more in keeping with the OO paradigm to make them non-static fields of an instance of that class.

  • Can we call a php function into coldfusion coding?????????

    can we call a php function into coldfusion??
    if anybody knows that let me know....

    Nope, as IIS can only pass one page to one handler, so it gets passed to ColdFusion *or* PHP. The only way it would work is to have a page with an iFrame containing a PHP page, but that's not calling a PHP function from ColdFusion.
    Dare I ask what it is you're trying to achieve exactly? If it's an extremely complicated function that can't possibly be rewritten, you'd probably want to wrap it up in a webservice and call it from CF.

  • Why button can not call its script?

    I did very simple work: open Director MX 2004, click the
    button icon on the Tool Palette, and draw a button on the stage.
    Right click it and menu appear. Click "Scripts..." and script
    window opens. MouseUp() event function is there already. Write
    something in mouseUp(). Anything is OK. Put a breakpoint on some
    line.
    OK, then click menu Control-Play to run the movie. Click the
    button on stage. At this time, it ought to be broken on the
    breakpoint. But it didn't. The mouseUp() was not called!
    On the other hand, other controls are OK, such as Text,
    Shape, etc.. Only botton can not call its script. Is it a bug of
    Director MX 2004?

    It may be that you're creating flash component buttons. Try
    setting the tool palette to 'classic' mode (the dropdown at the top
    of the tool palette). The buttons you create once you've done this
    will be native director buttons.
    I've not really used flash component elements much at all so
    I can't offer advice as to why the mouseup isn't working with it.
    - Ben

  • Blackberry 8520 I can not call or write sms

    I can not call or write sms, mobile network signal and my phone shows sim card is fine in another phone works

    Hi and Welcome to the Community!
    Is it possible that your BB remains locked to another carrier? If so, that would explain this behavior...refer:
    http://supportforums.blackberry.com/t5/General-BlackBerry-Functions-and/Unlocking-your-BlackBerry-Gu...
    Otherwise, your SIM could be incompatible with your BB...for which you would need to talk to your SIM provider.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How can I call a plsql function from an attribute?

    I have an attribute defined in an element. I want execute a PLSQL function from the attribute, and display the returne value with an HTML template.
    I've defined the attribute's type like PLSQL, and I've put the called of the function in the value of the attribute, but it doesn't work. The only value I obtain is an URL (I think that is the URL of the function or someting like this).
    How can I call to my function from the attribute and display the returnes value in the page?
    Thanks.

    Thanks, but it doesn't work. I have an attribute called ID_BOL and I want to associate a sequence to that attribute. I've created a function, with the sequence. This function return de value of the sequence. I want taht the attribute takes the value of the sequenece dinamically.
    I've tried it, creating the type attribute like PLSQL, and calling the function from the attribute, but it doesn't work.
    How can I return the sequence value to my attribute?
    Thanks.

  • *Can we call a Standard Function Module inside a Zfunction module ?*

    Can anyone please help me know whether we can call a Standard Function Module inside a Zfunction module ?
    I tried the same (No syntax error) BUT when i activate the zFunction Module it throws the error:-
    +'' REPORT/PROGRAM statement missing, or program type is INCLUDE. " +

    Yes, I got the Answer -
    We Can we call a Standard Function Module inside a Zfunction module.
    But we need to make sure that the Function Groups are activated.
    FUNCTION ZFM_TEST_NESTED_FM.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(EX_CONVERT_UPPER_CASE) TYPE  STRING
    CALL FUNCTION 'TERM_TRANSLATE_TO_UPPER_CASE'
      EXPORTING
      LANGU                     = SY-LANGU
        TEXT                         = 'gaurav'
    IMPORTING
        TEXT_UC                   = EX_CONVERT_UPPER_CASE
    EXCEPTIONS
       NO_LOCALE_AVAILABLE       = 1
       OTHERS                                    = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFUNCTION.

  • TS3367 I can call my friend threw her face time, but she can not call me.

    My face time is able to call all my friends threw their face time.
    But when it comes to one of my friends, she can not call me or message me threw face time, she can't call anyone threw face time.
    I can't seem to figure out how to get hers to be able to call me.
    This is threw our I touch.
    Can someone help?
    Kristina

    shania11lp wrote:
    it didn't give me an i touch option
    Probably because there is no such thing as "i touch".
    It is iPod touch and the troubleshooting does call it out.
    "If you encounter an issue making or receiving a FaceTime call, verify you have the following:
    iPhone 4 or later, iPad 2 or later, or iPod touch (4th generation), with the latest available version of iOS."

  • IPhone5 iOS8.02 can not call

    Hi
    I updated yesterday to iOS8.02 on my iPhone5 and can not call anyone.
    It is the same with my work telephone iPhone4S. Updated yesterday to iOS8.02 and it do not work to call on.
    No difference if a press a new number or use old contacts in my contact list.
    The time to dial is mostly long and ends with call failed (in Swedish: - samtalet misslyckades)
    Any proposals?
    Christer___________________________

    New information on this issue:
    Both telephones uses the same telephone providing  company and when I changed location all worked well.
    A bit unlikely that the provider had a issue just after I updated to iOS8.02.
    So I was fooled by a telepohone company antenna problem at my location.
    Sorry.
    Christer

  • N73 - Can not call contacts

    Sometimes I cant call my contacts or the caller log. This error have followed me through all the firmware upgrades, but it is still the same.
    The error occurs from time to time and nothing happens when I press the green button. When I open caller log I can see all numbers but nothing happens when I press green. Same happens with contact list. I can open contacts, open details, but when I press "voicecall" nothing happens.
    I can dial number manually and then call them. I can also send messages to contacts, but I can not call them in other ways than pres the number manually
    The only thing that helps is a reboot.
    Does anyone have any experience with this?

    faizalajith wrote:
    In N73 a major problem or error occurs it is "*u cant dial contact in ur phone directly*" but manually u can dial by entering the whole number.
    There no fix till now only option was *switch off & on*.. which is still annoying..
    i have noticed
    *v home* software is a fix for it
    only use v home screen to dial number.
    Settings in Vhome for
    "dial contact by name" is
    >settings>smart dialling>name alone.
    Still u dont want to switch off the phone every time go 4 vhome....
    Download Here
    gallery.mobile9.com/f/2507590/
    Hi,
    Welcome to the forum!
    Try to perform the restore factory settings. Note that your files won't be deleted. To do this, go to Tools and then Settings. Select General and then Orig. phone settings. Enter the security code or the lock code. The default code is 12345 unless you changed it. If that didn't work, it's best to have your phone physically checked at the Nokia Care Point. They'll be able to help you with your concern. Note that charges may apply for the out of warranty phone.
    You can visit this link for your local support page for further assistance: www.nokia.com/support

  • Can EE Customer service call me on my phone? I can not call to UK from abroad

    URGENT Can EE Customer service call me on my phone?  I can not call to UK from abroad

    Hi ,
    Very sorry this is a public forum no calls can be made.
    How can I help with your query?
    Thanks.

Maybe you are looking for

  • Count Days in month

    Hi Team members, we are working on a budgeting application and stuck on below Research, please assist/advise is there any built-in Function to count Days in a Month which we can use or a work around . Requirement: To calculate budgeted Expenses per m

  • Program not working when transfered to a mobilphone.

    Hi all. I have made a program that should be able to send a message over bluetooth. The program works when I use the simulator, but it cannot find any other devices, when I transfer it to the phone. Does any of you know if there are any special thing

  • Version A of ODS object 0FIAP_O03 does not exist

    I am installing this ODS and when i hit simulate , I am getting this message and only the cube is getting installed and nothing else. Version A of ODS object 0FIAP_O03 does not exist Thanks

  • Group as Choice Section

    Hi, When to use "Group as Choice Section"? I am tryng to hide and show a either Row.Textfiled1 or Row.Textfield2 based on the Binding value. At present I am able to do this using Scrip, and 2 Rows. The XML Structure would be like; <Test>           <N

  • Storage Space occupied by "other"

    Hi, Is there any way to determine what the "other" is? I mean in About This Mac, under Storage, it shows I have almost 20 gigs of unidentified content. Cheers