How to make a dynamic function call from within a package procedure

Hi:
I need to call a function dynamically (name and parameters determined at run time, but return value is known:always an integer). I can build the call and place it in a dynamic sql using dbms_sql. But the function is inside a package and is not public.
So, if I issue:
dbms_sql.parse( cur,'SELECT '||call||' FROM dual', dbms_sql.v7 )
where call is "DOS(234,'V')"
I get:
ORA-00904: "DOS": invalid identifier
If I make the function ("DOS") public and "call" equals "pack.DOS(234,'V')", it works fine, but I don't want to make it public.
Is there a solution?
Thanks in advance
RuBeck

Hi, Kamal:
Calling from outside of the owner package is not possible if it is not public.The calls are from inside the package. It looks like the dynamic select is executed "outside" the package, so the private function is unknown
Make it available in the package headerLooks like it's the only solution
How often this will be executed?This is a library for loading files into tables and executing dynamic validation procedures.
Here's an example of the mechanics:
create or replace package mypack as
     function one return number ; -- public function
     procedure execute_it( p_name VARCHAR2 ) ;
end ;
create or replace package body mypack as
function one return number is
begin
return 1 ;
end ;
function two( i number, s varchar2 ) return number is -- private function
begin
return 2 ;
end ;
procedure execute_it( p_name VARCHAR2 ) is
select_str VARCHAR2( 1000 ) ;
v_num NUMBER ;
cur NUMBER ;
nf NUMBER ;
begin
select_str := 'SELECT '||p_name||' FROM dual' ;
cur := dbms_sql.open_cursor ;
dbms_sql.parse( cur,select_str,dbms_sql.v7 ) ;
dbms_sql.define_column( cur,1, v_num ) ;
nf := dbms_sql.execute( cur ) ;
IF dbms_sql.fetch_rows( cur ) = 0 THEN
RAISE no_data_found ;
END IF ;
dbms_sql.column_value( cur, 1, v_numero ) ;
dbms_output.put_line( p_name||' returns '||v_num ) ;
dbms_sql.close_cursor( cur ) ;
end ;
end ;
begin
mypack.execute_it( 'mypack.one' ) ; -- Call public function: Works fine
mypack.execute_it( 'two(234,''v'')' ) ; -- Call private function: error 0904
end ;
Thanks for your hints
RuBeck
PS: The indentation is lost when I post the message! I wrote it indented!

