perform an immediate function with parameter out

How to perform a function with parameter in the statement immediately execute?
declare
   vRunFunctie   varchar2(100) := 'startfunction';
   vParmIn1      varchar2(100) := 'AAA';
   vParmIn2      varchar2(100) := 'HHH';
   vParmOut1     number;
   vParmOut2     varchar2(100);
begin
   --
   execute immediate 'select '||vRunFunctie||'('''||vParmIn1||''','''||vParmIn2||''',:vParmOut2) from dual' into vParmOut1 using vParmOut2;
   --
   dbms_output.put_line('vParmOut1['||vParmOut1||']');
   dbms_output.put_line('vParmOut2['||vParmOut2||']');
end;
/
error: ORA-06572 startfunction function has arguments

the statement looks like this in pl/sql:
vParmOut1 := startfunction(vParmIn1, vParmIn2, vParmOut2);
--vParmOut1 := startfunction('AAA', 'HHH', vParmOut2);
Thank you.
L.

Update:
You are not using bind variables with your dynamic code. That is a major mistake and the #1 reason for poor database performance.
It is a fundamental flaw in programming to design a function that includes output parameters. This is simply and plainly wrong.
Output parameters are also not supported by the SQL language - it does not support "procedure" like code units and call methods. 
I know that the function should not have out parameters. But its programmed that way already...

You try something like

declare
   vRunFunctie   varchar2(100) := 'startfunction';
   vParmIn1      varchar2(100) := 'AAA';
   vParmIn2      varchar2(100) := 'HHH';
   vParmOut1     number;
   vParmOut2     varchar2(100);
begin
   --
   execute immediate 'begin :x := ' || vRunFunctie || '( :p1,  :p2, :vParmOut2 ); end;' using out vParmOut1, vParmIn1, vParmIn2, out vParmOut2;
   --
   dbms_output.put_line('vParmOut1['||vParmOut1||']');
   dbms_output.put_line('vParmOut2['||vParmOut2||']');
end;
/ 

Tags: Database

Similar Questions

  • How can I call a function with parameter out of sql

    Hello world
    I'm calling a Sql statement function and I get this error ORA-06572: XX function has arguments.

    can you offer any solution on this workaround.

    Thank you

    Hello

    Sorry, you cannot call functions with OUT arguments (or arguments, but I'll just say in the future) SQL statements.
    This is one of the reasons why many people avoid having arguments in functions.
    THE arguments are never optional. If the function expected of them, you must pass to them.

    Depending on your needs, you can write a Wrapper function that has no arguments.
    For example, if you want to call this function:

    fun1 ( in_out_str      IN OUT  VARCHAR2
         , in_num          IN      NUMBER
         )
    RETURN  NUMBER ...
    

    you don't need really the value changed to in_out_str, then you can write a function like this:

    fun1_wrapper ( in_str          IN      VARCHAR2
                   , in_num          IN      NUMBER
                   )
    RETURN  NUMBER
    IS
        in_str2     VARCHAR2 (32767)  := in_str;
    BEGIN
        RETURN  fun1 ( in_str2
                       , in_num
               );
    END  fun1_wrapper;
    

    You can use fun1_wrapper in a SQL statement, even if you cannot use fun1 in the same statement.

    Published by: Frank Kulash on February 27, 2013 09:42

  • How to perform a function with parameter date as input?

    Hello
    I have a function named fun1 (v_fun in date), including the date as an input parameter, and it returns a number. I created the function successfully. But I couldn't run this function in sqlplus. How to move the dates? Can someone help me in this regard.

    Hello

    V11081985 wrote:
    Hello
    I have a function named fun1 (v_fun in date), including the date as an input parameter, and it returns a number. I created the function successfully. But I couldn't run this function in sqlplus.

    It is difficult for me to say what you're doing wrong when I don't know what you're doing. After a full test script that people can run to recreate the problem and test their ideas. Include a definition of function, CREATE TABLE and INSERT statements for one of your own tables (if necessary) and the results you want from this data, as well as your query.

    How to move the dates? Can someone help me in this regard.

    You can call the function like this:

    SELECT  fun1 (hiredate)  AS fun1_results
    FROM    scott.emp
    ;
    
  • How to perform a function with out parameter dynamically?

    I have a function:

    FUNCTION to CREATE or REPLACE testdyn1 (in_1 NUMBER, OUT out_1)

    RETURN VARCHAR2 IS

    BEGIN

    out_1: = in_1 + to_number (to_char (SYSDATE, 'ss'));

    RETURN ' Ok! ' || TO_CHAR (SYSDATE, 'ss');

    END;


    How to call it dynamically? I did this:

    declare

    number of v_in: = 3;

    number of v_out;

    v_ret varchar2 (100);

    v_st varchar2 (4000);

    Start

    v_st: = ' START: v_ret: = testdyn1 (: v_in,: v_out); END;';

    EXECUTE IMMEDIATE v_st USING v_in, OUT v_out, v_ret;

    dbms_output.put_line ('v_out =' | v_out |) ' / ' || 'v_ret =' | v_ret);

    end;

    I get the error:

    ORA-06536: IN bind variable end to a position

    ORA-06512: at line 8 level

    BluShadow wrote:

    My question would be why on Earth, you call a function dynamically?

    Dynamic SQL is bad enough... but dynamic PL/SQL is just a matter of trouble.

    If an application is designed properly so you know the name of the function and the parameters passed, while there should be no reason to call it dynamically.

    Whenever someone starts mentioning the dynamic code, the first thing that you should always say is "Stop!" What are you trying to do? "and look at why you eventually go that route.

    Good point. But the problem is the client (which is our customer) is instructing us to do. So we can't complain.

    Finally, I was able to do.

    Here is the code:

    FUNCTION to CREATE or REPLACE testdyn1 (in_1 NUMBER, out_1 OUT VARCHAR2)

    IS BACK PLS_INTEGER

    BEGIN

    out_1: = to_char (to_number (in_1) + to_number (to_char (SYSDATE, 'ss')));

    RETURN in_1 | TO_NUMBER (to_char (SYSDATE, 'ss'));

    END;

    ____________________________________

    declare

    v_ret_val pls_integer;

    v_out varchar2 (1000);

    v_stmt varchar2 (4000);

    number of v_in: = 1;

    Start

    v_stmt: = ' START: 1: = testdyn1 (: 2: 3); END;';

    EXECUTE IMMEDIATE v_stmt help to v_ret_val into v_in, at v_out;

    dbms_output.put_line(v_ret_val ||) ' / ' || v_out);

    end;

    126 / 27

    PL/SQL procedure successfully completed

  • Call the PL/SQL procedure with in out parameter of OIC clob

    Hello

    For a few days, I am facing a problem. I have to call the pl/sql procedure with colb parameter out. I use c ++ and OIC (don't ask me why :)).

    I use a pl/sql problem test procedure:

    create or replace function Test (longField outside clob) return number is
    Number of result;
    Start
    longField: = 'prefix ';
    Result: = 12;
    Return (result);
    end Test;

    So I do all the stuff with the connection to the DB,

    I prepare the statement: "start: res: = test(:param); end; »
    So I OCIHandleAlloc (m_pCtx-> hpEnv,
    (void *) & m_hpStatement,.
    OCI_HTYPE_STMT,
    0,
    (NULL);
    and
    OCIStmtPrepare (m_hpStatement,
    m_pCtx-> hpErr,
    (...),
    (...),
    OCI_NTV_SYNTAX,
    OCI_DEFAULT);

    Before the binding I prepare parameters. For a clob I devote to the lob Locator:

    OCIDescriptorAlloc ((dvoid *) m_pCtx-> hpEnv, (dvoid *) & m_pLobLocator,)
    (ub4) OCI_DTYPE_LOB (size_t) 0, (dvoid *) 0);
    OCILobEnableBuffering (m_pCtx-> hpContext, m_pCtx-> hpErr, (OCILobLocator *) m_pLobLocator);

    that I bind parameters using OCIBindByName and OCIStmtExecute statement execution.

    I get an error
    ---------------------------
    Microsoft Visual C++
    ---------------------------
    Unhandled exception in... (ORAOCIEI11. (DLL): 0xC0000005: Access Violation.

    My question is: is it possible to call the pl/sql procedure with parameter BEAK clob?
    If Yes, what steps I need to do to succeed?

    Thank you for your response.

    Hello

    Of course, it is possible :)

    Show that you are your piece of code that is binding.
    Are you sure you had correctly the lob descriptor in the call to bind?

  • Satellite Pro A300 - 1 GR - VGA ports with TV-out function?

    Hello

    Can someone tell me if the VGA port on my Satellite Pro A300-1 (Mobile Intel GMA 4500MHD) is equipped with TV-out function?

    If a single cable is needed to connect with TV's S-video input while a TV-out function is not available, then a relatively expensive converter is necessary?

    Any help will be greatly appreciated.

    Have you checked the user manual?
    What is the manual says?

  • CSXSInterface: Call to jsx-function with a string xml as parameter?

    Hello

    for me CSXSInterface worked very well so far with all the settings and the SyncResults.

    Now, I do a few operations xml with actionscript 3 and photoshop scripts. I am able to return an XML from a function javascript to actionscript3 and do all kinds of operations with it. Somehow, I can't call a function with the string xml as parameter jsx? Does anyone have a solution for this?

    Here is what I tried:

    var xmlStr:String = _myXml.toXMLString(); // I tried _myXml.toString() too but it didnt work either ;-(
    CSXSInterface.instance.evalScript("xmlFunction", xmlStr);
    
    

    Thanks in advance!

    Not for me it isn't...

    I use Flash Builder (with Extension Builder added on) too, and I don't remember having seen a mistake HostObject of any kind. Import you the classes necessary?

    Substances

  • Calling a SQL function which has Out parameters

    Hello people,
    I don't know if it's feasible, but here's my scenrio at hand. I have a database function that accepts a few parameters AND OUTPUT parameters. I want one Out to display in my select statement parameters. Is this possible?

    Thank you

    No you can not use a function with out parameters in sql statements.

    If possible do the function of this return value, use it in select. (imean instead of the parameter, OUT out which parameter through the BACK)

    G.

  • No function with name 'L_FLEX_VALUE_TAB' does exist in this scope

    Hi, need someone to advise,
    when I am compiling this package and I am facing this error message 'No function with name 'L_FLEX_VALUE_TAB' exists in this scope'.
    As I need this l_flex_value_list variable to pass as an out parameter for the procedure.
    
    
    'CREATE OR REPLACE PACKAGE TEST_ITEM_MODEL_INFO_PKG
    AS
    
    TYPE l_flex_value_rec IS RECORD
     ( value_set_name   fnd_flex_value_sets.flex_value_set_name%type,
       internal_name    fnd_flex_values.flex_value%type,
       display_name     fnd_flex_values_tl.description%type);
    TYPE l_flex_value_tab IS TABLE OF l_flex_value_rec INDEX BY BINARY_INTEGER;
    l_flex_value_list l_flex_value_tab;
    
    PROCEDURE get_flexvalue_list_proc
      (
        p_stmodel     IN VARCHAR2 DEFAULT NULL,
        p_item_number IN VARCHAR2 DEFAULT NULL,
        p_item_id     IN NUMBER   DEFAULT NULL,
        l_flex_value_list OUT l_flex_value_tab);
        
    END TEST_ITEM_MODEL_INFO_PKG;
    /
    
    CREATE OR REPLACE PACKAGE BODY TEST_ITEM_MODEL_INFO_PKG
    AS
    
     PROCEDURE get_flexvalue_list_proc
      (
        p_stmodel     IN VARCHAR2 DEFAULT NULL,
        p_item_number IN VARCHAR2 DEFAULT NULL,
        p_item_id     IN NUMBER   DEFAULT NULL,
        l_flex_value_list OUT l_flex_value_tab)
     IS
     l_column_name    VARCHAR2(100);
     l_column_value   VARCHAR2(200);
    
    
    BEGIN
      l_column_name  :=NULL;
      l_column_value :=NULL;
      l_flex_value_list :=l_flex_value_tab();
       ....
       ....
       ....
       FOR i in 1..l_flex_column_list.count LOOP
              FOR l_flex_rec in (SELECT evsvv.value_set_name, evsvv.internal_name, evsvv.display_name
                              FROM ego_value_set_values_v evsvv
                              WHERE evsvv.value_set_name='SEAEGO_CC_FAMILYMODEL_INFO_'||l_flex_column_list(i).column_name
                              AND evsvv.internal_name=l_flex_column_list(i).column_value)
              LOOP
                 l_count:= l_count+1;
                 l_flex_value_list(l_count).value_set_name:=substr(l_flex_rec.value_set_name,28);
                 l_flex_value_list(l_count).internal_name:=l_flex_rec.internal_name;
                 l_flex_value_list(l_count).display_name:=l_flex_rec.display_name;   
              END LOOP;
          END LOOP;
    
     end get_flexvalue_list_proc;
    END TEST_ITEM_MODEL_INFO_PKG;
    /
    show errors

    It is, you cannot initialize an associative array with a constructor. If you convert your array type such as pl/sql (without index) table in package specifications and run your package body, it will run successfully.

    And also I found, that you have declared a variable of type table, which is not necessary. You can have parameter in your procedure of type table, so it was a declaration of useless, I commented.

    Check the code below.

     CREATE OR REPLACE PACKAGE TEST_ITEM_MODEL_INFO_PKG
     AS
     TYPE l_flex_value_rec IS RECORD
      ( value_set_name   number,
        internal_name    number,
        display_name     number);
     TYPE l_flex_value_tab IS TABLE OF l_flex_value_rec;  --------no Index by required
     --l_flex_value_list l_flex_value_tab;
     PROCEDURE get_flexvalue_list_proc
       (
         p_stmodel     IN VARCHAR2 DEFAULT NULL,
         p_item_number IN VARCHAR2 DEFAULT NULL,
         p_item_id     IN NUMBER   DEFAULT NULL,
         l_flex_value_list OUT l_flex_value_tab);
     END TEST_ITEM_MODEL_INFO_PKG;
    /
    
  • Connection of signals (with parameter) in QML.

    Hello

    I want to connect a signal (with parameter) in QML. I have the signal of my PPC and I am able to do that in QML, when I use signals that has no parameters.

    I want to connect to signals which takes the parameter.

    app.mySignal.connect (button.doSomething);

    I do not mySignal() issue, works very well.

    Want to do something like issue mySignal (int) and acess as QML in

    -Thank you

    your signal is:

    mysignal (QString)

    then connect to a function like that (qml)

    myClass.mysignal.connect (onmysignal)

    and:

    function onmysignal (mystring) {}

    Console.log ("my string is:" + mystring)

    }

    If you have several settings, you must be careful with the order and better to use descriptive names, as there is no type in the function definition.

  • How can I change my CS6 Master Collection when the "Update" function is grayed out?

    I bought a used iMac (mid-2009) in 2012/13. It had pre-installed CS6 Master Collection. I thought I was getting updates for the software, but I'm wrong apparently. I have to update the applications to meet the requirements of security and anti-fraud PCI/DSS for my B & B business. If I don't respect I can't use my machine credit card to take payments from customers. In each application, the "Update" function is grayed out, then how can I update the software? Adobe support is the only place where I can get an answer on the Forums. I bought and for more than 20 years of Adobe products used but no serial number doesn't appear in my Adobe ID

    If the software is installed with an opportunity machine that was purchased, the software is not for you unless that seller officially transferred ownership of the procedure defined in the information below.

    Transfer an Adobe product license

    As far as updates go try direct updates
    https://www.Adobe.com/downloads/updates/

  • can perform us two actions with a single button in two clicks, one after the other?

    Mr President.

    can perform us two actions with a single button in two clicks, one after the other?

    I want that when I click on the button Add once it add data to the database and when I click again on this button it clears the form data to the empty fields.

    Concerning

    Tanvir

    In the code, it should be easy.

    The following code adds that a button called butman with text 'ADD '.
    It then registers a listener that will be called if the user clicks the button.

    This listener then calls the runAddData method if you clicked butman while it contained the text of "ADD" and it calls the runClearData method otherwise.
    That's why he will swap the functionality of the button between ADD and CLEAR on each click.

    final Button butman = new Button("ADD");
    butman.setOnAction(new EventHandler() {
              @Override
              public void handle(ActionEvent t) {
                        if (butman.getText().equals("ADD")) {
                                  butman.setText("CLEAR");
                                  runAddData();
                        } else {
                                  butman.setText("ADD");
                                  runClearData();
                        } // END IF-THEN
              }});
    

    I hope that's what you wanted.

    Further reflection.
    You might want to run the ADD and CLEAR methods in their own son so that it can run in the background without slowing down your user interface.

    I also reuse rather a single button for several features instead of to apply with hundreds of nodes used only rarely with masses of code to show and hide as needed.

  • Table return function set IN OUT

    Hello

    I have a function that returns a table
    CREATE OR REPLACE FUNCTION myfunc (
         p_id      number,
         p_cid      number,,
         p_no      number,,
            datearray          IN OUT dates
    )
         RETURN dates
    Function, I have 3 as input parameters and I would do back table as a parameter out. However when I compile I get errors

    How can I set the function to have output as 4th parameter, something like datearray table?

    Thank you

    Published by: ponic on May 28, 2012 18:10

    You validate version. You post type dates statement. You post function code. You post errors. So, how can we answer your question? In any case, here is an example:

    SQL> create or replace
      2    type dates
      3      as table of date
      4  /
    
    Type created.
    
    SQL> CREATE OR REPLACE
      2    FUNCTION myfunc (
      3                     p_id      number,
      4                     p_cid     number,
      5                     p_no      number,
      6                     datearray IN OUT dates
      7                    )
      8      RETURN dates
      9      IS
     10      BEGIN
     11          IF datearray IS NULL
     12            THEN
     13              datearray := dates();
     14          END IF;
     15          datearray.EXTEND;
     16          datearray(1) := sysdate;
     17          datearray.EXTEND;
     18          datearray(2) := sysdate + 1;
     19          datearray.EXTEND;
     20          datearray(3) := sysdate + 2;
     21          RETURN datearray;
     22  END;
     23  /
    
    Function created.
    
    SQL> 
    

    SY.

  • How to set the property to the parameter out

    Hi all
    I want to set a property to the parameter out in the application process.
    If the parameter has value, then I need the column with the value on a page.
    If the parameter out is not having a value, then I need to hide the columns on a page.

    I write the below code for this, but I did not get value and also the column appeared in the Page.

    ' Public Sub processRequest (pageContext OAPageContext, OAWebBean webBean)
    {
    super.processRequest (pageContext, webBean);
    Am = (XxcustdtlsmainAMImpl) pageContext.getApplicationModule (webBean) XxcustdtlsmainAMImpl;

    If (PageContext.GetParameter ("PpcustID")! = null)
    {
    String vpID = pageContext.getParameter ("PpcustID");
    System.out.println ("cust in PR trxn id:" + vpID);
    am.passTocustlinetrxn (vpID);
    }
    If (pageContext.getParameter ("PCustomID")! = null)
    {
    If (PageContext.GetParameter ("PbtchID")! = null)
    {
    If (PageContext.GetParameter ("POrdNum")! = null)
    {
    If (PageContext.GetParameter ("PInvceNum")! = null)
    {
    String vcustoID = pageContext.getParameter ("PCustomID");
    String vOrdNums = pageContext.getParameter ("POrdNum");
    String vInvNum = pageContext.getParameter ("PInvceNum");
    System.out.println ("cust in drill PR id:" + vcustoID);
    am.srchCusttrxnlineupdatedtls (vcustoID);
    OAMessageStyledTextBean mInvBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("InvoiceNum");
    OAMessageStyledTextBean mTextBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("OrderNumber");

    if(mTextBean!=null)
    {
    mTextBean.setText (vOrdNums);
    } else
    {
    mTextBean.setRendered (Boolean.FALSE);
    }

    if(mInvBean!=null)
    {
    mInvBean.setText (vInvNum);
    } else {}
    mInvBean.setRendered (Boolean.FALSE);
    }
    }
    }
    }
    }
    }

    Thank you

    Hello

    Pls make the changes in public relations as given:

    If (pageContext.getParameter ("PCustomID")! = null)
    {
    If (PageContext.GetParameter ("PbtchID")! = null)
    {
    If (PageContext.GetParameter ("POrdNum")! = null)
    {
    If (PageContext.GetParameter ("PInvceNum")! = null)
    {
    String vcustoID = pageContext.getParameter ("PCustomID");
    String vOrdNums = pageContext.getParameter ("POrdNum");
    String vInvNum = pageContext.getParameter ("PInvceNum");

    am.srchCusttrxnlineupdatedtls (vcustoID);

    OAViewObject vo = (OAViewObject) am.findViewObject ("XxcustdrilldownVO1");
    Line row = vo.first ();
    System.out.println ("Hello I'm in spell112");
    row.setAttribute ("HideOrdNum", Boolean.TRUE);
    row.setAttribute ("HideInvNum", Boolean.TRUE);

    OAMessageStyledTextBean mInvBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("InvoiceNum");
    OAMessageStyledTextBean mTextBean = (OAMessageStyledTextBean) webBean.findChildRecursive ("OrderNumber");

    if(mTextBean!=null)
    {
    System.out.println ("I'm in passivation");
    mTextBean.setValue (pageContext, vOrdNums);
    }
    if(mInvBean!=null)
    {
    mInvBean.setValue (pageContext, vInvNum);
    }

    Concerning
    Meher Irk

  • Error: No function with name to_date does exist in this scope

    Hai All

    insert into dail_att(empcode,barcode,intime,attend_date)

    (select r1.barcode, to_date (to_char (r1.bardate, 'ddmmyyyy'): min (r1.bartime), 'ddmmyyyy hh24mi'),)
    R1.bardate of the r1.barcode temp_attendance group, r1.bardat);

    It is my statement to insert

    Here I insert data Dail_att the table Temp_attendance and here R1 is the folder that I stated.

    It works very well. More I need to add a column in the Insert EMPCODE IE and I need to

    take Empl_barcode.

    Table of Empl_barcode consist of fields

    Empcode tank

    Barcode varchar

    Etc.

    So I need to include empcode in this statement when I use this in my insert statement


    insert into dail_att(empcode,barcode,intime,attend_date)
    (selecte.emplcode, r1.barcode, to_date (to_char (r1.bardate, 'ddmmyyyy'): min (r1.bartime), 'ddmmyyyy hh24mi'),)

    Temp_attendance R1.bardate, e empl_barcode, where e.barcode = r1.barcode group by

    R1. Barcode, R1.bardate, e.emplcode);


    I got an error

    No function with name to_date does exist in the scope



    Any help is highly appericatable


    Thanks and greetings

    Srikkanth.M

    Published by: Srikkanth.M on April 24, 2010 09:26

    Dear Srikkanth,
    First of all, in the table / column you provided and that the corresponding query names there are a large number of spelling errors or incompatibilities. It is very important that you make sure that your question is consistent.

    We have 'trying to figure out' if Bar_code is anme name or a table column, whence the emplcode column etc.
    Take the time to write the question and format, please.
    Frame queries and code in a pair of tags {code} without spaces.

    That said...

    update dail_att set empcode=(select emplcode
    from empl_barcode ,dail_att where bar_Code= barcode);
    
    And i have an error
    
    ORA-01427: single-row subquery returns more than one row 
    

    Let us think about this...
    The subquery in your update statement (which is the main request) is

    (select emplcode
    from empl_barcode ,dail_att where bar_Code= barcode)
    

    In this query, you want to join empl_barcode table and dail_att on * bar_code = barcode) condition.

    Why must you table dial_att in the subquery? You do not have.
    Remove dail_att the subquery table.

    VR
    Sudhakar B.

Maybe you are looking for