Dynamic Function Calling

I am attempting to dynamically populate a function at runtime and then have the ability to call this function. Anybody know how this could be done?

What you need is eval(). Unfortunately eval() is not available in AS3, although it is defined in ECMA script standard. (It was in AS1/2.)
Fortunately, there are some very clever people who produced their own implementations I will use D.eval by RIA 1 here. http://www.riaone.com/products/deval/
Let's say you have this XML:
<function name="exampleFunction" arg0="num:int" arg1="str:String" returns="String">return num + str</function>
First you have to convert it to a string in AS3 Function format:
function exampleFunction(num:int, str:String):String{return num + str};
Then evaluate it as Function, and execute it.
import r1.deval.D;
var xml:XML = <function name="exampleFunction" arg0="num:int" arg1="str:String" returns="String">return num + str</function>;
var functionString:String = "function " + xml.@name + "(" + xml.@arg0 + ", " + xml.@arg1 + "):" + xml.@returns + "{" + xml + "};";
var dynamicFunction:Object = D.parseFunctions(functionString);
trace(D.eval("exampleFunction(3, ' spacemen');", null, dynamicFunction));
Traces
3 spacemen

Similar Messages

  • Dynamic function call in Forms PL/SQL [SOLVED]

    I have a 10G form, which has a dropdown list of values. Depending on the value selected, I look up a setup table which will tell me the name of the database package/function to call.
    I then want to call that function with a bind IN parameter and then retrieve the function return value (which is a varchar2 containing message(s) as a stream of text) to display to the user.
    I have searched high and low and cannot find a good example.
    (a) forms_ddl doesn't seem to have the ability
    (b) dbms_sql - some forums/blogs warn away from this due to db version dependencies
    (c) exec_sql seems to be very basic and more aimed at odbc calls, rather than calls to native oracle db functions.
    Here is example pseudo-code of what I am attempting to do on a WHEN-BUTTON-PRESSED trigger
    DECLARE
    v_Param1 VARCHAR2 := 'myInputValue';
    v_FunctionName VARCHAR2 := 'MYDBPKG.MYFUNCTION';
    v_DynamicSQL VARCHAR2;
    v_Result VARCHAR2;
    BEGIN
    v_DynamicSQL := 'BEGIN :v_result:='||v_FunctionName||'('||chr(39)||v_Param1||chr(39)||')'; END';
    Bind v_result variable;
    execute dynamic sql;
    message('the resulting text was <'||v_result||'>');
    END;
    Obviously, my code above has the function name hard-coded, but my real-life code would retrieve this function name from a database table, so I cannot call the function directly in the Forms PL/Sql.
    where the db package/function looks like this:
    create or replace package MYDBPKG as
    function myfunction(I_Param VARCHAR2) return VARCHAR2;
    end mydbpkg;
    Anybody got a good example ?
    Thanks
    Alan
    Edited by: Alan Lawlor on 11-May-2011 09:34

    Alan Lawlor wrote:
    (a) forms_ddl doesn't seem to have the ability
    (b) dbms_sql - some forums/blogs warn away from this due to db version dependencies
    (c) exec_sql seems to be very basic and more aimed at odbc calls, rather than calls to native oracle db functions.you forgot
    (d): don't use dynamic SQL
    As far as I am concerned (from the code I am exposed to) 99,9% of dynamic SQL code is at best used when there is no need for it and at worst it is impemented the most horrific way you can imagine. OK, this is not the entire truth: in 0,4% it is used when there is no need for it, and in the other 0,5% it is used wrong. And in the other 99% it is a combination of both: it is used when there is no need for it plus it is used wrong. So the very best thing you can do is to avoid dynamic SQL.
    but my real-life code would retrieve this function name from a database tablePlease don't do that. This is one of the worst things to do. Forget about the fact that it is a big security hole and most certainly will trash the shared pool of the database and bringing your server down. Most important to developers is that it is a hell of a nightmare to maintain and a lot worse to debug.
    So seriously think about if you want to go down the Dynamic SQL route.
    cheers

  • Dynamic function Call

    Hi,
    I want to search which program is using the FM : FKK_AR_EVENT_0934.
    I tried using Where used List but it says "Possible Dynamic Calls'. How to search for that?
    Thanks,
    Sachin.

    Hi...,
    So as of now there is no program in your system which is using this function module.
    You can test the same by calling the same Fm from your own program,
    activate the program(with activate anyway), Now press where used list for this function module.
    Here you can get your program name.
    Thanks,
    Naveen.I

  • 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!

  • SSDT vs 2013 and Clr function, call a Clr method name dynamically using SQLCMD variables

    Hello,
    My question is this, hopefully this makes sense:
    How could I got about doing this, inside a SQL function, I would like to re-name the Clr method call based on a SQLCMD variable? 
    I have a Clr project to encrypt/decrypt data, there are different method names depending on the deployment types.
    For the definition of a function called dbo.EncryptThis, I would like to use a SQLCMD variable to change the name depending on SQLCMD variables. This works fine in SQL Server Mgmt studio, but VS 2013 fails to recognize the SQLCMD variable and the build fails
    with: "Error
    1
    SQL71521: A method with a matching signature was not found in the loaded assembly.".
    THis code works fine in SQL Server Mgmt Studio, but fails to build in the SSDT project.
    In the SSDT project I have the SQLCMD variable defined and think I have SQLCMD mode enabled, by doing this:
    Right click file > Execution Settings > SQLCMD mode
    CREATE FUNCTION [dbo].[EncryptData]
    (@str NVARCHAR (MAX))
    RETURNS NVARCHAR (MAX)
    AS
    EXTERNAL NAME [CryptoClrAssembly].[LibName].[EncryptData$(MethodName)]
    Is this even possible in SSDT? or would I have to do this in a post-deploy script?

    Hi Kevin,
    Thanks for the info.
    Bummer, so the only other solution I have is to create a post-deploy script to change the function based on a SQLCMD variable or other logic?
    What would be really cool, would be if during the build process the SQLCMD variables would get replaced with the default value to the SQLCMD variable, thus would allow to build the project. Also, during deployment, if someone entered an incorrect method
    from the assembly it would just fail.

  • Is it possible to pass table name as parameter to function calls?

    Let's say I would like to retrieve data from table BSAD, BSID, BSIS, BSAS with the exact same WHERE conditions.
    I.E.
          SELECT SINGLE * FROM bsis
               WHERE bukrs = zbukrs
                 AND belnr = zbelnr
                 AND gjahr = zgjahr
                 AND buzei = bseg-buzei.
          SELECT SINGLE * FROM bsas
               WHERE bukrs = zbukrs
                 AND belnr = zbelnr
                 AND gjahr = zgjahr
                 AND buzei = bseg-buzei.
    Is there a way that I could put them into a function and do something like?
    perform select_table_bsas using 'bsas'.
    perform select_table_bsis using 'bsis'.
    and I should get SELECT * FROM passed from the function calls.
    Thanks.

    Hello,
    You can try something like this
    DATA : LV_DBTAB1 LIKE DD02L-TABNAME.
    DATA : DREF TYPE REF TO DATA.
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE. " used to store dynamic tables
    LV_DBTAB1 = 'MARA'. " in caps
      CREATE DATA DREF TYPE STANDARD TABLE OF (LV_DBTAB1)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
    * chooses only english values
      SELECT * FROM (LV_DBTAB1) INTO TABLE <ITAB> WHERE SPRAS = 'E'.
    here, even the internal table is dynamic, but that can be static if you know the structure for sure

  • 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

  • BAPI function call in Java

    Hi,
    I am trying to make BAPI function call in JAVA. I am using the following libraries for IBM AIX version and the sapjco.jar
    1) librfccm.o
    2) libsapjcorfc.so
    The above 2 libraries are in my java lib path.
    But I get a exception and it is referring to sapjcorfc.dll (which is a windows version) instead of referring to libsapjcorfc.so
    What should I do so that it refers to libsapjcorfc.so and not sapjcorfc.dll
    Error Details:   java.lang.ExceptionInInitializerError: JCO.classInitialize():
    Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
    JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc
    [sapjcorfc (A file or directory in the path name does not exist.)]. java.library.path
    [/usr/java14_64/jre/bin:/usr/java14_64/jre/bin:/usr/java14_64/jre/bin/classic:/usr/java14_64/jre/bin:
    /usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:
    /tmp/sapinst_exe.1081378.1199455057:/usr/sap/DP0/SYS/exe/run:/home/db2inst1/sqllib/lib64:
    /usr/sap/DP0/DVEBMGS42/exe::/usr/lib:/usr/sap/DP0/DVEBMGS42/j2ee/os_libs:/usr/sap/DP0/DVEBMGS42/exe:
    /usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:/usr/lib:/lib:/usr/sap/DP0/SYS/exe/run:
    /home/db2inst1/sqllib/lib64]

    Hi Jawed,
    when  I try it as a stand alone java code on IBM AIX version BAPI connection works and it fetches the roles listed for an user from the ACTIVITYGROUP table.
    The same piece of code bundled in an ear and when deployed in SAP netweaver portal gives different errors. My sapjco.jar is in application lib folder and it is referred in classpath
    first time when i access the application url it gives me
    Error Details: java.lang.ExceptionInInitializerError: JCO.classInitialize():
    Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
    JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc
    http://sapjcorfc (A file or directory in the path name does not exist.). java.library.path
    [/usr/java14_64/jre/bin:/usr/java14_64/jre/bin:/usr/java14_64/jre/bin/classic:/usr/java14_64/jre/bin:
    /usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:
    /tmp/sapinst_exe.1081378.1199455057:/usr/sap/DP0/SYS/exe/run:/home/db2inst1/sqllib/lib64:
    /usr/sap/DP0/DVEBMGS42/exe::/usr/lib:/usr/sap/DP0/DVEBMGS42/j2ee/os_libs:/usr/sap/DP0/DVEBMGS42/exe:
    /usr/sap/DP0/DVEBMGS42/exe:/usr/sap/DP0/DVEBMGS42/exe:/usr/lib:/lib:/usr/sap/DP0/SYS/exe/run:
    /home/db2inst1/sqllib/lib64]
    when i acess the application url next time it gives me
    Application error occurred during request processing.
      Details:   java.lang.NoClassDefFoundError: com.sap.mw.jco.JCO (initialization failure)
    Exception id: [00145EB7604700720000000F000C20FE00047CA4F0EF0615]
    Below is my my javacode - I am calling the method getUserRoles
    package com.mysap.sso;
    import com.sap.mw.jco.*;
    import java.util.ArrayList;
    import java.util.List;
    public class BapiConnection {
         private static JCO.Client mConnection;
         private static JCO.Repository mRepository;
         private static JCO.Function createFunction(String functionName)
                   throws Exception {
              try {
                   IFunctionTemplate ft = mRepository.getFunctionTemplate(functionName
                             .toUpperCase());
                   if (ft == null) {
                        return null;
                   } else {
                        return ft.getFunction();
              } catch (Exception ex) {
                   throw ex;
         public List getUserRoles(String user) {
              JCO.Function function = null;
              JCO.Table activitygroups = null;
              List rolesList = null;
              mConnection = null;
              mRepository = null;
              mConnection = JCO.createClient("300", "INVTRY_SEGMT", "Welcome%1",
                        null, "ade00fe", "22");
              try {
                   //Connect to the WebAS ABAP with the parameters above
                   mConnection.connect();
                   //Create a function repository to be able to build a function
                   mRepository = new JCO.Repository("INVTRY_SEGMT", mConnection);
                   //Get the function
                   function = createFunction("BAPI_USER_GET_DETAIL");
                   //Set the only import parameter
                   function.getImportParameterList().setValue(user, "USERNAME");
                   //Execute the function
                   mConnection.execute(function);
                   //Get the 'ADDRESS' return structure
                   activitygroups = function.getTableParameterList().getTable(
                             "ACTIVITYGROUPS");
                   rolesList = new ArrayList();
                   for (int i = 0; i < activitygroups.getNumRows(); i++, activitygroups
                             .nextRow()) {
                        System.out.println(activitygroups.getString("AGR_NAME"));
                        logger.debug(activitygroups.getString("AGR_NAME"));
                        rolesList.add(activitygroups.getString("AGR_NAME"));
                   mConnection.disconnect();
              } catch (Exception ex) {
                   System.err.println(ex.toString());
              return rolesList;

  • Function Call returning old SQL Query

    Hello All,
    I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. Inside this function, once the SQL is built, I am inserting this SQL into a log table, for logging purpose.
    Note: my function has only one parameter which is a string. This string accepts a name:value pairs with a delimiter which I breakdown inside the function. But this functionality is working fine.
    Issue:
    When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
    </code>
    When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
    </code>
    When I open the logs, I see the SQL being built is the earlier one.
    As a test I closed the session and ran (Age = 20, Gender = F) first. It works fine. When I run a different parameter string, it always mimics the earlier function call.
    Is CACHING in play here. I tried both the following:
    <code> dbms_result_cache.bypass(FALSE);
    dbms_result_cache.flush;
    </code>
    I tried multiple tests, with different parameters and only the first one runs fine and second one copied the earlier. However, when I open two sessions on two different windows it doesn't happen.
    Also, in the Logging table I am capturing the input string as a confirmation, which is coming correctly. But the SQL being build mimics the earlier call.
    I tried to set the variable which hold the SQL Statement to empty (v_sql := '';) at the beginning and also at the end. Still no use.
    Kindly help if I am over looking anything.
    Regards,
    Aj

    Aj09 wrote:
    I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. The LONG data type has been replaced by the LOB data type. Oracle specifically recommends not using the old LONG data type.
    Issue:
    When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
    </code>
    When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
    </code>The tag is ** - not *<code>*.
    Why a pipeline function? Why dynamic SQL? Are you using +DBMS_SQL+ to create the dynamic cursor? If not, why not? Only +DBMS_SQL+ allows dynamic binding in PL/SQL. Without that, your code will burn a lot of additional CPU on hard parsing and trash and fragment Shared Pool memory.
    When I open the logs, I see the SQL being built is the earlier one.
    How do you record the current SQL? Are you using a static variable to capture the SQL statement generated?
    From what you have described - this is yet another horribly flawed approach in all respects. To data modelling. To relational databases. To Oracle. To SQL.
    Reinventing the SQL language for data retrieval as a pipeline function using a funky parameter interface - sorry, I just don't get that. It is an insane approach.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • PL/SQL Javascript Function Call

    Can anyone offer some help on this? I am attempting to get a javascript tool tip to work on an application I am developing. I have developed a line calendar using PL/SQL outputting HTML. When I embed a javascript function into my PL/SQL htp.p function, the javascript appears to go a little crazy. Here is an example of my code:
    "htp.p('<td onMouseover="ddrivetip("Yahoos Site", "yellow", 250)"
    onMouseout="hideddrivetip()">Yahoo</td>')
    I have tried a few iterations, using different javascript, and I always get the same result. The double quotes used in the onMouseover and onMouseout function calls are a result of PL/SQL not liking single quotes. The entire code for the tooltip can be found on dynamic drives page:
    http://www.dynamicdrive.com/dynamicindex5/dhtmltooltip.htm
    The CSS and javascript code is placed as appropriate in the HTML page header. Am I missing something on the htp.p command?
    Message was edited by:
    jason97m
    Message was edited by:
    jason97m

    This post covers it well.
    http://inside-apex.blogspot.com/2007/08/using-tooltips-in-oracle-apex.html
    Good luck.
    Brian

  • Dynamic RFC call

    Hi,
    In a general scenario, all RFC destinations are defined in SM59, and programs call other system, by using the following method.
    Call function 'ABC' destination dest.
    I want to try and make a dynamic call, to another system, without making an SM59 entry.
    Background:
    I have some scheduled programs running on one system, to fetch system related data from different systems and create a report. Thus I do not have to logon to each system and get data myself. For this, I have created RFC destinations on SM59, for all those systems, using my login id and password, and have told in the program to use those RFC destinations. Since I am a dialog user, I fear that someone who has access to SM59, may use my RFC destination to remotely login to the destination system. So, I want to make an RFC call, without specifying the ID/ password in SM59, but through the calling program.
    I know that if I don't give the ID/ password in SM59, the program will prompt for password, upon execution. But that is not I want. I want to specify the ID and password in the calling program selection screen and then execute the program to get the result.
    Thanks,
    Juwin.

    Hi,
    Solved it myself.
    In the program...
    *l_destin = Build a dummy name for destination
    *Use selection screen parameters to create RFC destination
      call function 'RFC_MODIFY_R3_DESTINATION'
        exporting
          destination                = l_destin
          action                     = 'I'
    *....additional parameters.....
    *Call actual RFC function
      call function 'ZABC'
        destination l_destin.
    *Delete the temporary destination
      call function 'RFC_MODIFY_R3_DESTINATION'
        exporting
          destination                = l_destin
          action                     = 'D'
    *....additional parameters.....
    This way, I do not create a RFC destination in SM59, and so others cannot use it. The RFC destination is created only for a split of a second, to faciliate the call.
    Thanks,
    Juwin.

  • Package interpeting function call as variable call

    When I try to compile my package the compiler mistakes the function calls in this collection for variables.:
    type dayonelist IS TABLE OF NUMBER;
    dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
    I get this error message:
    Error(244,35): PLS-00306: wrong number or types of arguments in call to 'WKDAYSMINUSONE'
    Anyone know how I can correct this?

    rthakur-
    I'm a beginner at this and looking for help and not smart comments. I may not have your experience but I have a little more courtesy than you. Here's the package code:
    CREATE OR REPLACE
    package accessreports is
    vc_FirstofMonth DATE;
    vc_CurrentPick date;
    PROCEDURE PICK_DATE
    (p_first_of_month IN DATE);
    PROCEDURE EXEC_REPORTS(p_first_of_month IN DATE);
    PROCEDURE PRODUCTIVITY_INSERT
    (p_first_of_month IN DATE);
    PROCEDURE AVERAGE_BOARDINGS
    (p_first_of_month IN DATE);
    end accessreports;
    CREATE OR REPLACE PACKAGE BODY accessreports IS
    /*Below are all functions that provide variables for calulations and WHERE
    clauses. All functions are at the top of the package for visibility to all procs and
    convenience*/
    FUNCTION curpick RETURN DATE IS p_current_pick DATE;
    BEGIN
    SELECT MAX(pick) AS
    pick
    INTO p_current_pick
    FROM bus_picks;
    RETURN p_current_pick;
    END curpick;
    FUNCTION wkdays(p_first_of_month IN DATE)
    RETURN NUMBER IS p_wk NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(service_date) AS
    wk
    INTO p_wk
    FROM
    (SELECT DISTINCT service_date
    FROM bus_daily_rides
    WHERE to_char(service_date,'MM-YYYY') = to_char(vc_firstofmonth,'MM-YYYY')
    AND day_type = 'W')
    RETURN p_wk;
    END wkdays;
    FUNCTION sadays (p_first_of_month IN DATE)
    RETURN NUMBER IS p_sa NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(service_date) AS
    sa
    INTO p_sa
    FROM
    (SELECT DISTINCT service_date
    FROM bus_daily_rides
    WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'A')
    RETURN p_sa;
    END sadays;
    FUNCTION sudays(p_first_of_month IN DATE)
    RETURN NUMBER IS p_su NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(service_date) AS
    su
    INTO p_su
    FROM
    (SELECT DISTINCT service_date
    FROM bus_daily_rides
    WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'U')
    RETURN p_su;
    END sudays;
    FUNCTION wkdaysminusone(p_first_of_month IN DATE)
    RETURN NUMBER IS p_wkone NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    wkone
    INTO p_wkone
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'W')
    RETURN p_wkone;
    END wkdaysminusone;
    FUNCTION sadaysminusone(p_first_of_month IN DATE)
    RETURN NUMBER IS p_saone NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    saone
    INTO p_saone
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'A')
    RETURN p_saone;
    END sadaysminusone;
    FUNCTION sudaysminusone(p_first_of_month IN DATE)
    RETURN NUMBER IS p_suone NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    suone
    INTO p_suone
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'U')
    RETURN p_suone;
    END sudaysminusone;
    FUNCTION wkdaysminustwo(p_first_of_month IN DATE)
    RETURN NUMBER IS p_wktwo NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    wktwo
    INTO p_wktwo
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_FirstofMonth, 'MM-YYYY')
    AND day_type = 'W')
    RETURN p_wktwo;
    END wkdaysminustwo;
    FUNCTION sadaysminustwo(p_first_of_month IN DATE)
    RETURN NUMBER IS p_satwo NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    satwo
    INTO p_satwo
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'A')
    RETURN p_satwo;
    END sadaysminustwo;
    FUNCTION sudaysminustwo(p_first_of_month IN DATE)
    RETURN NUMBER IS p_sutwo NUMBER;
    BEGIN
    vc_FirstofMonth := p_first_of_month;
    SELECT COUNT(*) AS
    sutwo
    INTO p_sutwo
    FROM
    (SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
    FROM bus_daily_rides
    WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
    AND day_type = 'U')
    RETURN p_sutwo;
    END sudaysminustwo;
    /*PICK_DATE determines if the report being provided takes place during a pick month.*/
    PROCEDURE pick_date(p_first_of_month IN DATE)
    AS
    BEGIN
    vc_firstofmonth := p_first_of_month;
    vc_currentpick := curpick();
    IF to_char(vc_firstofmonth, 'MM-YYYY') <> to_char(vc_currentpick, 'MM-YYYY') THEN
    accessreports.exec_reports(p_first_of_month);
    ELSE
    NULL;
    /*This procedure being built*/
    END IF;
    END pick_date;
    /*EXEC_REPORTS executes the procs below it with two input vars.*/
    PROCEDURE exec_reports(p_first_of_month IN DATE)
    IS
    BEGIN
    accessreports.productivity_insert(p_first_of_month);
    accessreports.average_boardings(p_first_of_month);
    END;
    /*Last two procs use dynamic SQL to rotate through the different day types and
    pls_integer of days for each day type.*/
    PROCEDURE productivity_insert(p_first_of_month DATE)
    AS
    TYPE daylist IS TABLE OF VARCHAR2(1);
    DAYS daylist := daylist('W', 'A', 'U');
    TYPE countlist IS TABLE OF NUMBER;
    counts countlist := countlist(wkdays(), sadays(), sudays());
    BEGIN
    FOR i IN 1 .. 3 LOOP
    EXECUTE IMMEDIATE 'INSERT INTO RFC_BUS' || DAYS(i) || 'PRODUCTIVITY(ROUTE,PPPH)
    SELECT a.route, ((sr05 / sy05)/' || counts(i) || ') AS "RATIO"
    FROM (SELECT route,
    SUM (DECODE (TO_CHAR (pick, "MM-YYYY"),
    to_char(vc_FirstofMonth, "MM-YYYY"), platform_hours, null)) AS sy05
    FROM bus_platformhours
    WHERE day_type =' || DAYS(i) || ' and platform_hours > 0
    GROUP BY route) a,
    (SELECT route,
    SUM (DECODE (TO_CHAR (service_date, "mm-yyyy"),
    to_char(vc_FirstofMonth, "MM-YYYY"), rides, null)) AS sr05
    FROM bush_daily_rides
    WHERE day_type = ' || DAYS(i) || 'GROUP BY route) b
    WHERE a.route = b.route
    ORDER BY a.route
    VALUES(
    p_route,
    p_ratio
    ) USING days(i), counts(i)';
    END LOOP;
    END productivity_insert;
    PROCEDURE average_boardings(p_first_of_month DATE)
    AS
    type daylist IS TABLE OF VARCHAR2(1);
    DAYS daylist := daylist('W', 'A', 'U');
    type countlist IS TABLE OF NUMBER;
    counts countlist := countlist(wkdays(), sadays(), sudays());
    type dayonelist IS TABLE OF NUMBER;
    dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
    type daytwolist IS TABLE OF NUMBER;
    daytwo daytwolist := daytwolist(wkdaysminustwo(), sadaysminustwo(), sudaysminustwo());
    BEGIN
    vc_firstofmonth := p_first_of_month;
    FOR i IN 1 .. 3 LOOP
    EXECUTE IMMEDIATE 'INSERT INTO RFC' || DAYS(i) || 'BUSAVG_RIDES_AND_PROD(ROUTE, THIRD_YEAR, SECOND_YEAR, PRESENT_YEAR,
    PER_DIFF_THIRDTOPRESENT, PER_DIFF_SECONDTOPRESENT, ROUTETWO, PASS_PLAT_HOUR)
    select r.*,
    t2.*
    from (
    select *
    from (select route,
    sum(y04)/' || counts(i) || ' y04,
    sum(y05)/' || dayone(i) || ' y05,
    sum(y06)/' || daytwo(i) || ' y06,
    decode(sum(y04),0,0,(sum(y06)-sum(y04))/sum(y04)*100) Percent_difference_04to06,
    decode(sum(y05),0,0,(sum(y06)-sum(y05))/sum(y05)*100) Percent_difference_05to06
    from (select route,
         decode(to_char(service_date,"yy"),"04",Rides,0) y04,
    decode(to_char(service_date,"yy"),"05",Rides,0) y05,
         decode(to_char(service_date,"yy"),"06",Rides,0) y06
    from bus_daily_rides
    where TO_CHAR(service_date, "YY") IN ("04","05", "06")
    AND TO_CHAR(SERVICE_DATE,"MM")=TO_CHAR(vc_FirstofMonth, "MM")
    AND day_type=' || DAYS(i) || '
    group by route
    WHERE ROWNUM > 0
    ) r,
    ' || DAYS(i) || '"_"Route_productivity t2
    where t2.route = r.route
    VALUES(p_route,
    p_third_year,
    p_second_year,
    p_present_year,
    p_thirdtopresent,
    p_secondtopresent,
    p_routetwo,
    p_ppph) USING counts(i), days(i), daysone(i), daystwo(i)';
    END LOOP;
    END;
    END accessreports;

  • Input data during dynamic vi call

    Hi guys. Is it possible to input data during a dynamic VI call?
    For eg, i have a car.vi When i call this vi dynamically, i want to also input the value turn left or turn right. How do i acheive this in LV?

    hi there
    use a invoke node on the VIs reference and call the "Set control value" method to set values of controls during execution of the dynamic VI. Use "Get control value" to retrieve values from indicators.
    another possible solution would be the usage of a so called LV2 style global a.k.a. FGV (functional global variable). this needs more drawing but is much more efficient and powerful.
    DO NOT use simple global variables.
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • [svn] 3045: Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

    Revision: 3045
    Author: [email protected]
    Date: 2008-08-29 10:59:25 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Fix FB-13900: Expression Evaluator: 'is' and 'as' expressions return 'Target player does not support function calls'
    Ticket Links:
    http://bugs.adobe.com/jira/browse/FB-13900
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/BinaryOp.java
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/PlayerSession.java

  • How to call a C function calling a Java Method from another C function ?

    Hi everyone,
    I'm just starting to learn JNI and my problem is that I don't know if it is possible to call a C function calling a Java Method (or doing anything else with JNI) from another C function.
    In fact, after receiving datas in a socket made by a C function, I would like to create a class instance (and I don't know how to do it too ; ) ) and init this instance with the strings I received in the socket.
    Is all that possible ?
    Thank you very much for your help !

    Hard to understand the question, but by most interpretations the answer is going to be yes.
    You do of course understand that JNI is the "API" that sits between Java and C and that every call between the two must go through that. You can't call it directly.

Maybe you are looking for