How to call function from Merge?

Hello,
I have a cursor with a loop and a Merge.
I need to call a package function from Merge instead of direct Insert.
Is is possible?
Instead of Insert:
FOR c1 in (SELECT EMP_ID..
                FROM..
                WHERE.. )
      Loop
        Merge into EMP em using DUAL
            On (em.EMP_ID = c1.EMP_ID)
            When Not Matched Then
              Insert (EMP_ID..)
              Values (c1.EMP_ID.. );
      End Loop;
I need to call a function to get back a confirmation of insert:
FOR c1 in (SELECT EMP_ID..
                FROM..
                WHERE.. )
      Loop
        Merge into EMP em using DUAL
            On (em.EMP_ID = c1.EMP_ID)
            When Not Matched Then
              v_return := p_util.emp_audit (c1.EMP_ID.. );
      End Loop;
I know that the second sample code is incorrect. it is just to give an idea of what I'm trying to achieve.
Is there a way around it?
What is the correct way to call a function from there?
I am on Apex 4.2
Thank you.

Hi Leons,
I have a cursor with a loop and a Merge.
I need to call a package function from Merge instead of direct Insert.
Is is possible?
    No, merge statement is not meant for it. It is meant for combining multiple DML operations.
    Refer :
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_9016.htm#SQLRF01606 Oracle DB 11g
http://docs.oracle.com/database/121/SQLRF/statements_9016.htm#SQLRF01606 Oracle DB 12c
    You have to change your logic to achieve what you want.
    Hope this helps!
Regards,
Kiran

