Call the stored procedure, and bind parameters by name

Hello

I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:

CALL procedure-name ('STRING', 'Timestamp as String', numValue1);

It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:

Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.

So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:

call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).


Thank you for your help.

Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.

Thanks for reading and looking for an answer.

Tags: Database

Similar Questions

  • two related issues: to call the stored procedure and passing in an array of elements using htmldb_Get

    I need to save items of ApEx generated dynamically via AJAX.  I use the APEX_ITEM API to generate the elements.  At runtime, I have no idea how much of elements are generated on the page, but I know that they're all separate and discreet 'name' attributes, i.e. f01, f02, f03, etc..  As a basic example, if I have to generate a selection list, I know that the parameter "p_idx" of the APEX_ITEM call is to say '3', so select all lists that get generated have a "name" attribute in "f03" DOM, all text elements will be "f01", etc.

    I want to record these data in the database using AJAX.  It is common to call the javascript htmldb_Get function that is standard for the use of an application process, but I am interested in the use of the rarely called upon 'internal' and queryString"options of this javascript function so that I can build the query string to the fly according to what is on the DOM when it tries to save the data they have entered into these items generated by APEX_ITEM.  Someone at - there are good examples of the use of the 'procedure' and 'queryString' the javascript htmldb_Get function parameters?

    I have found a handful of some blogs, messages, etc. online linked to this, but just for most people regurgitate the documentation.  I found this post (https://forums.oracle.com/thread/2549237), which has had a glimpse of hope to move from a table (which is something I need) as a parameter, but as someone in their right mind would check this before you go this route.

    Shane.

    ApEx 4.2.1

    Shane

    Since you mention that you are on 4.2 APEX I advise to use apex.server.process which is replacing the htmldb_Get officially undocumented documented.

    In the literature, it is that the first parameter is the ajaxidentifier but it's actually the name of the process.

    The data object would be something like

    var lData ={f01 : get_value_array('f01')}
    

    Where is get_value_array

    function get_value_array(pColumnName) {
      var l_values =[];
      apex.jQuery('[name="'+pColumnName+'"]').each(
       function(){
        var l_value;
        l_value = apex.item(this.id).getValue();
        l_values.push(l_value);
       }
      );
      return l_values
    }
    

    For an example see this demo.

    Nicolette

  • call the stored procedure in a column in the report

    Hi all
    I'm new to APEX. I did a search on this forum, but could not get an exact answer.
    I know how to call or execute a procedure from a button. as to create a PL/SQL anonymous bloack and partner is key.

    My question is a little different. I have a report with 11 columns. the last column shows just "delete" for all lines (I did it in my request to report as SELECT x, y, z,..., 'remove' AS delete). When I click on this cell for any line (this column can be a hyperlink or any clickable element), I would like to call a stored procedure that takes parameters as values in columns 2 and 4 for this particular line.

    for example, my report looks like somethnig like below,

    FILE_ID MEMBER_CD ACTION
    112 ABCD Remove
    WXYYZ 113 remove
    114 PQRS remove

    I want to click on the 'delete' in the first line which should call a stored procedure and pass of 112 and ABCD as parameters to the procedure.

    I now have the procedure as a process. sturggling to link this column to procedure but without success :(

    Hope realized. Please, any help is appreciated.

    Thank you

    Hello

    I work in the drudgery of google and firefox if ever the reliased, the thanks of the error to report

    exact code in URL should e

    javascript:document.getElementById('P1_RECORDID').value = '#recordid#';doSubmit('DELETE_RECORD');
    
  • How to call the stored procedure from javascript? (Google suggest, AJAX)

    Hi I want to set up a text field so that it behaves like [Google Suggest | http://www.google.com/webhp?complete=1 & hl = en].

    I read this post .

    Now, I installed everything according to this document. But it simply doesn't. And I don't know why.

    I think that problems can fall into the following three categories:
    1. the text field and the page invoking the appropriate javascript?
    2 - is the JavaScript call the stored procedure?
    3. the stored procedure correctly returns the result formatted?

    I'm assertive for 1 and 3, but I'm not sure 2. Because I don't know how if a stored procedure has been called? Is there a PL/SQL statement that I can query in SQL * more?

    Also, I would like to know how to debug AJAX in the APEX. It involves a lot of things.

    Finally, I used APEX 3.2 and Oracle XE. I can't find file dads.conf or marvel.conf. Is ' / apex / "the virtual directory for APEX?

    Thank you very much!

    Buffalo,

    I managed to make it work on XE with APEX 3.2!
    It took more time than expected because my XE installation was still on an earlier version of the Apex and I had put it first...

    But that's what I did:
    -in the ac.js file, I changed the path ' / apex / "and I added the ac.js file to my candidacy as a static file. So as you did.
    -J' copied my request to the XE and copied my procedure on the schema that is related to my request
    -J' gave to run anonymous rights my procedure

    Now at first, it did not work...
    Then I suddenly remembered something: If you want to run a procedure through the pl/sql gateway in the XE, XE please how it is.
    Do you this by changing the APEX_030200.wwv_flow_epg_include_mod_local function!

    This is the code for the function changed for my example:

    CREATE OR REPLACE function APEX_030200.wwv_flow_epg_include_mod_local(
        procedure_name in varchar2)
    return boolean
    is
    begin
        --return false; -- remove this statement when you modify this function
        --
        -- Administrator note: the procedure_name input parameter may be in the format:
        --
        --    procedure
        --    schema.procedure
        --    package.procedure
        --    schema.package.procedure
        --
        -- If the expected input parameter is a procedure name only, the IN list code shown below
        -- can be modified to itemize the expected procedure names. Otherwise you must parse the
        -- procedure_name parameter and replace the simple code below with code that will evaluate
        -- all of the cases listed above.
        --
        if upper(procedure_name) in (
              'MATTHIASH.INCSEARCH') then
            return TRUE;
        else
            return FALSE;
        end if;
    end wwv_flow_epg_include_mod_local;
    /
    

    After that, the AJAX function worked as expected...

    HTH
    Matthias Hoys

    Published by: mhoys on August 13, 2009 15:24

  • call the stored procedure to a pop up window problem

    Hello

    I use jdev 10g. with ADF BC.

    I have a page jspx with a command button passing 2 parameters to a window popup using processScope. This window contains an entry form containing the parameters passed and 1 other inputText field. The user will enter a value for the inputText field and click the OK button. When you click this button, I need to pass the value entered by the user as well as the parms passed 2 to the AM that calls my stored procedure. The inputText field is defined as < af:inputText value = "#{bindings.workCode.inputValue}" which works very well but the parms passed show as null in the AM. "

    How can I get these 2 parameters to pass to the AM?

    Thank you!

    The following code prints null as well?

    public void Oracle_Proc (String seqNo, String yrCode, String subdivided) {}

    * System.out.println ("seqNum:" + getELValue("#{processScope.seqNum}")); *
    * System.out.println ("yearCode:" + getELValue("#{processScope.yearCode}")); *

    CallableStatement cs = this.getDBTransaction () .createCallableStatement ("{call user. Oracle_Proc(:1,:2,:3)} ", 1);
    try {}

    cs.setString (1, seqNo);
    cs.setString (2, yrCode);
    cs.setString (3, subdivided).
    DSI Execute();

    } catch (SQLException e) {}
    TODO
    e.printStackTrace ();
    }
    }

    * public String getELValue (String expr) {*}
    * FacesContext fc = FacesContext.getCurrentInstance (); *
    * ValueBinding vb = fc.getApplication () .createValueBinding (expr); *
    * return (String) vb.getValue (CF); *

    *}*

  • Call the stored procedure to support bean w / table setting dimensional bi

    Hi all, I use jdeveloper 11g

    I have a requirement where instead of calling several times a "insert into" statement rather call a stored procedure, a table shipping two-dimensional bi as a parameter.

    The table must have size [n] [4] and [0] [0] = string and others must have numbers.

    This is because users will be inserting thousands of records at a time, remote sites, so the load of sending of a should be avoided.

    Any suggestions?

    Thank you.

    Miguel,
    If you use ADFbc (VO and EO sense), you can use batch insert for this archive.
    However, he must think about the user interface and how to transfer data from the client to the server taking the place of the insert.

    How you accumulate the data to insert into the DB?
    Are able to collect you say 1000 records a time and transfer them in a single segment on the server?
    How about data validation and exception handling while inserting into the db?

    I'm sure you can use a pl/sql procedure to do the Insert, but the questions above should always be answered.

    Timo

  • Creation of Adaptert DB to call the stored procedure in MS SQL server

    Hello

    I need to create a DB adapter to call a stored procedure in MS SQL Server.

    I went through the MS SQL Server database connecting wire

    He mentions that he must use a command line utility to generate the wsdl and xsd to call stored procedures in MS SQL server. Please indicate where this utility and how to use it.

    All links to tutorials are welcome.

    Thank you!!.

    Silas.

    The key is SOA_HOME\j2ee\home\connectors\DbAdapter\DBAdapter.jar.

    Make sure that the DBAdapter.jar is at this place

    in my case, it is

    e:\Oracle\product\soa\10.1.3\j2ee\home\connectors\DbAdapter\DBAdapter.jar

    see you soon
    James

  • call the stored procedure in oracle toplink

    Hello
    I use jdev 10.1.3 toplink.
    call oracle stored procedure always failed ora-00900 invalid sql statement.

    Workaround I found is using below codes:
    String sql = "{RESETCURQTY (?). call} ";
    UOW UnitOfWork is getSessionFactory () .acquireUnitOfWork ();.
    uow.beginEarlyTransaction ();
    Conexion Connection = ((UnitOfWorkImpl) uow) .getAccessor () .getConnection ();
    CallableStatement call = null;
    try {}
    Call = conexion.prepareCall (sql);
    call.setString ("P_BRANCHCODE", branchCode);
    Call.Execute ();
    } catch (SQLException ex) {}
    ex.printStackTrace ();
    } {Finally
    {if(Call!=null)}
    try {}
    Call.Close ();
    }
    catch (SQLException e) {}
    e.printStackTrace ();
    }
    }
    }

    I found a few doc toplink on the use of StoredProcedureCall, none of it to success.
    / * A session = getSessionFactory () .acquireSession ();
    Call of StoredProcedureCall = new StoredProcedureCall();
    call.setProcedureName ("RESETCURQTY");
    call.addNamedArgumentValue ("P_BRANCHCODE", "TEST");
    Query ValueReadQuery = new ValueReadQuery();
    query.setCall (call);
    query.addArgument ("P_BRANCHCODE");

    Vector of parameters = new Vector();
    parameters.addElement (branchCode);
    session.executeQuery (query);

    TopLink support calls a stored procedure?

    Thank you
    Ricky

    Hello

    Looks like the database is to launch an exception because you run the query as a read request instead of as a non-selection call. Try to use a DataModifyQuery instead, or you can run the StoredProcedureCall directly using session.executeNonSelectingCall (call);

    Best regards
    Chris

  • Call the stored procedure to odi

    Hi all

    Posible calls a pl/sql stored procedure of odi?

    In ODI, create a procedure in your project, here, you can call a stored procedure name.

    This can then be slid into a package as a package step.

    geeo

  • Insert a record, call a stored procedure and execute a shell script

    Hello

    I am trying to build a page APEX do these three things in order.

    #1. Insert a new record in a database table (pk, donnees_xml, attr1 and attr2, etc.) and download the XML file to the donnees_xml column

    #2. Save this XML file on a file system

    #3. Parse the XML file on a file system and update the database with the parsed data table

    I can do #1 with a regular shape based on the database table. I can do #2 with a stored procedure.

    I can do #3 with a shell script.

    I wonder how these tasks can be combined into a single action in APEX.

    do #1;

    If successful, do #2;

    If successful, do #3;

    I'd appreciate comments on this.

    Thank you

    Define a process of PL/SQL page submit that runs after the record is inserted, if P1_FILE is not null.

  • How to call the stored procedure when I press the button

    Hello

    I want to know how to call the procedure/SQL statement when I press the button using callable statement.

    can someone give me it please link who knows the steps to do this.

    Thanks in advance,
    SAN

    Hello

    read this good example http://www.baigzeeshan.com/2010/05/calling-plsql-procedure-and-function-in.html

    ~ Abhijit

  • How to get the return value of the method by calling the stored procedure in ApplModuleImpl

    Hello

    I use Jdev 10.1.3.4
    JSF, and ADF business components
    I created a service method in the implementing class of module request to execute the strored procedure in the database.
    This breeding returns a string value.
    now, I slipped the method of service of data control palette on my JSF page and chose ADF parameter form when I droped.
    It works very well.
    now, I want to display the string returned by the method of service after the execution on the JSF page as global messages.
    How can I achieve this.
    Help, please

    Thanks in advance

    Kind regards
    Ajit Agarwal

    Hello

    You must run programmatically run the method binding. If I'm not wrong then the following code will allow you to access the return value

    OperationBinding oper = bindings.get("MyPLSQLAccessMethodBinding") (OperationBinding);
    String returnValue = oper.execute ((String));

    Once you have the string in a managed bean you can add it to the stack of messages JSF exposed by the FacesContext

    Frank

  • Need help by calling the stored procedure

    Hi Experts,

    I created under procedure, while calling me, it throws an error.
    CREATE OR REPLACE PROCEDURE spdemo (param1 OUT NUMBER)
     is
     BEGIN
     SELECT COUNT(*) INTO param1
     FROM TEST_DEMO;
     END;
    Can any1 help me get the result or to call this procedure?

    Thnx in advance...

    Published by: 977490 on January 18, 2013 02:25

    Hello

    977490 wrote:
    ... I created under procedure, while calling me, it throws an error.

    If the problem of the call, and then after the call.

    Here's a possible way to call spdemo and see the results:

    SET   SERVEROUTPUT   ON
    
    DECLARE
        test_demo_cnt  NUMBER;
    BEGIN
        spdemo (test_demo_cnt);
    
        dbms_output.put_line (test_demo_cnt || ' = value returned by spdemo');
    END;
    /
    
    CREATE OR REPLACE PROCEDURE spdemo (param1 OUT NUMBER)
    is
    BEGIN
    SELECT COUNT(*) INTO param1
    FROM TEST_DEMO;
    END;
    

    I'm tempted to make a function, not a procedure.

    CREATE OR REPLACE FUNCTION spdemo
    RETURN NUMBER
     IS
        cnt          NUMBER;
     BEGIN
         SELECT  COUNT (*)
         INTO    cnt
         FROM    test_demo;
    
         RETURN  cnt;
     END;
    /
    SHOW ERRORS
    

    Then you can call it in the SQL statements, as you call functions such as SYSDATE:

    SELECT     spdemo
    FROM     dual
    ;
    
  • In a table - looping through the rows and the stored procedure call

    APEX version: 3.2.0.00.27

    Hello

    I searched the forum and tried a few things but could not make it work.

    I have a tabular presentation, developed with the help of the ATD (Cascading LOV - method of tabular presentation - AJAX - ATD )

    What I'm trying to do now:
    -After submit and validations, loop through all the lines and
    -call a stored procedure passing 3 parameters obtained from each of the lines on the form of tables. This procedure will be an update of a database table.

    On the forum, I found that I could do the loop "* FOR i IN 1..." APEX_APPLICATION.g_f03. "LOOP COUNT *" syntax.

    Only for testing purposes, I tried just to view information with the following (On Load - after a footer) process (example of Denes Kubicek == > http://deneskubicek.blogspot.com/2009/05/execute-javascript-throuhg-plsql.html):
    declare
      v_today  varchar2 (200);
    begin
    --  :P40_test := APEX_APPLICATION.g_f03(1);
    --  :P40_test2 := APEX_APPLICATION.g_f04.COUNT;
      :P40_test2 := 100;
    
      v_today := to_char (sysdate, 'dd.mm.yyyy');
    
    --FOR i IN 1.. APEX_APPLICATION.g_f03.COUNT LOOP 
    
      :P40_test := APEX_APPLICATION.g_f02(2);
    
      HTP.p ('<script type="text/javascript">');
      HTP.p (   'alert(''Today is '
              || v_today
    --          || APEX_APPLICATION.g_f04(APEX_APPLICATION.g_f03(i))
              || '.\n'
              || 'end!'');'
             );
      HTP.p ('</script>');
    
    --    :P40_test := APEX_APPLICATION.g_f02(APEX_APPLICATION.g_f02(i));
    
    --END LOOP;
    
    end;
    The foregoing would give me a ' * ORA-01403: no data found * ' message. I tried through various variants of APEX_APPLICATION.g_f0* #*, but still can't get anything to display correctly. In commenting on all the lines referring to APEX_APPLICATION.g_f0x above, the date would be are they displayed fine.

    I tried uncomment the FOR... LOOP and play with the code (defining the process runs "On submit - after calculations" and Validations), I got was a ' * ORA-06502: PL/SQL: digital error or value: character conversion number error * "message.

    Here is the script of the form in a table:
    select 
    "V"."MSLINK",                                       -- hidden (number)
    "V"."INSTALLATION_DATE",                        -- editable date picker
    "V"."MANUFACTURER_INDICATOR",              -- editable (cascading LOV -- text)
    "V"."MODEL_INDICATOR",                           -- editable (cascading LOV -- text)
    "V"."DIAMETER_INDICATOR",                      -- editable (LOV -- number)
    "V"."PURPOSE_INDICATOR",                        -- editable (LOV -- text)
    "V"."VALVE_NUMBER",                                -- shown but not editable -- number
    "V"."MODIFY_DATE",                                  -- shown but not editable
    "V"."MODIFY_USER",                                   -- shown but not editable
    "V"."VALVES_STYLE"."FEATURE"                  -- shown but not editable -- number
    from "#OWNER#"."VALVES" "V"
    Where
      "V"."PROJECT_ID" = :P1_PROJECT_NUMBER AND
      "V"."VALVES_DFLAG" = 0
    Regarding the parameters for the stored procedure, it would the MSLINK, VALVE_NUMBER and the VALVES_STYLE. FEATURE.

    Help, please!
    (Sorry for the long post).

    Thank you

    Tan

    Hi, Tan,

    I have not seen that type of object - I've only used custom types for purposes of test years ago and have never used their within Apex!

    One possibility is that the value of checksum being is based on all of the content of these fields, rather than only the part of the FEATURE. If there are other parts of the object, you could include those items as well.

    Otherwise, as you f01 KP for a record, you will need to retrieve the values of the FUNCTION in your PL/SQL code directly from the table (because the user cannot modify these fields, you can be sure that the values in the table will be still valid).

    Andy

  • [BC] Call a stored procedure taking parameters of table

    Hello!

    I currently have a request of the OIC that makes thousands of calls per second stored procedure. The stored procedure runs a business logic that I want my client application to stay informed.  I want to reduce the cat of the database and instead to call the stored procedure from thousands of times per second, call the procedure (for example) once per second, but with values of one mile.

    I used OCIBindArrayOfStruct successfully to perform inserts bulk, where my OCI application executes a () INSERT INTO using the function "iters" and it might be possible to do something similar with the stored procedure, but I want to do something slightly different, because the procedure stored something like this:

    * If a specific condition is set, call a secondary stored procedure

    * If another special condition is set, insert a row into a table of some

    I so wanted to do was to pass a table (or a series of tables) in the stored procedure, then the stored procedure to use optimal methods that are available, such as FORALL, to perform each of the tasks, the more effectively.

    So I thought to create a type, such as a TABLE OF VARCHAR2, or a VARRAY and possessing of the parameters for the stored procedure based on this type, something like:

    create or replace TYPE 'NTT_VARCHAR2' AS TABLE OF VARCHAR2 (32700);

    create or replace FUNCTION bulk_process_values)

    p_error_message OUT NOCOPY VARCHAR2,

    p_module_context_name OUT NOCOPY VARCHAR2,

    p_sql_error OUT NOCOPY VARCHAR2,

    p_count in NUMBERS

    p_non_array_var_1 IN VARCHAR2,

    p_non_array_var_2 IN VARCHAR2,

    p_array_var_1 IN NTT_VARCHAR2,

    p_array_var_2 IN NTT_VARCHAR2,

    p_array_var_3 IN NTT_VARCHAR2

    < etc. for all the variables in table >)

    RETURN NUMBER

    .. .but I am struggling to find an example of how call the procedure "bulk_process_values" stored, and even if I use a TABLE OF VARCHAR2 or a VARRAY as a parameter type.

    I searched the Internet and found this: OIC - how to bind an array to a stored procedure? - and binding table of the structs (OCIBindArrayOfStruct) sample code

    - but they take different approaches and a bit confused (the second example spoke of OTT).

    I think that the first approach is more likely to be the solution I need - but I can't help thinking - it is a bunch of stuff to move if it does not end up significantly improve performance!

    My questions are:

    * Moves to a call-SP-thousands-of-times-per-second to call-SP-fewer-times-but-with-array-parameters sensitive?

    * Should the table or VARRAY, TABLE OF VARCHAR2 parameters or something else?

    * Should I use for my case OTT?

    Samples I found are both very old - and the second example indicators that the optimal approach evolves with the OCI versions - I'm on 11.2, what is the optimal approach these days?

    * < added later > why is there no official useful example?

    Thank you very much

    Much appreciated. https://community.oracle.com/message/4528528#4528528 has actually worked, with VARRAY, with a proof of concept. Now I just need to shake a little and then get my PL/SQL for optimal PC experts. I think I was really discouraged by the lack of official documents, with the Community (Paradise) is the only way to get real results.

    Thank you JJ.

    I intend me to use the binding enforcement of the table and the table and avoid N back and forth, but I do not then get the opportunity to do something clever in the PL/SQL.

    In the PL/SQL, there is no logic occurring - I don't call the same SP tons of times, but then I want to be able to use PL/SQL optimizations such as FORALL, BULK COLLECT, reduce the number of validations and others.  There is a commit after each SP run, because otherwise the nature of demand means that the application hangs occur; However, there is a way (I think) be smart on the part that is likely to deadlock (making a shape on the Bay First, then applying the updates in the order sorted and then failed to get a blocking theoretically), and then FORALL insert for the second part of the stored procedure.

    I guess I may apply the single return, passing a table (to a commit in the SP)-which will reduce back and forth, so gain in performance, but it will not reduce the number of validations that I do - and Oracle said that commits too frequent is not good for performance. I already have code in my framework that does - by making a simple INSERT INTO.

    Good to hear that OTT is not explicitly required - and VARRAY resembles the approach to try first.

