SQL Call - Static Method

Hello All:
I am trying to run a sample code from the Oracle8i doc 'Hello
World'. The program compiled and used 'loadjava' to load to the
database.
When I tried to create SQL Call Function from SQL*Plus, I am
getting the error:
PLS-00103: Encountered the symbol "MYSTRING"
This is the sample code trying to run from SQL*Plus:
create or replace function HELLOWORLD return VARCHAR2 as
language java name 'Hello.world() return java.lang.String';
myString varchar2;
call HELLOWORLD() into :myString;
print myString;
Any help is appreciated.
Thanks,
Krishna.
null

Technically, you cannot call a method in the background mode, however you can call its content in the background, just transfer the content of the method to a parameterised report-type program and use SUBMIT VIA JOB statement.
class=>run_in_background( parameters ... ).
METHOD run_in_background.
  SUBMIT zrun_in_background ... VIA JOB...
ENDMETHOD.

Similar Messages

  • Export Internal table by calling static method

    Hi friends,
    Can u please tell me how to get internal table in export parameter by calling static method.
    OR  can u tell me how to declare internal table in method parameter.
    Thanks in advance

    Raja's method will work for all tables irrespective of the structure and is the best possible approach.  However, if your requirement is simple and you do not have to deal with a lot many tables,
    1. Create a Type-Pool, suppose ztypl
    2. Within the type pool, declare a Structure type,
    TYPES: BEGIN OF ztypl_struct1,
             "Place your fields here
           END OF ztypl_strict1,
           "Create a table of type ztypl_struct1 here
           ztypl_table1 TYPE TABLE OF ztypl_struct1.
    Use "ZTYPL_TABLE1" as the "Associated type" in your method's Parameter definition in SE24.
    eg.
    IT_TABLE      TYPE     ZTYPL_TABLE1
    If you are writing your class in an include,
        METHODS my_method1
          IMPORTING
            it_table1   TYPE ztypl_table1.
    Do remember to include
    TYPE-POOLS: ztypl.
    in your class's Constructor / Include program.
    Please award points if helpful.
    Regards,
    Ryan
    Message was edited by:
            Ryan Cannel

  • JUNIT : how to call static methods through mock objects.

    Hi,
    I am writing unit test cases for an action class. The method which i want to test calls one static method of a helper class. Though I create mock of that helper class, but I am not able to call the static methods through the mock object as the methods are static. So the control of my test case goes to that static method and again that static method calls two or more different static methods. So by this I am testing the entire flow instead of testing the unit of code of the action class. So it can't be called as unit test ?
    Can any one suggest me that how can I call static methods through mock objects.

    The OP's problem is that the object under test calls a static method of a helper class, for which he wants to provide a mock class
    Hence, he must break the code under test to call the mock class instead of the regular helper class (because static methods are not polymorphic)
    that wouldn't have happened if this helper class had been coded to interfaces rather than static methods
    instead of :
    public class Helper() {
        public static void getSomeHelp();
    public class MockHelper() {
        public static void getSomeHelp();
    }do :
    public class ClassUnderTest {
        private Helper helper;
        public void methodUnderTest() {  // unchanged
            helper.getSomeHelp();
    public interface Helper {
        public void getSomeHelp();
    public class HelperImpl implements Helper {
        public void getSomeHelp() {
            // actual implementation
    public class MockHelper implements Helper {
        public void getSomeHelp() {
            // mock implementation
    }

  • Compilation error while calling static method from another class

    Hi,
    I am new to Java Programming. I have written two class files Dummy1 and Dummy2.java in the same package Test.
    In Dummy1.java I have declared a static final variable and a static method as you can see it below.
    package Test;
    import java.io.*;
    public class Dummy1
    public static final int var1= 10;
    public static int varDisp(int var2)
    return(var1+var2);
    This is program is compiling fine.
    I have called the static method varDisp from the class Dummy2 and it is as follows
    package Test;
    import java.io.*;
    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    and when i compile Dummy2.java, there is a compilation error <identifier > expected.
    Please help me in this program.

    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    }test+=Dummy1.varDisplay(var3);
    must be in a method, it cannot just be out somewhere in the class!

  • Help on calling static method in a multithreaded environment

    Hi,
    I have a basic question.. pls help and it is urgent.. plss
    I have a class with a static method which does nothing other than just writing the message passed to a file. Now i have to call this static method from many threads..
    What actually happens ???
    Does all the thread start to execute the static method or one method executes while the other threads wait for the current thread to complete execution?. I am not talking about synchronizing the threads...my question is what happens when multiple threads call a static method??
    Pls reply.. I need to design my project accordingly..
    Thanks
    Rajeev

    HI Omar,
    My doubt is just this..
    I wanted to know what might happen if two threads try to access a static method.. Logically only one thread can use the method since it is only only copy... but i was wondering what might happens if f threads try to access the same static method.. My Situation is this.. I have a cache which is just a hash table which will be only one copy for the whole application.. No when i get a request I have to check if the id is avaible in the cache. if it is available i call method 1 if not i call method2. Now Ideally the cache should be a static object and the method to check the id in the cache will be a normal instance method..
    I was just wondering what might happen if i make the method static.. If i can make it static i can can save a lot of space by not creating the object each time.. u know what i mean.. That y i wanted to know what happens..
    Rajeev

  • Reflection: how to call static method?

    You can call an instance method for an object via
    Method method = myClass.getDeclaredMethod(mName, mTypes);
    Object value = method.invoke(instance, mValues);But how do you call a static method (that is perhaps in an abstract class)? Is it save to have the instance variable null?

    Is it save [sic] to have the instance variablenull?Please refrain to mock at that, Peter. Even the
    English often confuse "loose" and "lose", don't be
    that critical to foreigners. :-)Is there something wrong? I just serach via google:
    "is it save to" ... results: 800 ...
    Okay, "is it safe to" : 636.000 ... :-)

  • Call static method from jsp expression

    Hi, I'm using adf/bc 10.1.3.4 I'm wanting to call a static method of a class when an af:commandLink is clicked. This action attribute value for this af:commandLink would be an el expression. As an example, let's say I want to call a new static method, named test(), I've added to ADFUtils.
    My af:commandLink looks like this:
    <af:commandLink action="#{ADFUtils.test}" />
    Obviously, this doesn't work. I can describe my actual use case if it would help. For now I'll just say that I don't want to use a managed/backing bean to house this method. How can I create a class to house this method w/o using a managed bean and adding that managed bean reference to the faces-config.xml?? Thanks, James

    thanks for the interest john. i'll explain what it is i'm trying to do. I have two web applications, appA and appB, both running in the same app server instance. The apps are related in the sense that once the user logs in thru an sso mechanism, they can 'bounce' back and forth between applications. Not sure if that info is relevant, but I wanted to include it anyhow.
    We've created a common banner/header jsp that we include in every page of appA and appB. Included in that header jsp is a logout link (af:commandLink), which will need to execute some code when clicked. Here is where the dilemma starts. We don't really want to have to write the code for the logout in a managed/backing bean because although both applications can use that same bean (we have it set up in the repository so that when a checkout/update is done on either appA or appB, each app, utilizing an svn external rule, would get both the banner jsp and the logout code that goes with it), making good use of the reusability concept, we would also have to add a reference to that backing/managed bean in the faces-config.xml of each application in order for it to be instantiated and used by each app. I was hoping to implement a solution which wouldn't require the developer to have to do any 'setup' on an application by application basis to use the header jsp and the code behind the Logout link. I've described a simple scenario, but in reality we'll have multiple applications, which means multiple places (faces-config.xml) where we'd need to add a reference to the managed bean which contains the logout code. It wouldn't be the end of the world for us if we ended up doing it this way, but I just have a feeling like there may be a better way to implement this so that each application's faces-config doesn't need to be touched. Hope my explanation is clear. thanks for any help you can offer.
    Edited by: kcjim on Feb 25, 2009 8:21 AM
    Edited by: kcjim on Feb 25, 2009 8:22 AM

  • Difference between calling static method and not static method?

    Hi,
    Suppose i want to write a util method, and many class might call this method. what is better? writing the method as static method or not static method. what is the difference. what is the advantace in what case?

    writing the method as static method or not static
    method. what is the difference.The difference is the one between static and non-static. Any tutorial or the JLs will clarify the difference, no need to repeat it here.
    what is the advantace in what case?It's usually not like you have much of a choice. If you need access to an instance's attributes, you can't make it static. Otherwise, make it static.

  • Call static method of Acrobat from C#

    I have a C++ static function and I want to invoke that function from C# code (it's a button_click event). I tried to export that function by creating it's DLL, but it doesn't work out. My C++ function looks like this: static ACCB1 void ACCB2 HighlightWord(void *data). Please provide some pointers?

    Thanks for the reply. yes, this code is in Plug-In (C++). But can you please let me know the way or reference to use is in C# (if any), that would be great!
    I tried by creating DLL and tried to expose this function (static ACCB1 void ACCB2 HighlightWord(void *data))  but couldn't succeed. Please let me know.
    Or is there any sample available in Acrobat SDK, then please let me know its place, I can check that one as well.
    Thanks in advance!

  • Why are static methods called with null references,valid ?

    This is my code :
    package inheritance;
    public class inh6{
         public static void method(){
         System.out.println("Called");
         public static void main(String[] args){
              inh6 t4 = null;
         t4.method();
    O/P :
    CalledHere t4 is a null reference and yet we are able to call a method on it,why is null pointerexception not thrown.Why are we able to call static methods using null references ?
    t4 is null means it doesnot refer to any memeory address,hence how is method() called correctly.
    I hope i am clear. :)
    Thank you for your consideration.

    punter wrote:
    jverd wrote:
    Memory addresses have nothing to do with it. I doubt memory addresses are even mentioned once in the JLS.
    By memory address i mean the memory location the reference is pointing to.I know what you mean. But if you think it's relevant, can you show me where in the JLS it says anything about memory locations?
    >
    You can do that because a) t4's type is "reference to inh6" and b) method() is declared static, which means that you don't need an object to call it, just the class. That class comes from the compile time type of t4. The fact that t4 is null at runtime is irrelevant.
    So at compile time the type of t4 is inh6 and hence the method is called.Is it ? Had method() not been static a NullPointerException would have been thrown.Correct.
    With non-static, non-private, non-final methods, which implementation of the method gets called is determined at runtime, buy the class of the object on which it's being called. If any one of those "non"s goes away, then the method is entirely determined at compile time, and in the case of static methods, there's no instance necessary to call the method in the first place.

  • Static method called from a null object reference

    Hello folks,
    Here´s the code:
    public class TestClass {
         public static void main(String[] args) {
              StaticNull _null_ = null;
              _null_.testNull();
    class StaticNull {
         public static void testNull() {
              System.out.println("testNull");
    }I know that a static method belongs to the class, so you don´t need an
    instantiated object of that class to call it. But in the code above, as
    I'm calling the testNull method from a null reference, shouldn't a NullPointerException
    be thrown?
    Best regards,
    Danniel

    sometimes wrote:
    yawmark wrote:
    Calling static methods from a reference variable should be considered a bad practice. Our coding standards prohibit it, and I suspect we're not the only ones.
    ~what are you trying to say? your coding standard encourages what tricks to invoke static methods? i mean other than using a 'reference variable'?I think you are misreading yawmark's comment. He was saying that invoking a static method using a reference variable -- as though the method weren't static:
    var.staticMethod();...is bad practice. His shop's coding standards prohibit it. And that's a common coding style standard. IDE's often warn you of that, right?
    edit: and judging by your reply #7, you and yawmark would bond over a few jars of cold beverages. You seem think with one mind.

  • Calling Java Method on an Object?????

    It is quite clear how to call a method that passes an argument in Express i.e.
    <invoke name='methodName' class='com.waveset.ui.ClassName'>
    <ref>argument</ref>
    </invoke>
    Essentially this is the same as calling
    methodName( argument );
    How is is possible to call a method in a class that operates on the object i.e.
    object.methodName( );
    i.e.
    com.waveset.object.GenericObject has a method called toMap( ) which returns the GenericObject back as a Map.
    A User View is a GenericObject so how do you call a method on the User object i.e.
    <ref>user</ref>.someMethod( ); or user.toMap( ); rather than
    <invoke name='toMap' class='com.waveset.object.GenericObject'>
    <ref>user</ref>
    </invoke>
    This will not work because there is no method called toMap that takes a GenericObject as a argument.
    I can't find any documentation that addresses this issue.

    The invoke tag is handled differently depending on its arguments.
    <invoke name='methodName' class='com.something'>
       <ref>someVariable</ref>
    </invoke>is calling static method methodName on class com.something and passes someVariable as an argument
    If you leave the class name out of the invoke, it calls the method on the first variable within the tag (the object). The remaining variables act as arguments to the method.
    Here's a trivial example. It creates a HashMap and then performs a 'get' on one of its keys (name)
    <invoke name='get'>
        <new class='java.util.HashMap'>
            <map>
                 <s>name</s>
                 <s>Darth Vader</s>
                 <s>type</s>
                 <s>villain</s>
            </map>
        </new>
        <s>name</s>
    </invoke>Here's a more complex example:
    <new class='com.waveset.object.Resource'>
         <invoke name='toXml'>
                <invoke name='getObject' class='com.waveset.ui.FormUtil'>
                       <ref>:display.session</ref>
                       <s>Resource</s>
                       <s>Active Directory Resource Adapter</s>
                </invoke>
         </invoke>
    </new>This calls the static getObject method returns a com.waveset.object.PersistentObject, which in turn has toXML invoked on it (returning a java.lang.String serialized version of the object) which is then used as the argument for constructing a com.waveset.object.Resource object.
    Jason

  • Campaigns with static method

    I have two questions regarding campaign
    1)I have configured campaign for update events of content.
    which will call static method of one class.but when any update occur in repository,exception comes for static method's class not found.
    2)How to avoid stop date in campaign.so that it will run always.
    Can anybody help me on the same

    Since the campaigns run in the enterprise app classloader, anything called by the campaign needs to run in this classloader as well (APP-INF/lib). You could perhaps promote the code you want to call from the campaign from the web-app classloader to the enterprise-app classloader if you want it to be called.
    Code in the enterprise-app classloader (APP-INF/...) can be called by code in the web-app classloader (WEB-INF/...) but not vice-versa. So it shouldn't be an issue to move the code to the ent-app classloader, and it can then be called by both the campaign as well as existing web-app code.
    -Steve

  • Static methods in multi-thread environment.

    Sorry for this silly question, but I have no clue...
    If you're using classes with static methods in a application server environment, would that imply all threads use that same 'one in the jvm' method and would there be a possibility for performance loss?
    Is calling another static method from a static method a good idea in a multi-thread environment, with respect to performance? Somehow I seem to get this java.lang.NoClassDefFoundError. Any ideas? The classes are in the same package. I only get these kind of problems calling static methods from static methods in a multi-thread environmnent. The static methods are pure utility functions and of course do not use class state.
    Thanks for your help.

    Sorry for this question, wasn't thinking straight. I have the answer, won't post question on multiple forums.

  • Do static methods perform better

    Sometimes, especially when refactoring (specifically when doing extract method), I create a method in a class to perform some helpful task or to neatly tuck a chunk of ugly code away somewhere that it can be easily referred to from the "actual" code. This new method doesn't actually directly cause a state change in the object, it just accepts a parameter and returns a value, or similar. In nearly every case this method is private (since it only helps out the class in which it appears).
    I can easily declare these helper methods static, or leave them unstatic. What I'm wondering is if there's any best practice in doing one or the other, whether for performance reasons or otherwise. I'd tend not to make them static because it might imply that the method should be called from a static context or something, but I wondered what others suggest in this regard.
    Thanks.

    I agree with you Dubwai, and in practice will probably
    not use static unless I mean it. But, since the
    methods don't really act on any of the class's
    instance members, I'm also not entirely convinced that
    this does go against the "design" -- because
    whether the method is static or not, it has the exact
    same effect.
    In fact, marking it static might even help make
    it obvious that this method performs no side-effects
    on instance members.
    But again, I think I'll just leave them nonstatic.I'm not saying that you shouldn't make things static. Quite the contrary. I'm saying that things should be static if they are static, meaning they don't change polymorphically or per instance. If this is so, the method should definitely be static.
    Not using instance members is a neccesary condition of being a static method but it is not nearly sufficient. Making a method static means throwing polymorphism out if the door. A method may do nothing but return a static final value but still need to be an instance method if a subclass needs to return a different static final value. If you make a method static and then need to refactor, it can be difficult or impossible to do so, as pointed out above. If you are calling static methods as if they are instance methods, that indicates to me that they probably should just be instance methods.

Maybe you are looking for

  • Unable to run any applications

    HI, Nokia Team, I am using nokia C2-03 Dual Sim mobile but not running find ... when ever i want to play music / to open any images/ to open or apply new themes or to play games/ to run any other applications it always insist to remove data from Gall

  • How to use 902 DB with 9iAS R2

    I am wondering if it is possibleto use the use 9.0.2. DB with 9iAS R2. I have a single machine and do not want 2 seperate database servers. Appreciate any info. Thanks! Bill G...

  • Casting issue

    Hello Forum, I am retrieving records from myslq database to oracle database, in mysql, i have a date field and a time field for each record, in oracle i have a timestamp field, what i am doing is extracting the two mysql fields, then parsing to a jav

  • Ponerle una accion a un boton

    necesito ayuda, tengo un boton y necesito agrgarle un efecto pero sale un mensaje diciendo "No se pueden aplicar acciones a esta seleccion"  que pueo hacer siempre me molesta ese aviso cuando estoy haciendo algun trabajo.

  • Keynote and AW

    Seems that Keynote 08, rather than Pages 08, has many more of the design features I was used to in AW. I don't use templates, just blank pages and I'm finding many easier features than I had in AW. Keynote handling of text is easier and smoother than