Similar Messages

  • How to Call Function from SAPSCRIPT

    I want to Call a function from my SAPSCRIPT to get some data and print the same in the form , Can I get an example for this

    Hi Nandan,
    U cannot directly call function from SAPScript... For that u have to create one include in which u need to write the code. Using Perform... EndPerform u can call the same from SAPScript. See the below example
    u need to write this code in SAPScript
    PERFORM formname IN PROGRAM includename
    USING &field1&                                      
    USING &field2&                                      
    CHANGING &field3&                                     
    ENDPERFORM                                               
    Here includename is your include type program.
    u need to write this code in your include type program..
    FORM formname TABLES in_par STRUCTURE itcsy
                            out_par STRUCTURE itcsy.
    data : var1 like field1,
           var2 like field2,
           var3 like field3.
      READ TABLE in_par WITH KEY 'field1'.
      CHECK sy-subrc = 0.
      var1 = in_par-value.
      READ TABLE in_par WITH KEY 'field2'.
      CHECK sy-subrc = 0.
      var2 = in_par-value.
    now u can call corresponding function using local VAR1 and VAR2. Here u can pass N no of USING parameters.
    After processing on VAR3...
      READ TABLE out_par WITH KEY 'field3'.
      out_par-value = VAR3.
      MODIFY out_par INDEX sy-tabix.
    EndForm.
    Here in_par and out_par are the structures which will be used to communicate with SAPScript. And this is the only way as per my view.
    I m sure this code will work fine. Here i have used dummy variables that u need to change as per your requirement. If u have more queries write me back.
    And yes if this works than dont forget to give the points.
    Regards,
    Sagar

  • How to call function from a custom module in a grid?

    I have a module with an advanced data grid in it. One of the columns of this grid has an itemRenderer="myCustom"
    MyCustom is a separate MXML Module. In this module, I have defined a vBox with 2 buttons. In the click event of the button how can I call a custom function that is defined in the parent module? click="myCustomFuction()" doesn't work and I get an 1180 warning . I'm thinking something like click="this.parent.myCustomFunction()" but I don't know the proper syntax.

    I tried your suggestion, but it's not working. Can you figure out what I'm doing wrong?
    <mx:Button name="bLotView" label="View" click="Object(this.owner).MyCustomFunction()"
    This button is contained in a VBox which is contained in it's own module: MyVBox
    In the "parent" MyGrid module I have an AdvancedDataGrid and one of the columns of this grid uses ItemRender="MyVBox"
    If I place a button in the parent MyGrid module (not in the grid), and set it's click to MyCustomFunction() then the function fires. But the function never fires from the MyVBox module's button click which is contained in the grid.
    Does Object(this.owner) refer to the owning module or the owning control? If it refers to the owning control, wouldn't this point to the VBox in the same module, not the owning module? Would I have to do something like Object(this.owner.owner.owner).MyCustomFunction()  ??

  • Call function from data base with clob input parameter.

    Hello,
    In this project I use Jdev 11g.
    I call function from database.
    create or replace function get_fa_list (
    p_fa_id_list in clob
    return sys_refcursor
    is
    vCursor sys_refcursor;
    begin
    put_msg ('begin');
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;
    put_msg ('Save');
    open vCursor for
    select rownum as id, s.*
    from (
    select f.latitude, f.longitude, count (distinct f.res_id) as res_count, count (*) as fa_count, 16711680 as color, res_concat_distinct (f.res_id) as station_list
    from mv_frequency_assignment f, table (SplitClob (p_fa_id_list, ',')) l
    where f.ext_system = 'BI' and
    f.ext_sys_id = l.column_value
    group by f.latitude, f.longitude
    ) s;
    put_msg ('Open and End');
    return vCursor;
    end get_fa_list;
    I use TopLink in ejb.
    i use follow code for call function and get result.
    public List<TmpResPoints> findAllPointsBI(String p_id){
    UnitOfWork uow = getSessionFactory().acquireUnitOfWork();
    uow.beginEarlyTransaction();
    StoredFunctionCall call = new StoredFunctionCall();
    call.setProcedureName("get_fa_list");
    call.useUnnamedCursorOutputAsResultSet();
    ClobDomain c = new ClobDomain(p_id);
    //System.out.println(c.toString());
    call.addNamedArgumentValue("p_fa_id_list", c);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(TmpResPoints.class);
    query.setCall(call);
    List<TmpResPoints> result = (List<TmpResPoints>)uow.executeQuery(query);
    uow.commit();
    uow.release();
    return result;
    But size parameter "p_fa_id_list" is 0. (geting from temp table in Data base). this code in function >>
    if p_fa_id_list is null then
    put_msg ('CLOB is null!');
    else
    put_msg ('size CLOB: ' || dbms_lob.getlength (p_fa_id_list));
    end if;)
    How I can call this function from dataBase and get result?
    thx,
    Demka.

    What is the SQL generated?
    The argument should just be the Clob value (a String) not the domain object.
    Also try addNamedArgument, and then pass the named argument to the query.
    James : http://www.eclipselink.org

  • Send data to ECC table through RFC Call function from SAP B1 via  b1if

    Hi,
    I have created scenario in B1if which triggers from SAP B1, now I have to send this data in to ECC table, so I have created scenario for that with inbound SAP B1, outbound void and in process RFC Call atom is there but I am not getting data in receiver and also how to write xml to send data in RFC function. Function for RFC has configured from ECC end and have access of that function.
    So please help me to send data to ECC table through RFC Call function from SAP B1 (9.0) via b1if
    Thanks

    Solved by my own.

  • How to call function in jar file?

    First, I can't write english well.(I'm korean.. ) sorry about that.
    I have known function in jar file.
    but I don't know how to call function in jar file.
    how can I this work?
    My project and another project are respectively developing D-project with me and other man.
    so i need it. or I can't do this work.
    I will paste other's source code in my source code.
    and then recomplie , build it.. but it is not my wish!
    thanks for reading my sentence.

    If you have a jar file with a class that you wish to use, then you must add the jar file to your class path ($CLASSPATH on unix, linux, etc. and %CLASSPATH% on Windows).
    Then you can use the class normally, just as you would if it were not in the jar.
    If you meant something else, you'll need to explain what you meant.

  • HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM

    PLEASE ANYONE TELL ME, ABOUT  HOW TO CALL FUNCTION MODULE INSIDE SMARTFORM. IT IS VERY URGENT!!!!!!!!!1

    Hi,
      Under Global Definitions, we have 'Form Routines' tab. Under this tab, u can have a dynamic subroutine call. With in FORM and ENDFORM, you can call the Function Module.With in the Program Lines editor, u can define the subroutine........PERFORM. 
    If helpful, reward points.
    Rgds,
    CK

  • Related documents or links on how to call webservices from WDJ

    Hi all
    i need documents & links on how to call webservices from Webdynpro for Java.
    if anybody send the documents on sample scenarios on the same then it is the great help to me...
    Thanks
    Sunil

    Hi Sunil,
    May these links help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/frameset.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/64/0e0ffd314e44a593ec8b885a753d30/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/d2/0357425e060d53e10000000a155106/frameset.htm
    and  the below thread to call weservices in java.
    Re: How to call a web service from Java
    Regards,
    Supraja

  • How to call function module from IP

    Hi
    I need to trigger the process chain from the input ready queries in Bex analyzer. I figured out that I need to call RSPC_API_CHAIN_START.
    How do we go about in calling the above function module in IP.
    Thanks in advance
    I

    Hi Matt
    Thanks for your response, it was very productive at the right time as we saw our process chain running indefinetly. With selecting all chars to be changed, it ran just once with no errors.
    what is TA ? I know rsplan- transaction code for the planning modeler.
    Can you tell me how can we call function module in custom exit planning function.
    Where should I embed the code
    CALL FUNCTION 'RSPC_API_CHAIN_START'
                   EXPORTING
                     I_CHAIN             = 'ZPC_CCATOPCA'.
                   I_T_VARIABLES       =
                   I_SYNCHRONOUS       =
                   I_SIMULATE          =
                   I_NOPLAN            =
                 IMPORTING
                   E_LOGID             =
                 EXCEPTIONS
                   FAILED              = 1
                   OTHERS              = 2
    thanks in advance

  • HOW TO CALL FUNCTION MODULE FROM ABAP4 EDITOR

    HI !
    friends
    I want to call function module from abap 4 editor.
    is there any shortcut key from edit menu through which if give a function module name then  it calls the function automatically?
    points will be awarded.
    Cheers
    troy

    command will be like this
    <b> call function 'YW2_GET_MNW_PERIOD'
            exporting
              w_budat       = v_datum
            importing
              w_period      = i_date-period
              w_period_desc = i_date-p_desc.</b>
    Regards
    prabhu

  • How can I call functions from a SWF loaded in to another SWF?

    Hi there,
    Please excuse my ignorance, I am very new to actionscript and flash.
    I have 2 SWF's - a.swf and b.swf.
    I load b.swf into a.swf with the following code:
    var swfLoader:MovieClipLoader = new MovieClipLoader();
    swfLoader.loadClip("b.swf", container_mc);
    Now in b.swf, I have a function as follows:
    public function sendData(){
      trace("I ran the function!");
    So I have done a lot of reading, from what I can tell I should be able to run the sendData() function from the code in a.swf, by typing:
    container_mc.sendData();
    but its not working. What am I doing wrong?
    Thanks in advance,
    Adam

    Thanks heaps mate, after a bit of trial and error it works! Here is the code that I added:
    var loadingListener:Object = new Object();
    swfLoader.addListener(loadingListener);
    loadingListener.onLoadStart = function(container:MovieClip):Void  {
        trace("The MovieClip "+container+" started loading");
    loadingListener.onLoadInit = function(container:MovieClip):Void
        trace("The MovieClip " + container + " has been initialized");
      container_mc.test();
    Marked your answer as correct :-)
    Thanks again, I really appreciate your help.
    Cheers
    Adam

  • How to call LSMW from a Report program

    Hi,
    I have a requirment of extending vendor master data (Companycode data and Purchasing Organization data ) through Tcode XK02 using LSMW.Also I need to generate an error log file for validating the data from flat file and  must have an export option of the error log file.
    Can you help me how to proceed on this in steps.
    Also pls let me know how to call LSMW transaction through a Report.
    Based on the selection criteria I need to maintain two source structues,one for companycode data and the other for Purchasing Orgnization data for uploading  data thru LSMW.How to do this?
    pls respond ASAP,
    Thanks,
    Nagendra

    Hi,
    create 2 LSMW object (under same project and subproject)..
    one for extended vendor master data for company code data and other for  extended purchase organization data for company code data.
    Now check the radio buttons and based on that populate ur LSMW object.
    Store project
      project = < >.
    Store subproject
      subproj = < >.
    Store object
      object  = '6GSC022_TS3'.
    if r_ccode = 'X'.
    Store object
      object  = < >.
    else.
    Store object
      object  = < >.
    endif.
    Call the function module to display object (LSMW) maintenance screen
      CALL FUNCTION '/SAPDMC/LSM_OBJ_STARTER'
        EXPORTING
          project        = project
          subproj        = subproj
          object         = object
        EXCEPTIONS
          no_such_object = 1
          OTHERS         = 2.
    Generating error log:
    After the checking the field if u think for this u need to generate error message then In the Maintain Field Mapping and Conversion Rules option under the required field write the following code:
    data: v_msgtxt(100) type c.
    message  <msg ID>    <message type>   <message no>
                     with   <var1>  <var2>
                     into v_msgtxt.
    write v_msgtxt.
    Follow the next step in LSMW object till you reach the option  Convert Data.
    After you execute this option you will get the desired message here.
    Regards,
    Joy.

  • How to call Function Module in Selection Screen

    Hi All,
    I have developed one HR Report (Qualification Overview Report: To display all active employees and their Qualifications along with their Proficiency).
    Already it has 3 selection fields on selection screen and now I want one more field on selection screen like Qualification Id.
    But when the end user press F4 it should display the Popup which comes in TCode: PA30 at the time of Creating Qualification.
    I have debugged the Standard Code and searched the Function Module: 'RH_OBJID_REQUEST' which shows Popup which I wanted to show at Selection screen for newly added field.
    So I have to define new field like 'Qualification Id' and want to attach above Function Module so that it will cater my requirement.
    If anybody has worked on this type of requirement then please let me know.
    Thanks,
    Jay.

    Hi Raymond,
    I have written following code:
    s_quali is used in selection screen for Qualification Id.
    SELECT-OPTIONS :  s_quali   FOR hrp1000-objid NO INTERVALS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_quali-low.
      CALL FUNCTION 'RH_OBJID_REQUEST'
        EXPORTING
          plvar           = '01'
          otype           = 'Q'
          seark           = '*'
          seark_begda     = '18000101'
          seark_endda     = '99991231'
          set_mode        = 'X'
        TABLES
          sel_objects     = git_objects.
      LOOP AT git_objects INTO wa_objects.         " Logic is to fill up the Selection screen field
        s_quali-low = wa_objects-objid.
        APPEND s_quali TO s_quali.
        CLEAR : s_quali, wa_objects.
      ENDLOOP.
    Now problem is that, its not populating all values in selection screen which I select from Popup screen (Choose Qualification).
    I checked that the first value in the internal Table is over written by second records in the internal table
    For e.g.: If I select 001,002,003,004 from Popup screen then I am able to see only 002,003,004 in the Multiple selection view of that field though it is available in the internal table s_quali (because I am filling up the table using Loop-Endloop)
    Please advise me how to overcome this issue. (How to fill up selection screen)
    Thanks,
    Jay.

  • How to load function from derived class from dll

    Dear all,
    how to access extra function from derived class.
    for Example
    //==========================MyIShape.h
    class CMyIShape
    public:
    CMyIShape(){};
    virtual ~CMyIShape(){};
    virtual void Fn_DrawMe(){};
    // =========== this is ShapRectangle.dll
    //==========================ShapRectangle .h
    #include "MyIShape.h"
    class DLL_API ShapRectangle :public CMyIShape
    public:
    ShapRectangle(){};
    virtual ~ShapRectangle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_ChangeMe(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapRectangle();
    // return the created function
    return m_Obj;
    // =========== this is ShapCircle .dll
    //==========================ShapCircle .h
    #include "MyIShape.h"
    class DLL_API ShapCircle :public CMyIShape
    public:
    ShapCircle(){};
    virtual ~ShapCircle(){};
    virtual void Fn_DrawMe(){/*something here */};
    virtual void Fn_GetRadious(){/*something here */};
    __declspec (dllexport) CMyIShape* CreateShape()
    // call the constructor of the actual implementation
    CMyIShape * m_Obj = new ShapCircle();
    // return the created function
    return m_Obj;
    in exe there is no include header of of ShapCircle and ShapRectangle 
    and from the exe i use LoadLibrary and GetProcAddress .
    typedef CMyIShape* (*CREATE_OBJECT) ();
    CMyIShape*xCls ;
    //===================== from ShapeCircle.Dll
    pReg=  (CREATE_OBJECT)GetProcAddress (hInst ,"CreateShape");
    xCls = pReg();
    now xCls give all access of base class. but how to get pointer of funciton Fn_GetRadious() or how to get access.
    thanks in advance.

    could you please tell me in detail. why so. or any reference for it. i love to read.
    i don't know this is bad way.. but how? i would like to know.
    I indicated in the second sentence. Classes can be implemented differently by different compilers. For example, the alignment of member variables may differ. Also there is the pitfall that a class may be allocated within the DLL but deallocated in the client
    code. But the allocation/deallocation algorithms may differ across different compilers, and certainly between DEBUG and RELEASE mode. This means that you must ensure that if the DLL is compiled in Visual Studio 2010 / Debug mode, that the client code is also
    compiled in Visual Studio 2010 / Debug mode. Otherwise your program will be subject to mysterious crashes.
    is there any other way to archive same goal?
    Of course. DLL functionality should be exposed as a set of functions that accept and return POD data types. "POD" means "plain-ole-data" such as long, wchar_t*, bool, etc. Don't pass pointers to classes. 
    Obviously classes can be implemented within the DLL but they should be kept completely contained within the DLL. You might, for example, expose a function to allocate a class internally to the DLL and another function that can be called by the client code
    to free the class. And of course you can define other functions that can be used by the client code to indirectly call the class's methods.
    and why i need to give header file of ShapCircle and shapRectangle class, even i am not using in exe too. i though it is enough to give only MyIShape.h so with this any one can make new object.
    Indeed you don't have to, if you only want to call the public properties and methods that are defined within MyIShape.h.

  • How to call functions defined and packed in a .dll file

    hi,
    my client have provided me with a .dll file which implements all functions tasks.
    earlier we created a applications in vb that accessed functions from the .dll file provided by client.
    now he wants java implementation of the same application written in vb.
    now how to access functions in .dll file provided by the client from java source code.
    regards,
    s.mohamed asif

    For this you should write JNI wrappers for the native functions, that is you create class with the native function prototypes as native methods, implement these methods with native functions in JNI module, each JNI function calls a native function from your DLL.
    I know that JNI coding is a greate pain. That is why I am developing Java Platform Invoke which is a paradigm of .NET Platform Invoke. See my demo at
    http://www.sharewareplaza.com/Java-Platform-Invoke-API-Demo-version-download_49212.html

Maybe you are looking for