Maybe you are looking for

  • IPhone does not not to do anything

    I have an Iphone 5 c, and it randomly stopped working yesterday. The screen is black, and he does not meet a charger or a computer and iTunes. However, it is recognized in iTunes, and iTunes tells me that the phone is in recovery mode. I tried to res

  • How can I disable the key powerlock on my monitor?

    I can get my monitor to powerdown, but the main switch remains in powerlock mode and will not turn off. There are brilliant blue ons develops across the room and the little box crawls all around my screen saying che power cable. It becomes quite bori

  • External hard drive Western Digital

    I have a Western Digital external hard drive, WD CAviar WD1200BB... it worked great except every now and then Windows would not recognize it.  This is easily fixed by unplugging the USB cable, wait a few seconds and then it reconnect.  Recently, my c

  • New hard drive... Same computer - now have Windows 7 Build 7601 message at the bottom right of your desktop

    How can I fix this - it's the Windows key on the computer - I have had getting a new drive hard because my old one was crushed - how I have this problem. Microsoft wants me to pay for a 'legitimate' copy of Windows 7, but since the death of the old h

  • Mapping TRC5 IR

    Hello! Is there a document that lists the IR values for the buttons on the TRC5?  The TRC3 and TRC4 mappings are in MXP Admin guides. Thank you!