Name Parameter Binding

Is there any sample code showing how to do named parameter binding using ODBC? I have stored procedures with 100+ parameters and default values assigned to most of the parameters and I want to be able to only bind to the variables that I need to pass. I have it working with MS SQL but with oracle it in not binding to the correct parameter
Thanks

I am tring to do Named "Parameter Binding", I am using using straight ODBC from vc++ with the latest driver 9205. I have also tried the DataDirect drivers and using ADO from VB6.
The same code has worked fine with SQL Server but with oracle it always ingores the SQL_DESC_NAME setting in the SQLSetDescField statement and sets the first two parameters, not the 2nd and 3rd param.
Thanks,
Bill
-- The Stored Procedure
CREATE OR REPLACE PROCEDURE testme (param1 varchar2 :='Default1' , param2 varchar2 := 'Default2', param3 varchar2 := 'Default3') AS
BEGIN
INSERT INTO param_test(param_1, param_2, param_3, col_id) VALUES (param1, param2, param3, test_seq.nextval);
END;
C++ Source code
// Prepare the procedure invocation statement.
retcode = SQLPrepare(hstmt, (SQLCHAR*)"{call testme(?, ?)}", SQL_NTS);
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
// Populate record 1 of ipd.
strcpy((char*)szQuote, "test2");
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 30, 0, szQuote, 0, &cbValue);
// Get ipd handle and set the SQL_DESC_NAMED and SQL_DESC_UNNAMED fields
// for record #1.
//retcode = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hIpd);
retcode = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd1, 0, 0);
retcode = SQLSetDescField(hIpd1, 1, SQL_DESC_NAME, "param2", SQL_NTS);
retcode = SQLSetDescField(hIpd1, 1, SQL_DESC_UNNAMED, SQL_NAMED, 0);
// Populate record 1 of ipd.
strcpy((char*)szQuote2, "test3");
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, 30, 0, szQuote2, 0, &cbValue);
// Get ipd handle and set the SQL_DESC_NAMED and SQL_DESC_UNNAMED fields
// for record #2.
//retcode = SQLAllocHandle(SQL_HANDLE_DESC, hdbc, &hIpd);
retcode = SQLGetStmtAttr(hstmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd2, 0, 0);
retcode = SQLSetDescField(hIpd2, 2, SQL_DESC_NAME, "param3", SQL_NTS);
retcode = SQLSetDescField(hIpd2, 2, SQL_DESC_UNNAMED, SQL_NAMED, 0);
// Assuming that szQuote has been appropriately initialized,
// execute.
retcode = SQLExecute(hstmt);
if (!SQL_SUCCEEDED(retcode))
ExplainErrors(hstmt);
}