Similar Messages

  • Can you make an SSL (https) call from a Java Stored Procedure?

    I have loaded a bunch of java classes. Ultimately, one of my routines makes an
    https call to another machine (https://machine:443/foo?xml...). I am receiving
    the following error message:
    SSL implementation not available
    I read
    http://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_
    id=NOT&p_id=103051.1
    Which states
    3.17.6 You can not do SSL callouts from within 8i to other CORBA or EJBs. This
    also means that you can not callback with an SSL connection a CORBA object
    running in an 8i client.
    Does this mean that I can't do what I am trying to do from within 8.1.7?
    If there is any way to do this, I would really appreciate the advice. I need
    to call this Java API from a pl/sql routine, and it has to be via SSL. I would
    prefer to load all the Java into the database and avoid an exproc call.

    Anton/Joe,
    Yes, you can do this, but it might not be straightforward based on the version of Oracle you have. I've noticed there's a higher chance of getting this to work with 8.1.7 or higher (otherwise, you may need to load more classes, etc.). Mark Piermarini posted a nice example in a previous thread in this group:
    http://osi.oracle.com/~mbpierma/SSL_Java_DB.html
    Basically, he connected to UPS to get package tracking info.
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle_debug.htm
    Debug PL/SQL and Java in the Oracle Database

  • HT204380 How can I make a face time call from one country to another( supporsing both parties using iphone 4s). What will be the caller charges. If there is no charges as we use wifi, will there be a charge till connecting the call?

    How can I make a Face Time call from one country to another( supporsing both parties using iphone 4s). What will be the caller charges. If there is no charges as we use wifi, will there be a charge till connecting the call?

    FaceTime is free to use. You will not be charged for using FaceTime.

  • HT204380 i have a mac book pro and a i-pad 2. both of the devices have the same apple id and same mailing adress. if i want to make a face-time call from my mac book to i-pad 2. how can i do that?

    i have a mac book pro and a i-pad 2. both of the devices have the same apple id and same mailing adress. if i want to make a face-time call from my mac book to i-pad 2. how can i do that?

    You have to add another email address on one of the two devices that you can use as the "You can be reached for FaceTime at" contact address and then remove/uncheck the Apple ID email address as the contact address on that device. The way you are currently setup is like to trying to call yourself on your on phone - from your own phone.
    Using the iPad as the example go to Settings>FaceTime>You can be reached for FaceTime at>Add another email address. Then add a working email address in the next window. Apple will verify the email. Go to the inbox of that email account, read and respond to Apple's email in order to complete the verification process.
    Go back to Settings>FaceTime>Uncheck the Apple ID email address and make sure that the new email address is checked/selected (you will see it being verified again) and that new email address will be your contact address for the iPad.

  • Java function call from Trigger in Oracle

    Moderator edit:
    This post was branched from an eleven-year-old long dead thread
    Java function call from Trigger in Oracle
    @ user 861498,
    For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
    Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
    {end of edit, what follows is their posting}
    I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
    My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
    Trigger:
    CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
    IS LANGUAGE JAVA
    NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
    Java:
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
    // Required class libraries.
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import com.ekahau.common.sdk.*;
    import com.ekahau.engine.sdk.*;
    // Define class.
    public class ThrowAnError {
    // Connect and verify new insert would be a duplicate.
    public static void contactTrigger(Integer memberID) throws Exception {
    String badgeId;
    // Create a Java 5 and Oracle 11g connection.
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    // Create a prepared statement that accepts binding a number.
    PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
    "FROM Users " +
    "WHERE \"User\" = ? ");
    // Bind the local variable to the statement placeholder.
    ps.setInt(1, memberID);
    // Execute query and check if there is a second value.
    ResultSet rs = ps.executeQuery();
    while (rs.next()) {
    badgeId = rs.getString("Note");
    // Clean up resources.
    rs.close();
    ps.close();
    conn.close();
    // davids badge is 105463705637
    EConnection mEngineConnection = new econnection("10.25.10.5",8550);
    mEngineConnection.setUserCredentials("choff", "badge00");
    mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
    mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
    Edited by: rukbat on May 31, 2011 1:12 PM

    To followup on the posting:
    Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
    Having figured that out on my own, I minified my code to just run the one line of code:
    // Required class libraries.
      import java.sql.*;
      import oracle.jdbc.driver.*;
      import com.ekahau.common.sdk.*;
      import com.ekahau.engine.sdk.*;
      // Define class.
      public class ThrowAnError {
         public static void testEkahau(Integer memberID) throws Exception {
         try {
              EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
         } catch (Throwable e) {
              System.out.println("got an error");
              e.printStackTrace();
    }So, after the following:
    SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
    and the following as the user
    SQL> set serveroutput on
    SQL> exec dbms_java.set_output(10000);
    I run the procedure and receive the following message.
    SQL> call java_contact_t4(801);
    got an error
    java.lang.NoClassDefFoundError
         at ThrowAnError.testEkahau(ThrowAnError:13)
    Call completed.
    NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
    Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
    c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
    arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    creating : class com/ekahau/common/sdk/EConnection
    loading : class com/ekahau/common/sdk/EConnection
    creating : class com/ekahau/common/sdk/EErrorCodes
    loading : class com/ekahau/common/sdk/EErrorCodes
    skipping : resource META-INF/MANIFEST.MF
    resolving: class com/ekahau/common/sdk/EConnection
    skipping : class com/ekahau/common/sdk/EErrorCodes
    skipping : class com/ekahau/common/sdk/EException
    skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
    skipping : class com/ekahau/common/sdk/EMsg
    skipping : class com/ekahau/common/sdk/EMsgEncoder
    skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
    skipping : class com/ekahau/common/sdk/EMsgProperty
    resolving: class com/ekahau/engine/sdk/impl/LocationImpl
    skipping : class com/ekahau/engine/sdk/status/IStatusListener
    skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
    Classes Loaded: 114
    Resources Loaded: 1
    Sources Loaded: 0
    Published Interfaces: 0
    Classes generated: 0
    Classes skipped: 0
    Synonyms Created: 0
    Errors: 0
    .... with no explanation.
    Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
    How do i get it to resolve the entire jar file?
    Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:26 AM

  • HOW TO MAKE WORKFLOW DYNAMIC..???

    HI,
    i am working on a workflow in which i have to assign users to a certain role but the problem which i am facing is that firslt all these roles were static i.e. they were hard coded earlier so the new roles which i am making,they are not reflecting in the workflow.
    So can anyone help me as to how to make it dynamic so that the new rles which i am maiking should also start reflecting..

    Calculated field should help -
    see here for more information on this topic,
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/400cc218-ea7f-4f9d-a3eb-c5289bdc05c4/sharepoint-designer-workflow-custom-subject-lines
    http://sharepoint.stackexchange.com/questions/43301/how-to-set-the-subject-of-the-email-to-have-a-combination-of-static-words-and-fi
    http://blog.henryong.com/2008/01/07/custom-sharepoint-designer-subject-lines-with-calculated-fields/
    If the subject is predefined in list, you could try to populate the data from the list using string builder.
    Hope this helps!
    Ram - SharePoint Architect
    Blog - SharePointDeveloper.in
    Please vote or mark your question answered, if my reply helps you

  • How to call a package from within a package

    How would I call a package from within a package and pass variables to it. For instance I am trying to pass variables to a log package from another package when a user inserts or updates a table

    First, technical questions need to be addressed to one of the technical forums. Products | Database | SQL & PL/SQL would be appropriate for this question. Please direct any followup to that forum.
    Second, you cannot call a package; a package is a collection of stored procedures and functions. You can call a packaged function or procedure from another package simply by specifying the package name and the procedure
    CREATE OR REPLACE PACKAGE pkgA
    AS
      PROCEDURE callPkgB;
    END;
    CREATE OR REPLACE PACKAGE BODY pkgA
    AS
      CREATE PROCEDURE callPkgB
      AS
      BEGIN
        pkgB.someProcedure( 'Some argument' );
      END callPkgB;
    END pkgA;In general, any packaged procedure can be called by specifying the schema, package, and procedure name, i.e.
    EXEC mySchema.myPackage.myProcedurethough the schema and package can be omitted if the calling procedure is in the same schema or package.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to make report with access 2010 from SharePoint Discussion lists 2013

    HI,
    I want to make an access report from SharePoint Discussion lists 2013. When i open the list with access, the body of the list is in HTML format in access. Also if i reply something to one subject in the discussion, the reply is not mapped to that subject
    but instead it is shown as a separate entry in the database.
    Anyone can please help?
    SAN
    Santhiya
    Santhiya

    Hi Santhiya,
    I have seen a similar post from you, my understanding is that you wonder that the reply is mapped to the related subject. You can take a look at Daniel's reply in the following thread:
    http://social.technet.microsoft.com/Forums/en-US/dfb5bcb9-0076-412a-b34f-46aa9cfba876/how-to-make-report-with-access-2010-from-sharepoint-discussion-lists-2013?forum=sharepointgeneral
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Execute Oracle Package Function call from FORTE

    Has anyone EVER successfully execute an Oracle Package Function call from FORTE
    via " sql execute procedure "?
    Here's my question, I am able to execute a stored procedure but hasn't figured
    out a way to execute a function which defined in a package. The syntax goes
    like this: sql execute procedure <PackageName>.<FunctionName> ( input
    input_parm, output output_parm). If anyone EVER successfully execute a
    function, please let me know, thanks.

    You'll need to provide a column alias for the function call:
    select func(val) as alias from dual

  • How to make separate/individual text frame from one parent frame in indesign with javascript

    Hi all,
    Please suugest - how to make separate/individual text frame from one parent frame in indesign with javascript.
    Thanks
    Rohit

    @Larry – ah, your interpretation could be the right one…
    May I rephrase the question:
    "How to split threaded text frames to single ones?"
    "SplitStory.jsx" or "BreakFrame.jsx" under Scripts/Samples indeed could be the answer.
    From the comments in the code of "BreakFrame.jsx":
    //Removes the selected text frame (or text frames) from the
    //story containing the text frame and removes the text contained
    //by the text frame from the story.
    //If you want to split *all* of the text fames in the story, use the
    //SplitStory.jsx script.
    Uwe

  • How to make a dynamic text  be SMS by fl2.1

    Now ,I know use " getURL("sms:"+telnumber) "to send sms to a
    specified no.,but how to make a dynamic text be the sms content.?
    Many thx!:

    Ciao,
    this should work:
    smstxt = "ciao, happy holidays";
    telnum = "1234567890";
    getURL("sms:"+telnum+"?body="+smstext);
    body is a keyword.
    Alessandro

  • Is it allowed to make a rmi call from within an ejb??

    Hello,
    Am I allowed to make a rmi call from within an ejb such as:
    String host = "localhost";
    RemoteObject ro = (RemoteObject) Naming.lookup("rmi://"+host+"/MonServeur");
    ro.myMethod();
    package pack;
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class MyRemoteObject extends UnicastRemoteObject implements RemoteObject {
        public MyRemoteObject() throws RemoteException {
        public void myMethod() throws RemoteException {
            System.out.println("toto");
        public static void main(String[] args) {
            try {
                RemoteObject ro = new MyRemoteObject();
                Naming.rebind("MonServeur", ro);
            } catch (Exception ex) {
                ex.printStackTrace();
    }Is it allowed by the spec?
    Is it good design?
    Thanks in advance,
    Julien Martin.

    Allowed - yes
    Good design - no, in my opinion.

  • How to make own editor and call it?

    could you please tell me how to make own editor and call it on a clicking of a push button corresponding to an test Item

    In the Object Navigator... just click on the 'Editor' Node and press the '+' (Create) button....
    Set then any properties as you like....
    So simple...
    Greetings,
    Sim

  • How to make a pattern in illustrator from a placed image ?

    how to make a pattern in illustrator from a placed image ?

    Just embed the image and make a swatch of it.

  • I can't seem to make n actual phone call from my phone.  I dial the number, and at the other end it rings, and the person knows it is me trying to call... but on my end of the phone is nothing at all.  Why is that?

    I can't seem to make an actual phone call from my iPhone 4S.  I dial the number, and the phone at the other end rings.  But at my end there is nothing.  No ringing.  No person trying to talk to me.  What is causing this problem?  I have got all of the current updates loaded to my phone.

    My brother had a similar problem and he went to the Apple store and they gave him a new one under warrenty...she said something about the arial, I would give it a go.

Maybe you are looking for

  • Multiple RFC calls in one LUW

    Hi Guys, Is it possible to do multiple RFC(receiver) calls in a single LUW(Logical Unit ofWork) in PI 7.0?? If yes, can any1 pls tell me from which SP level has this been enabled??Also what settings do i need to do to create the scenario?? Thanks Var

  • Mapping Lookup for Update/Insert

    Hi XI guru, We're using the Mapping-Lookup-feature for select-statements - it works very fine. If we use an insert- or update-statement instead, we get an exception. String Query1 = " "; Channel channel = null; DataBaseAccessor accessor = null; DataB

  • Webflow doesn't work with Portal 7.0

    Hi, there We are migrating from Portal 4.0 to 7.0. After migration, the webflow which we were using for web application doesn't work anymore. We use datasync app to find that within Master Repository there is no webflow for our web app, but the webfl

  • Question re: 10.5.1

    I noticed this is a part of the update - "Allows password-protected accounts on AirPort Disks to show up on in the Finder's Shared Sidebar". Can someone tell me what this means? Thanks in advance- Message was edited by: belovedjs

  • Reports for Unity 5.x

    I am trying to run subscriber reports (Distribution lists) and it is not showing up in the commserver/reports? I ran one yesterday on an individual DL and it ran and showed up when I ran another it is not showing up. Is there a service I need to rest