Similar Messages

  • PL/SQL:- Invalid Parameter binding

    While calling a pl/sql function returning table type is shows error:
    Invalid parameter binding
    Parameter name: ""

    The problem is coming from .NET and most probably for NULL values.
    SQL> set serverout on
    SQL> create TYPE TEMP_TABLE AS OBJECT (
      2  COLUMN1 VARCHAR2(128),
      3  COLUMN2 VARCHAR2(32),
      4  COLUMN3 VARCHAR2(128));
      5  /
    Type created.
    SQL> create TYPE TEMP_TABLE_REC AS TABLE OF TEMP_TABLE;
      2  /
    Type created.
    SQL> create function SP_TEMP RETURN TEMP_TABLE_REC AS
      2 
      3  v_process_inputs TEMP_TABLE_REC :=TEMP_TABLE_REC();
      4 
      5  CURSOR CUR_EQUIP IS
      6  SELECT 'b' FROM dual
      7  UNION
      8  SELECT 'f' FROM dual;
      9 
    10  REC_EQUIP CUR_EQUIP%ROWTYPE;
    11 
    12  BEGIN
    13 
    14  OPEN CUR_EQUIP;
    15  LOOP
    16  FETCH CUR_EQUIP INTO REC_EQUIP;
    17  EXIT WHEN CUR_EQUIP%NOTFOUND;
    18  v_process_inputs.EXTEND;
    19 
    20  v_process_inputs(1):=TEMP_TABLE('a','b','c');
    21 
    22  END LOOP;
    23  CLOSE CUR_EQUIP;
    24 
    25  RETURN v_process_inputs;
    26  END SP_TEMP;
    27  /
    Function created.
    SQL> declare
      2     result temp_table_rec;
      3  begin
      4    -- Call the function
      5    result := sp_temp;
      6    FOR i in 1..RESULT.COUNT LOOP
      7     dbms_output.put_line(RESULT(i).COLUMN1||'--'||RESULT(i).COLUMN2||'--'||RESULT(i).COLUMN3);
      8    END LOOP;
      9  end;
    10  /
    a--b--c
    PL/SQL procedure successfully completed.Note the last null values ----.

  • PreparedStatement parameter binding

    Hello,
    I am new to JDBC and java technology. I have experience with SQL, PL/SQL and I am quite shocked, that binding parameters using PreparedStatement class is based on parameter index instead of the parameter name.
    It is quite common in PL/SQL to use paramter name to bind a value to it.
    E.g. if I use query "select * from foo where id = :id and name = :name" I can bind parameters using dbms_sql.bind_variable(query, "id", 5) dbms_sql.bind_variable(query, "name", "london").
    However, in java I jave to bind using parameter index e.g query.setInt(1, 5), query.setString(2, new String("london")). Now the problems are
    - what if the sql programmer changes code "select * from foo where id = ? and name = ?" to "select * from foo where name = ? and id = ?"
    - think of a quite more complicated query, e.g. query with size of few kB - there can be a parameter repeated many times (id, date range etc) so I need to bind this parameter many times, instead of simple one bind by name
    - think of a dynamicaly generated query, where it is seriously complicated to follow the parameter indexes (sql block repeating, dynamicaly generated where clausules etc) and again binding by name is much more easier than indexed binding
    So my question is: Do you know of any class that supports binding by name ? Is there any workaround how to solve above mentioned issues ?
    And finally, what is the reason to use parameters by index instead of naming, which is I belive more obvious in database programming ?
    I am looking forward to your answers.
    Kindest regards,
    Kamil Poturnaj
    Mgr. Kamil Poturnaj, MicroStep-MIS
    Ilkovicova 3, 841 04 Bratislava, Slovakia

    - what if the sql programmer changes code "select *
    from foo where id = ? and name = ?" to "select * from
    foo where name = ? and id = ?"Tell him "please stop doing that" :-)
    He could also add a third parameter, "address = ?" which would also break it (even if the "?" were spelled ":address").
    The SQL statement and the code that binds / extracts values need to be modified in sync.
    - think of a quite more complicated query, e.g. query
    with size of few kB - there can be a parameter
    repeated many times (id, date range etc) so I need to
    bind this parameter many times, instead of simple one
    bind by nameThough I'm no great fan of vendor-specific 70-style languages, I'd recommend writing a PL/SQL procedure if a query gets very big.
    So my question is: Do you know of any class that
    supports binding by name ? Is there any workaround how
    to solve above mentioned issues ?I don't know of such a package; anyone...?
    It should be a nice programming exercise to write one. Something like:
        BindStatement stmt = new BindStatement("select a, :id from foo where id = :id and name = :name");
        stmt.set("name", "John");
        stmt.set("id", 1234);BindStatement would need to locate each occurrence of ":X" and create an SQL string with them replaced with "?"s. It would also need to store the positions where each ":X" occurred, so that when set("id",...) is called, it could do set(1,...); set(2,...); for the underlying statement.
    Occurrences of ":X" within strings need to be considered; the easy way is to replace there too.
    Unless I'm missing some gotcha, shouldn't take more than a couple of hours to write.
    And finally, what is the reason to use parameters by
    index instead of naming, which is I belive more
    obvious in database programming ?I can only speak from my experience: sql statements within Java code tend to be simple, and the "?" syntax is quite adequate there. Complex statements, if needed, are hidden in PL/SQL. Large systems use beans and automatically generated sql glue. This seems to be rarely a problem.

  • Parameter Binding Issue

    I have an advanced function that that looks something like this:
    function Audit-System
    [CmdletBinding()]
    param(
    [Parameter(Position=0,Mandatory=$True,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True)]
    [Alias("Name")]
    [string[]]$ComputerName
    Process
    foreach($computer in $ComputerName)
    ## Do stuff for every computer
    Write-Verbose $computer
    The followimg work ok:
    "computer1","computer2" | Audit-System
    Audit-System "computer1","computer2"
    Audit-System "computer1"
    The following doesn't work:
    Get-ADComputer -Filter * SearchBase "CN=Computers,DC=contoso,DC=com" | Audit-System -Verbose
    I would have thought that because the [Microsoft.ActiveDirectory.Management.ADComputer] has a 'Name' property parameter binding would have matched it up with my $ComputerName parameter. Why doesn't this work?

    What version of PowerShell are you running? I have this working running PowerShell V4 and also having installed  KB2928680 which
    fixed a known issue with PowerShell V4 and the use of -Properties * with Get-ADUser and Get-ADComputer.
    Interesting. I still need to pipe through select on a fully patched Win8.1 and Win7 (with V4 installed).
    Don't retire TechNet! -
    (Don't give up yet - 12,700+ strong and growing)
    Disregard this. After more testing (this time using the function), I run into the same issue. Appears that this particular issue is still occurring. I know there is a connect issue submitted for this, but wasn't able to locate it (at the time of this post).
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • Named parameter binding

    ODP.Net document said :
    The position of an OracleParameter added into the
    OracleParameterCollection is the binding position in the SQL statement.Position is 0-based and is used only for positional binding.
    If named binding is
    used, the position of an OracleParameter in the
    OracleParameterCollection is ignored.
    Then,how can I use named parameter binding ?

    Look up the BindByName property of the Oracle Command. It defaults to false (bind params by position). Set it to true for bind by name.

  • Help with Invalid Parameter Binding issue

    let me prefix this with the fact that I'm about as ignorant as can be when it comes to oracle so speak slowly and hopefully I'll catch the low hanging fruit.
    I've inherited a project that someone else wrote and I'm trying to make the code base work, but I am getting 2 error messages and don't really know where to start to fix it.
    My project is using ActiveReports (yea I hate it too) to call a function into a 10g database. It is returning an error saying Invalid Identifier. When I try to run the function in visual studio I get an invalid parameter binding error message and it says parameter name "" (empty quotes, so who knows).
    here's what I have:
    the type definition:
    TYPE type_A AS OBJECT (date_a VARCHAR2(25), start_date VARCHAR2(25), end_date VARCHAR2(25), items_total INT, items_with_x INT, items_without_x INT, items_with_x_percent DECIMAL(7,6), items_without_x_percent DECIMAL(7,6))
    the type table:
    TYPE type_A_table AS TABLE OF type_A
    the function that is erroring:
    <em>FUNCTION func_A (start_date_str IN VARCHAR2, end_date_str IN VARCHAR2) RETURN type_A_table PIPELINED
    IS
    PRAGMA AUTONOMOUS_TRANSACTION;
        start_date_filter TIMESTAMP := TO_DATE(start_date_str,'MM/dd/yyyy HH:MI:ss AM');
        end_date_filter TIMESTAMP := TO_DATE(end_date_str,'MM/dd/yyyy HH:MI:ss AM');
        items_total INT;
        items_with_x INT;
        items_without_x INT;
        items_with_x_percent DECIMAL(7,6);
        items_without_x_percent DECIMAL(7,6);
        temp type_A;
    BEGIN
        SELECT COUNT(*) INTO items_total FROM atable WHERE (create_date BETWEEN start_date_filter AND end_date_filter);
        SELECT COUNT(*) INTO items_with_x FROM atable WHERE conditionx=1 AND (create_date BETWEEN start_date_filter AND end_date_filter);
        SELECT COUNT(*) INTO items_without_x FROM atable WHERE conditionx=0 AND (create_date BETWEEN start_date_filter AND end_date_filter);
        items_with_x_percent := 0.00;
        items_without_x_percent := 0.00;
        IF items_total > 0 THEN
            items_with_x_percent := (items_with_x*1.00)/(items_total*1.00);
            items_without_x_percent := (items_without_x*1.00)/(items_total*1.00);
        END IF;
        temp := type_A(
            TO_CHAR(CURRENT_DATE,'MM/dd/yyyy HH:MI:ss AM'),
            start_date_str,
            end_date_str,
            items_total,
            items_with_x,
            items_without_x,
            items_with_x_percent,
            items_without_x_percent
        PIPE ROW(temp);
        RETURN;
    END;</em>
    I've changed some of the details here from the original so there may be some syntax errors but hopefully you get the gist of the situation.
    any help would be appreciated.
    Thanks

    activereports is a report generator for .net
    as for why it's written the way it is, I have no idea. Like I said, I didn't write it, I'm only trying to get it to work. There is far too much of it (and I'm far under-skilled) to go back and re-write everything the way it should be.
    this function is pretty simple, it takes a start & end date as a string as parameters to the function. it converts those to timestamps and query's an existing table with data for the number of times condition X is true or false with in that date range. This is what the report being generated reports on.
    This one was short and simple which is why I posted it. Others are far more complex and do loop, but for the sake of simplicity I posted this one. I get the same error with all the rest and I figure if I can get one working, the rest probably suffer from the same issue so fixing the rest should be fairly straight forward.
    as for priv's the user is granted all priv's (that are available when you create a new user in 10g XE's web admin interface), and it won't let me grant/remove priv's from the visual studio addin for myself.

  • How to pass parameter [bind variable or substitution variable] to a view?

    How can I pass a parameter [bind variable or substitution variable] to a view in Oracle?
    Some will tell me that this is not necessary, that I can only pass the parameter when I query the view, but I found some case where this cause performance issue. In long view where I use subquery factoring [WITH], it's necessary to pass the parameter many time through different subqueries and not only to the resulting view.
    In other database (SQL Server, Access), we can pass parameters through query. I can't find how to do that in Oracle. Can some one tell me what is the approach suggest by Oracle on that subject?
    Thank you in advance,
    MB
    What I can do:
    CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")
    AS
    SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES;
    What I want to do:
    CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")(prmEMP_ID)
    AS
    SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID IN (:prmEMP_ID);

    Blais wrote:
    How can I pass a parameter [bind variable or substitution variable] to a view in Oracle?
    Some will tell me that this is not necessary, that I can only pass the parameter when I query the view, but I found some case where this cause performance issue. In long view where I use subquery factoring [WITH], it's necessary to pass the parameter many time through different subqueries and not only to the resulting view.Yes, there can be performance issues. Views are a form of dynamic SQL and it is hard to predict how they will perform later.
    You can't pass parameters to a view. They are not functions. The mechanism to put the values in is what you mentioned, passing the parameter when you query the view.
    In other database (SQL Server, Access), we can pass parameters through query. I can't find how to do that in Oracle. Can some one tell me what is the approach suggest by Oracle on that subject? This functionality is not supported.
    What I can do:
    CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")
    AS
    SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES;
    What I want to do:
    CREATE VIEW "HR"."EMP_NAME" ("FIRST_NAME", "LAST_NAME")(prmEMP_ID)
    AS
    SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES WHERE EMPLOYEE_ID IN (:prmEMP_ID);Include the bind value when you use the view in a SELECT. The value will be applied to the view at run-time, somthing like
    CREATE  VIEW "HR"."EMP_NAME_VW" ("FIRST_NAME", "LAST_NAME","EMPLOYEE_ID")(prmEMP_ID)
    AS  SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEES;
    select *
      from emp_name_vw
      WHERE EMPLOYEE_ID IN (:prmEMP_ID);To use EMPLOYEE_ID I added it to your list of columns in the view so it can be referenced in the WHERE clause. If you don't want to see that value don't select it from the view.

  • JMS ReplyTo Queue Name parameter in the receiver JMS communication channel

    Hi All,
    Can any please explain the use of JMS ReplyTo Queue Name parameter in the receiver JMS communication channel?
    Thanks
    Karthik.

    Hi karthik,
    JMS ReplyTo Queue Name parameter  is used for Specify the name of the queue to which the responses are to be sent.
    Thanks
    Govind.

  • [Oracle JDBC Driver]Invalid parameter binding(s).

    Hi there
    I am using the OracleCachedRowSet, and it works fine until I tries to update a resultset with a null value. When I call rs.acceptChanges(connection); it results in the following exception.
    Please help if anyone has found a workaround to this problem.
    java.sql.SQLException: [BEA][Oracle JDBC Driver]Invalid parameter binding(s).
    at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
    at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
    at weblogic.jdbc.base.BaseParameters.getParameter(Unknown Source)
    at weblogic.jdbc.base.BasePreparedStatement.setObjectInternal(Unknown Source)
    at weblogic.jdbc.base.BasePreparedStatement.setObject(Unknown Source)
    at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:268)
    at oracle.jdbc.rowset.OracleCachedRowSetWriter.updateRow(OracleCachedRowSetWriter.java:429)
    at oracle.jdbc.rowset.OracleCachedRowSetWriter.writeData(OracleCachedRowSetWriter.java:534)
    at oracle.jdbc.rowset.OracleCachedRowSet.acceptChanges(OracleCachedRowSet.java:2926)
    at eurostat.Items.updateRS(Items.java:192)
    at eurostat.DBConnectionBean.updateRS(DBConnectionBean.java:94)
    at jsp_servlet.__mainpage._jspService(MainPage.jsp:248)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at com.bea.wlw.netui.pageflow.PageFlowJspFilter.doFilter(PageFlowJspFilter.java:246)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

    Hi Avi
    Thanks for the suggestion, but I don't thint that is the problem. In other forums I have found people describing the same problem(both with Oracle and Sun's implementation of CachedRowSet). See this link for an example http://bugs.mysql.com/bug.php?id=9831. So I figured that those other people needed to have a solution to the problem, but I can't find it.
    /Thomas

  • SAP Cloud For Customer : Add Extension Fields under the Parameter Binding For Mashups

    Hi Experts,
    I have requirements for the mashups, I have created the extension field in cloud for customer "Registered Product" TI screen i want to add that newly created extension fields under the Mashup Parameter Binding List.
    1) Is it possible ? If yes then How it is?
    2) Any Standard process or we go for the SDK to enhance the standard screen port binding?
    For more information refer the below screen.
    Awaiting for your reply or suggestion....
    Many Thanks,
    Mithun

    I have done the below changes on the custom BO.
    Step 1 . In the Event Handler i have change as per the previous reply.
    Step 2. Assign that Event to Import OnFire.
    I am getting this error when open the Account Screen and go to that Embed Tab.
    "Object [object Object] has no method 'getRawValue'".
    Kindly check the above steps are correct or any step missing.
    Many Thanks,
    Mithun

  • OWB embeded process flow - parameter binding problem

    I've installed and Oracle 10g Database, after the database installation I added the Oracle Workflow server software. To complete the installation I ran the wfca.
    Later I get to define a process flow in OWB (cheesy) and the process flow seems to be working well (I've done all the registrations necesary also ), but when I am trying to do the parameter binding is not working. I do get the window prompt for the parameter and I enter the date parameter ( I tried different formats like 'YYYY/MM/DD' 'dd-mon-yyyy'), but after I check the runtime in the web browser the parameter is not pass to next process. I tried many things for the last week but I cannot get it to pass the parameter from one process to another.
    Any ideas,
    HELP !!!!!

    did u manage to resolve this issue? we are facing the same problem.

  • "Please check the agent -NAME parameter" error

    I get the following error when trying to execute a simple ODI package. Before the process even starts running, I get the following message in a popup. I have tested the physical connection to the ODI agent successfully in the topology manager. This agent is running on a Windows 2003 server.
    java.lang.Exception: Error during Session launching : Error during Session Preparation : You are trying to execute a session with an agent that is undefined in your repository. Please check the agent -NAME parameter.
         at com.sunopsis.dwg.dbobj.SnpSession.remoteExecute(SnpSession.java)
         at com.sunopsis.graphical.r.ot.k(ot.java)
         at com.sunopsis.graphical.frame.a.ir.dB(ir.java)
         at com.sunopsis.graphical.frame.a.eu.actionPerformed(eu.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    Silly me... The physical agent name in the topology manager wasn't the same as the name used by the Windows service - all set now

  • [OCI] Parameter Binding, repeated Statements with differing values

    Hello
    I am working on an application written in C which sends about 50 different SQL Statements to an Oracle Database using OCI. These Statements are executed repeatedly with different values.
    In order to improve performance I would like to know what possibilities I have.
    Whats the benefit of the following "techniques" ?
    - Parameter Binding
    - Statement Caching
    What else could I look into?
    with friendly greetings.

    It doesn't take zero-time of course, and it does level-off after a while, but array-bind/define or pre-fetching can make a significant impact on performance:
    truncated table: 0.907 / 0.918
    insert_point_stru_1stmt_1commit: x100,000: 0.141 / 0.144Above I truncate the table to get repeatable numbers; deleting all rows from a previous run leaves a large free list (I guess...), and performance of this little contrived benchmark degrades non-negligeably otherwise. This is a single array-bind insert statement.
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@0: 7.594 / 7.608
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@1: 4.000 / 4.004
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@10: 0.906 / 0.910
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@100: 0.297 / 0.288
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@1,000: 0.204 / 0.204
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@10,000: 0.265 / 0.268
    fetched 100,000 rows. (0 errors)Above I do a regular "scalar" define, but turn pre-fetching on (default is one row, but I tested with pre-fetching completly off too). @N means pre-fetch N rows.
    select_points_array: x100,000@10: 0.969 / 0.967
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@100: 0.250 / 0.251
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@1,000: 0.156 / 0.167
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@10,000: 0.156 / 0.157
    fetched 100,000 rows. (0 errors)Above I use array-defines instead of pre-fetch.
    select_points_struct: x100,000@10: 0.938 / 0.935
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@100: 0.219 / 0.217
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@1,000: 0.140 / 0.140
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@1,000: 0.140 / 0.140Above I use array-of-struct defines instead of pre-fetch or array-bind. Performance is just a little better, probably because of better memory "locality" with structures.
    The table is simple:
    create table point_tab(
    id number,
    x binary_float,
    y binary_float,
    z binary_float
    So each row is 22 + 4 + 4 + 4 = 34 bytes. There are no constraints or indexes of course to make it as fast as possible (this is 11g on XP win32, server and client on the same machine, single user, IPC protocol, so it doesn't get much better than this, and is not realistic of true client-server multi-user conditions).
    There aren't enough data point to confirm or not your prediction that the advantage of array-bind level-off at the packet size threshold, but what you write makes sense to me.
    So I went back and tried more sizes. 8K divided by 34 bytes is 240 rows, so I selected 250 rows as the "middle", and bracketed it with 2 upper and lower values which "double" up or down the number of rows:
    truncated table: 0.953 / 0.960
    insert_point_stru_1stmt_1commit: x100,000: 0.219 / 0.220
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@67: 0.329 / 0.320
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@125: 0.297 / 0.296
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@250: 0.250 / 0.237
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@500: 0.218 / 0.210
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@1,000: 0.187 / 0.195
    fetched 99,964 rows. (0 errors)
    select_points_array: x99,964@67: 0.297 / 0.294
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@125: 0.235 / 0.236
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@250: 0.203 / 0.206
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@500: 0.188 / 0.179
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@1,000: 0.156 / 0.165
    fetched 99,964 rows. (0 errors)
    select_points_struct: x99,964@67: 0.250 / 0.254
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@125: 0.203 / 0.207
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@250: 0.172 / 0.168
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@500: 0.157 / 0.152
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@1,000: 0.125 / 0.129As you can see, it still gets faster at 1,000, which is about 32K. I don't know the packet size of course, but 32K sounds big for a packet.
    truncated table: 2.937 / 2.945
    insert_point_stru_1stmt_1commit: x100,000: 0.328 / 0.324
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@1,000: 0.250 / 0.250
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@2,000: 0.266 / 0.262
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@3,000: 0.250 / 0.254
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@4,000: 0.266 / 0.273
    fetched 100,000 rows. (0 errors)
    select_first_n_points: x100,000@5,000: 0.281 / 0.278
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@1,000: 0.172 / 0.165
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@2,000: 0.157 / 0.159
    fetched 99,000 rows. (0 errors)
    select_points_array: x99,000@3,000: 0.156 / 0.157
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@4,000: 0.141 / 0.155
    fetched 100,000 rows. (0 errors)
    select_points_array: x100,000@5,000: 0.157 / 0.164
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@1,000: 0.125 / 0.129
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@2,000: 0.125 / 0.123
    fetched 99,000 rows. (0 errors)
    select_points_struct: x99,000@3,000: 0.125 / 0.120
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@4,000: 0.125 / 0.121
    fetched 100,000 rows. (0 errors)
    select_points_struct: x100,000@5,000: 0.125 / 0.122Above 32K, there doesn't seem to be much benefit (at least in this config. My colleague on linux64 is consistently faster in benchmarks, even connecting to the same servers, when we have the same exact machine). So 32K may indeed be a threshold of sort.
    In all, I hope I've shown there is value in array-binds (or defines), or even simple pre-fetching (but the latter helps in selects only). I don't think one can very often take advantage of it, and I have no clue how it compares to direct-path calls, but value there is still IMHO. --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can WS name and Binding name be changed?

    Hi,
    When we generating the wsdl file from a sender agreement, A webservice name and Binding name have been created in the wsdl file.
    web service name AS "XI_20ec1074cc28367c964b34f226098f29_Service"
    and binding name as "ServiceInterfacenameBinding"
    But the legacy people who are going to access this webservice need this names to be changed. is it possible from PI??
    i mean like instead of "XI_20ec1074cc28367c964b34f226098f29_Service" they want some name like "getProductinformation"
    and binding name like as "ProductinformationBinding"
    Regards,
    Balaji
    Edited by: Balaji Pichaimuthu on Sep 1, 2010 8:32 AM

    Hi Balaji,
    It s not possible within PI, as this Information is generated when you retrieve the WSDL from the Directory.
    However if you want to change that you can do it manally before forwarding the WSDL to other people.
    The name of Binding/Service has no impact on the call at runtime.
    Best regards
                 Sebastian

  • Get.add name parameter has 15 character limit??

    Hi,
    can you confirm the limit on the name parameter string is 15 characters. Its taken me a while to debug my code and narrow it down to the fact that my application level item name that i am updating via get.add is 16 characters long. If i reduce this to 15 characters its fine
    the error i'm getting when i use 16 characters is:
    Not Found
    The requested URL /pls/htmldb/wwv_flow.show was not found on this server.
    Thanks.

    Please ignore.....
    The problem arises if you create a process of type clear cache for pages and place item_ids in the field
    when you really wanted to create a process of type clear cache for items...
    doh!!

Maybe you are looking for

  • Open letter to Nokia Messaging dev team: imap idle...

    Hi, I would like to ask the developers of Nokia Messaging if they are aware of the fact themailclient in the E72 isn't supporting Imap IDLE anymore. Before, in the E71 for example, there was indeed a timesetting in the native client BUT this was used

  • Release Stategy on PO

    Hello Experts ! How do i Apply Release stategy on a PO and how can i release it. Let me explain that clear with an example : Apply a condition on the PO such that if the cost of the PO exceeds 10K then it should be released by a Manager A and if it e

  • ACR Brightness and Contrast Defaults

    PS CS3 Extended, ACR 4.1, WinXP Pro In ACR, why is the Brightness set at +50 and Contrast set at +25 by default? B&C are secondary adjustments to Exposure, Blacks, Recovery and Fill and would be adjusted last if at all. Would it be logical to set new

  • Updater says my logic is not eligible

    updater says my logic is not eligible downloaded update 7.0.1 and it wont run cause it says its noy eligible.......eh

  • Glare from sun on my screen Sattlite E105-S1802

    when i am outside or in a car , i can hardly see what i'm working on because the screen is so shiny.  will the filter available for this correct this problem?  i'm concerned the filter is only for security and i'm not concerned about security.  i jus