Passing parameters to PL/SQL function called in VO

Hi,
I am writing a VO that is calling a PL/SQL function. The VO query looks like this.
select xx_dummy_func (:1,:2) from dual
Now, how can I assign these two parameter values at run time?
Generally when we have a query parameters We do xxVO.setwhereclauseparam. But in the above scenario, its not a whereclause but instead a procedure parameter. Please let me know how to do it.
Thanks in advance,
Regards,
-Abm

Thats correct, basically, setwherecaluse param api, just replaces bind variables with the index values, whereever they are in the query!
--Mukul                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Passing parameters to pl/sql procedure called in portal

    Hi all,
    I am trying to use a javascript window.open function to create a small popup window that is populated by a pl/sql procedure from inside portal.
    I am trying to pass it a parameter to refine a SQL query running in that procedure, unfortunately I'm not sure of the syntax. The url that I'm trying to open in the new window looks like this:
    http://my.server.com:7777/portal/pls/portal/myschema.mypackage.myprocedure
    If I just run this, it works fine and the popup window opens correctly and displays all results. If I try to pass a parameter, it errors out with a 404 Page Not Found.
    The parameter itself comes from a text field that the user can enter a value into. I am able to get the value of that text field and append it to the url I'm generating, but I can't find the proper syntax.
    I've tried numerous syntax variants, but none of them seem to work. The procedure does have the parameter defined in both the spec and body and properly handles it. Can anyone point me in the right direction?
    Thanks,
    -Mike Markiw

    You said you have a text field where a user enters a value, so I am assuming that you have form...
    you can try following
    <form action="/pls/portal/myschema.mypackage.myprocedure" method="post">
    your text field "inVar"
    your submit button
    </form>
    I am sure your myprocedure has inVar as an input...
    If you just want to pass a value to a procedure you can always do following:
    http://my.server.com:7777/portal/pls/portal/myschema.mypackage.myprocedure?inVar=the value

  • Passing parameters to PL/SQL table types

    Hi Everybody,
    I have one question about passing PL/SQL tables types and tabs as IN parameter in procedure.I am working in 11.2.0.2.0 environment. I am stuck on how to pass those values to procedure.Please find below more details:
    Table 1:
    CREATE TABLE ITEMS
    ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
    ITEM_NAME VARCHAR2(40 BYTE),
    SERIAL NUMBER(2),
    ADDED_ON DATE);
    Table 2:
    CREATE TABLE ITEM_ACTIVITY_INFO
    ITEM_ID VARCHAR2(40 BYTE) NOT NULL,
    ACCOUNT_TYPE VARCHAR2(1 BYTE),
    ID_NUMBER NUMBER(3),
    ACTIVATION_DATE DATE);
    Table 3:
    CREATE TABLE ITEM_GROUP
    GROUP_ID NUMBER(2) NOT NULL,
    ITEM_ID VARCHAR2(40 BYTE),
    GROUP_TYPE VARCHAR2(20 BYTE),
    GROUP_DATE DATE);
    Table 4:
    CREATE TABLE ITEM_ADDRESS
    GROUP_ID NUMBER(2) NOT NULL,
    NAME VARCHAR2(60 BYTE),
    ADDRESS VARCHAR2(100));
    Following types are created:
    CREATE OR REPLACE TYPE ITEMS_TYPE AS OBJECT
    ITEM_ID VARCHAR2(40 BYTE),
    ITEM_NAME VARCHAR2(40 BYTE),
    SERIAL NUMBER(2),
    ADDED_ON DATE);
    CREATE OR REPLACE TYPE ITEM_ACTIVITY_TYPE AS OBJECT
    ITEM_ID VARCHAR2(40 BYTE),
    ACCOUNT_TYPE VARCHAR2(1 BYTE),
    ID_NUMBER NUMBER(3),
    ACTIVATION_DATE DATE);
    CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TYPE AS OBJECT
    GROUP_ID NUMBER(2) NOT NULL,
    ITEM_ID VARCHAR2(40 BYTE),
    GROUP_TYPE VARCHAR2(20 BYTE),
    GROUP_DATE DATE
    ITEM_ADDRESS_IN ITEM_ADDRESS_TYPE);
    CREATE OR REPLACE TYPE ITEM_ADDRESS_TYPE AS OBJECT
    GROUP_ID NUMBER(2),
    NAME VARCHAR2(60 BYTE),
    ADDRESS VARCHAR2(100));
    CREATE OR REPLACE TYPE ITEM_GROUP_COMP_TAB AS TABLE OF ITEM_GROUP_COMP_TYPE;
    Create or replace procedure ITEM_ADD_CHANGE(
    ITEM_IN IN ITEMS_TYPE,
    ITEM_ACTIVITY_IN IN ITEM_ACTIVITY_TYPE,
    ITEM_GROUP_IN IN ITEM_GROUP_COMP_TAB,
    ITEM_OUT IN OUT ITEMS.ITEM_ID%TYPE);
    Above are the paramteres we are passing to procedure.
    I need help in how to pass parameters to above procedure. All comments and responses will be highly appreciated. Thanks everyone for going through the post. Please let me know if more more information is required on this problem.
    Regards
    Dev

    Billy  Verreynne  wrote:
    Types used in this fashion, only make sense if the table is based on the type. It makes very little sense to have a table structure and then to duplicate the structure using a type.
    The 2 structures may be defined the same. But they are NOT interchangeable and requires one to be converted to the other to use. This is not sensible in my view. It is far easier in that case to simply use the PL/SQL macro +%RowType+ to create a duplicate structure definition - one that can natively be used for touching that table, without conversions required.
    If you do want to use types, define the type, then define the table of that type, adding the required constraints (pk, fk, not null, check) to the table's definition.Billy:
    Just curious, why do you say it makes very little sense to have a type modeled on a table? I do that a lot. In my case, I am getting the values from an external program, not building them manually, but it makes a lot of sense to me.
    One application where I do this a lot has a java front-end that parses HL7 messages. Each message contains at least minimal information about a variable number of entities (and often several rows for an entity) in the database, and must be processed as a single atomic trasnaction. So, rather than have potentially hundreds of parameters to the "main" driver procedures for different message types I created a set of types more or less identical to the tables representing the entities. The java program parses the mesasge and populates the type, then calls the appropriate stored procedure for the message type passing in the populated types. My stored procedure then does inserts/updates or deletes as appropriate over potentially dozens of tables.
    John

  • PL/SQL Function call error while reading or assigning returned value

    Hi,
    I am getting the following error while tryih to read the value of the PL/SQL Function. I am calling a function in one of my PL/SQL Packages passing mutliple IN parametes and the function returns some value back. Now on BPEL side when I try to read the return value I am getting an error:
    *<summary>*
    empty variable/expression result.
    xpath variable/expression expression "/ns3:OutputParameters/ns3:TEST_FUNCTION" is empty at line 124, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns3:OutputParameters/ns3:TEST_FUNCTION" is not empty.
    *</summary>*
    Even though in the console when I check the Invoke Output Parameter it does shows me a valid value being retuned by a Function but when I am trying to Assgn this value to some variable using Assign Activity I get the above error.
    Even though all goes fine but looks like I am not able to read or assign the value returned from the Function.
    So just wondering if this even works as to me I have a very simple example and that seems not to work. Function is called successfully and is returning the value as I can see it in the BPEL console but when tryin to read or assign that value to some other variable I get the above error.
    Any ideas?
    Thanks

    This issue has come up a lot. The problem is with a mismatch between the version of JDeveloper and SOA. You'll encounter namespace issues if you use 10.1.3.1 in combination with 10.1.3.3 (or 10.1.3.4). You MUST synchronize both JDev and SOA to 10.1.3.3 or 10.1.3.4 (mixing 10.1.3.3 and 10.1.3.4 is OK). We changed when going to 10.1.3.3 by adding elementFormDefault="qualified" to the generated XSD. We used the default "unqualified" in 10.1.3.1. So you'll encounter namespace issues unless you're using 10.1.3.3 or higher JDev AND SOA. The fact that I see &lt;*db:*...&gt; tells me that you're using 10.1.3.1 JDeveloper. The correct solution is to upgrade your components.

  • Passing parameters to event triggered functions

    hi all,
    i have created a button and added EventListener.
    as mybutton.addEventListener(MouseEvent.CLICK,clickSt art);
    when i implement the clickStart (event:MouseEvent) function i
    want to pass
    an array ,a String to this function as parameters .how can i
    do this.
    is it possible or not.
    thanx.

    Well, not in that way.
    The function automatically receives a parameter when you
    create a callback with that function by "addEventListener", such
    parameter is datatyped as the event type you defined in the
    callback, in your case "MouseEvent". If you want to pass more data
    when the function is called then you have to create your own event
    class because almost all events just inform when something has
    happened and send limited information. You can check the
    documentation about creating a custom event class, there is a lot
    of info about the topic.

  • How display result set of a PL/ SQL function call in a dialog box

    Hello,
    I am calling a PL/ SQL function from Apex, which returns - List of varchar.
    In Apex, it should show this list of varchar and "Yes" and "No" buttons on a message window.
    Can you please suggest a way to achieve the same.
    Thanks,
    Girish

    Hello,
    This application process "vrl_popup" is to get the values from PL/ SQL function. For popup window - confirm(). Also declared the LV_list as Application Item.
    Which is coded in the region part of the button. After pressing this button popup window should come with the list.
    <script type="text/javascript">
    <!--
    function doAjaxRequestParam( process, parameter)
    var ajaxRequest = new htmldb_Get(null,&APP_ID.,'vrl_popup='+process,0);
    ajaxRequest.add('lv_list', parameter );
    var jsonResult = eval('('+ ajaxRequest.get() +')');
    return jsonResult;
    var answer = confirm ("can try this?")
    alert (v_list)
    if (answer)
    alert ("done")
    else
    alert ("Unsuccessful")
    // -->
    </script>
    In apex I created following Application process by name = vrl_popup,
    declare
    lv_List varchar2(2000) := '';
    begin
    begin
    lv_List := select vrl_type_process_pkg.get_regd_reg_lste() from dual;
    exception when no_data_found then null;
    end;
    htp.prn(lv_List);
    end;
    Kindly help in fixing this.
    Edited by: Girish on Jun 17, 2010 12:57 AM

  • SQLJ : sending refcursors via out parameters of PL/SQL functions possible ?

    Hello,
    in SQLJ it's possible to get a refcursor back from a PL/SQL
    function via
    the return value(the usual case in the online examples).
    Is it also possible to give a refcursor back via an out
    parameter
    so that the return value could be used for others ways ?
    SQLJ generation in JDeveloper handles the first way, but we
    didn't
    get it to work with the out parameter.
    Thank you for your help.

    It's certainly possible to have a stored procedure with an OUT parameter that is a REF CURSOR and use that to return data to JDBC. That's actually the most common way that JDBC programmers get ResultSets from stored procedures. I would have to assume that SQLJ would facilitate that?
    Is there a reason that you're looking to use a stored function rather than a stored procedure? The latter seems like a much more logical construct when you have OUT parameters. I've never seen a stored function that was defined with any OUT parameters.
    Justin
    Distributed Database Consulting, Inc.
    www.ddbcinc.com

  • The order of execution (of PL/SQL function calls) changes...why??

    select e.EMPID empid,
    e.name name,
    aatest.SETVALUES(2) z,
    aatest.TEST1() b,
    aatest.TEST2() x,
    aatest.TEST3() y
    from emp e
    where e.empid = 101
    order by e.name;
    when I execute this select statement...the order of function calls is as follows:
    setvalues 1st (call no:1)
    test1 (call no:2)
    test2 (call no:3)
    test3 (call no:4)
    Now...I introduce a join between the two tacles as mentioned in the query
    select e.EMPID empid,
    e.name name,
    e2.deptno deptid,
    aatest.SETVALUES(2) z,
    aatest.TEST1() b,
    aatest.TEST2() x,
    aatest.TEST3() y
    from emp e, emp2 e2
    where e.empid = e2.empid
    order by e.name;
    The order of execution of function calls changes to
    (I observed this using DBMS_OUTPUT.PUT_LINE)
    test3 (call no:1)
    setvalues 1st (call no:2)
    test1 (call no:3)
    test2 (call no:4) (the first and last calls swap!)
    i.e: it calls the last function in the select statement at the beginning
    instead of calling it at the last. Is it the normal behaviour? or whats going on
    here?
    Can somebody explain me, please....
    Details:
    the following four functions are defined in a package called 'aatest' and compiled.
    aatest.SETVALUES(2)
    aatest.TEST1()
    aatest.TEST2()
    aatest.TEST3()
    the Tables EMP and EMP2 are two tables defined in the same schema.

    Your "thinking" is wrong here. You can not use the column order to model your program flow. As SQL is set/tupel based, there is no given sequence of the execution order. Otoh you want to have a specific order in wich your functions must be executed otherwise the result will be wrong (or undefined). Thus here you need a procedural approach. This can be done by using PL/SQL for example.
    You would code your functions in that way, that they are working correctly independent from the place where they are called ie if function1 needs the setvalues function, this function must be called inside the function1 then.
    Are you sure you need all these functions in this procedural approach inside the sql-statement? This is mostly not needed and can be accomplished by using pure SQL. If not, may be your design is broken.

  • Passing parameters to an SQL method

    Does any one know how could i pass a set of string values and a double to the following method please ??
    public Object executeSQL(final String sql) throws SQLException
                              Object returnValue      = null;
                              Statement statement     = this.connection.createStatement();
                              boolean hasResultSet    = statement.execute(sql);
                              if (hasResultSet)
                              ResultSet rs            = statement.getResultSet();
                              ResultSetMetaData meta  = rs.getMetaData();
                              int numColumns          = meta.getColumnCount();
                              List rows               = new ArrayList();
                              while (rs.next())
                              Map thisRow = new LinkedHashMap();
                              for (int i = 1; i <= numColumns; ++i)
                              String columnName   = meta.getColumnName(i);
                              Object value        = rs.getObject(columnName);
                              thisRow.put(columnName, value);
                              rows.add(thisRow);
                              rs.close();
                              statement.close();
                              returnValue = rows;
                              else
                              int updateCount = statement.getUpdateCount();
                              returnValue     = new Integer(updateCount);
                              return returnValue;
                              }here is the sql statement i want to excute
    INSERT INTO [Receipt$] ([MastInterferenceID], [Name], [Address], [Town], [County], [AmountPaid]) VALUES ('"+mastID+"','"+name+"','"+address+"','"+town+"','"+county+"','"+amount+"');"all these variables are of type String except for amount which is a double ........ and im passing these parameter from another class called "MainMenuGUI"
    The SQL method at the top is part of an connection that enters data to an excel worksheet
    Thanks for taking the time to read this,
    Seanie.

    Does any one know how could i pass a set of string
    values and a double to the following method please ??
    public Object executeSQL(final String sql) throws
    SQLException
    Object returnValue      =
    Object returnValue      = null;
    Statement statement     =
    Statement statement     =
    this.connection.createStatement();
    boolean hasResultSet    =
    boolean hasResultSet    = statement.execute(sql);
    if (hasResultSet)
    ResultSet rs            =
    ResultSet rs            = statement.getResultSet();
    ResultSetMetaData meta  =
    ResultSetMetaData meta  = rs.getMetaData();
    int numColumns          =
    int numColumns          = meta.getColumnCount();
    List rows               =
    List rows               = new ArrayList();
    while (rs.next())
    Map thisRow = new
    Map thisRow = new LinkedHashMap();
    for (int i = 1; i <=
    for (int i = 1; i <= numColumns; ++i)
    String columnName   =
    String columnName   = meta.getColumnName(i);
    Object value        =
    Object value        = rs.getObject(columnName);
    thisRow.put(columnName,
    thisRow.put(columnName, value);
    rows.add(thisRow);
    rs.close();
    statement.close();
    returnValue = rows;
    else
    int updateCount =
    int updateCount = statement.getUpdateCount();
    returnValue     = new
    returnValue     = new Integer(updateCount);
    return returnValue;
    }here is the sql statement i want to excute
    INSERT INTO [Receipt$] ([MastInterferenceID], [Name],
    [Address], [Town], [County], [AmountPaid]) VALUES
    ('"+mastID+"','"+name+"','"+address+"','"+town+"','"+co
    nty+"','"+amount+"');"all these variables are of type String except for
    amount which is a double ........ and im passing these
    parameter from another class called "MainMenuGUI"
    The SQL method at the top is part of an connection
    that enters data to an excel worksheet
    Thanks for taking the time to read this,
    Seanie.Seanie,
    Why dont you use a Prepared Statement ? That way you will be able to input values to the SQL.
    Cheers!
    Jay

  • Passing parameters (range) to ABAP function from Crystal report

    Hello experts,
    Iu2019ve created an ABAP function which receives parameters from a Crystal report . It works very well with simple parameters.
    In my crystal report I can see the fields with the prefix u201CI_u201D in the field explorer, and I can use this fields  in my Function Modules perfectly.
    The problem is to pass parameters like range or multiples values.
    I would like to know how to put this parameters into the low and high values of the range and receive them in my Function Module in the ABAP layer.
    Thanks in Advance,
    Carlos Henrique Matos da Silva and Silvio Meurer - SAP BusinessObjects BI Team - Brazil.

    I got the answer of this question under SAP Integration Kit
    How to pass parameters to ABAP function in Crystal report

  • Passing parameters in an sql call to a function

    hello gurus
    i have a simple function that outputs the first x natural integers..
    create or replace function first_numbers (x number default 10) return varchar2
    is
    var varchar2(100);
    begin
    var := null;
    for i in 1..x
    loop
    var := var||to_char(i)||'-';
    end loop;
    return rtrim(var,'-');
    end;
    i would like to use it in an sql call, like this
    select first_numbers (5)
    from dual --(it works)
    but it doesn't work if i pass the parameter in this way
    select first_numbers (x=>5)
    from dual --(it DOESNT' work)
    i understand that it can't be possible because i am working in a sql environment while the call with the "=>" is typical in a pl sql environment.. would like to know if there is a workaround ..
    thanks in advance
    claudio

    claudioconte wrote:
    i understand that it can't be possible because i am working in a sql environment while the call with the "=>" is typical in a pl sql environment.. would like to know if there is a workaround ..Upgrade to 11g which allows that notation. ;)
    What do you actually need a workaround for? What's actually wrong with doing it without that notation?

  • Variable list of parameters in PL/SQL functions

    As I know, PL/SQL decode function can be called with
    variable number of parameters:
    decode (a, b, c);
    decode (a, b, c, d, e);
    decode (a, b, c, d, e, f, g);
    How is is possible to implement a PL/SQL procedure or function like decode, which is usable with a variable list
    of arguments.
    Is there another way instead of using overloading?
    Thanks in advance
    Stefan Richter

    Implement it with the IF..ELSIF condition.

  • Passing parameters to table valued functions and using parameters as column name on select

    I am creating a function where I want to pass it parameters and then use those parameters in a select statement. When I do that it selects the variable name as a literal not a column. How do I switch that context.
    Query:
    ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]
    @BANNER_COLUMN AS VARCHAR(MAX),
    @ORION_COLUMN AS VARCHAR(MAX)
    RETURNS @Banner_Orion_Employee_Comparison TABLE 
    LAST_NAME nvarchar(max),
    EMPNO int,
    BannerColumnName nvarchar(max),
    BANNER nvarchar(max),
    ORION nvarchar(max)
    AS
    BEGIN
    INSERT INTO @Banner_Orion_Employee_Comparison
    (LAST_NAME, BANNER, ORION)
    SELECT
    a.LAST_NAME, @BANNER_COLUMN, @ORION_COLUMN
    FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
    inner join IWM_Stage.dbo.ViewPersonnel AS b
    on a.BADGE = b.badge
    WHERE a.EMP_STATUS = 'A'
    and a.BANNER_RANK <> b.[rank]
    RETURN;
    END;
    GO
    Output
    I execute this:
    select * from ufn_Banner_Orion_Employee_Comparison_parser_v2 ('a.BANNER_RANK' , 'b.[rank]')
    and get:
    Cerecerez NULL
    NULL a.BANNER_RANK
    b.[rank]
          

    George,
    You could go for using a CASE statement as earlier mentioned by Erland. This would look like below: (Downside is that you need to be mentioning all possible values in the CASE)
    ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]
    @BANNER_COLUMN AS VARCHAR(MAX),
    @ORION_COLUMN AS VARCHAR(MAX)
    RETURNS @Banner_Orion_Employee_Comparison TABLE
    LAST_NAME nvarchar(max),
    EMPNO int,
    BannerColumnName nvarchar(max),
    BANNER nvarchar(max),
    ORION nvarchar(max)
    AS
    BEGIN
    INSERT INTO @Banner_Orion_Employee_Comparison(LAST_NAME, BANNER, ORION)
    SELECT
    a.LAST_NAME
    , CASE @BANNER_COLUMN WHEN 'a.BANNER_RANK' THEN a.BANNER_RANK WHEN 'a.BADGE' THEN a.BADGE END --put values as required
    , CASE @ORION_COLUMN WHEN 'b.[rank]' THEN b.[rank] END --put values as required
    FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
    inner join IWM_Stage.dbo.ViewPersonnel AS b
    on a.BADGE = b.badge
    WHERE a.EMP_STATUS = 'A'
    and a.BANNER_RANK <> b.[rank]
    RETURN;
    END;
    GO
    Another method that I would suggest is to get all values from the function, then build a dynamic query to obtain results from it .. Something like:
    ALTER FUNCTION [dbo].[ufn_Banner_Orion_Employee_Comparison_parser_v2]()
    RETURNS @Banner_Orion_Employee_Comparison TABLE
    LAST_NAME nvarchar(max),
    EMPNO int,
    BannerColumnName nvarchar(max),
    BANNER nvarchar(max),
    ORION nvarchar(max)
    AS
    BEGIN
    INSERT INTO @Banner_Orion_Employee_Comparison(LAST_NAME, BANNER, ORION)
    SELECT
    * --Returns all the columns
    FROM OPENQUERY(ORCLPROD_APDORACLE, 'select LAST_NAME, BANNER_RANK, BADGE, EMP_STATUS from XTRACT_VIEW') AS a
    inner join IWM_Stage.dbo.ViewPersonnel AS b
    on a.BADGE = b.badge
    WHERE a.EMP_STATUS = 'A'
    and a.BANNER_RANK <> b.[rank]
    RETURN;
    END;
    GO
    --Execution
    DECLARE @BANNER_COLUMN AS VARCHAR(MAX), @ORION_COLUMN AS VARCHAR(MAX),@SQL NVARCHAR(MAX)
    SET @BANNER_COLUMN='BANNER_RANK'
    SET @ORION_COLUMN='[rank]'
    SET @SQL='
    select LAST_NAME,'+@BANNER_COLUMN+','+@ORION_COLUMN+' from ufn_Banner_Orion_Employee_Comparison_parser_v2 ()'
    PRINT @SQL
    EXEC @SQL
    You just need to make sure that the column names returned by the function are UNIQUE (Using proper alias names) so that you don't have a problem referring to them from the outside..
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Sql function call

    Hi,
    I was wondering if it's possible to execute a custom sql query (built in mysql)?
    example : "SELECT assy_021_check(0801979291) AS TEST"
    assy_021_check is a function code into mysql database.
    With a regulat query, verything works, but if I use this query, I get a error code saying that the ODBC drive does not supporte the resquested properties.
    Also, does a direct connection is supported my the sqlToolkit (without using ODBC driver)?
    Thanks for your help.

    It appears that you're trying to execute a stored procedure. You can't just call the stored procedure like you're doing, you'll have to use the SQL Toolkit's stored procedure functions. The SQL toolkit doesn't come with any example programs showing how to use stored procedures but the various stored procedure functions themselves do have code snippets however. This one is from DBSetParamInt:
    /* This example works with Microsoft SQL Server. */
    /* Create a stored procedure with input, output, */
    /* and return value parameters. */
    resCode = DBImmediateSQL (hdbc, "create proc sp_AdoTest(@InParam int, @OutParam int OUTPUT ) \
      AS SELECT * FROM meas WHERE val1 >= @InParam \
      SET @OutParam = @InParam * 2 \
      RETURN @InParam + 10");
    /* Prepare a statement that calls the stored procedure. */
    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    hstmt = DBPrepareSQL (hdbc, "sp_AdoTest");
    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_UNKNOWN);
    /* Refresh the parameters from the stored procedure. */
    resCode = DBRefreshParams (hstmt);
    /* Set the input parameter. */
    resCode = DBSetParamInt (hstmt, 2, 10);
    /* Execute the statement. */
    resCode = DBExecutePreparedSQL (hstmt);
    while ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS) {
      /* Process records returned by the stored procedure. */
    /* Close the statement. Output parameters are invalid */
    /* until you close the statement. */
    resCode = DBClosePreparedSQL (hstmt);
    /* Examine the parameter values. */
    resCode = DBGetParamInt (hstmt, 1, &retParam);
    resCode = DBGetParamInt (hstmt, 2, &inParam);
    resCode = DBGetParamInt (hstmt, 3, &outParam);
    /* Discard the statement. */
    hstmt = DBDiscardSQLStatement (hstmt);
    Now obviously you have your stored procedure already created so you can skip the first DBImmediateSQL call which creates the stored procedure, but you'll still have to set the command types, "prepare" the SQL and refresh the params. You'd want to use either DBSetParamInt or DBSetParamChar (I can't tell exactly what datatype your stored procedure is using). Once you have your parameters set up, just call DBExecutePreparedSQL and everything should be good. You'd just use DBGetParam____ to examine the output values.
    One thing to note, the parameter Index for these functions is 1-based, but I'm pretty sure that the 1-index is always going to be the return value, even if your stored procedure doesn't return anything, so when setting your parameter values they should start at index 2 and continue from there. I'm going off of memory on that, so if it's wrong I apologize.
    Kevin B.
    National Instruments

  • How to pass parameters to query-database function [Solved]

    Dear All,
    I'm working on a BPEL process which reads a file and the data is passes on
    to a web service. In the transform activity to transform data from the source to the
    web serivice parameters, I want to use the query-database function to check if
    the value given in the file exists in the database. I have added a 'If' XSL construct
    for this. Now when the query is static (given with hardcoded where clause), the
    query-database function works fine. But I want to use one of the column in the
    source variable in the SQL query I'm using in the query-database function.
    i.e. If I give the query as below it is working:
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='10'",.....) > 0">
    I want to replace the hardcoded value 10 with the value from the source variable.
    I'm not sure how this should be done. If I refer to the element directly in the XSL
    it is not working. I've shown this below.
    <xsl:if test="orcl:query-database("select empno from emp
    where empno='/tns:Root-Element/tns:Data/:tns:Empno'",.....) > 0">
    Something like above does not work. I'm not sure also if the syntax is correct. It
    does not give any error, but the transformation does not happen.
    Is there any way you can pass any input value as a parameter to the
    query-database function?
    Thanks in advance
    -Ruban

    Hi Dipal,
    The concat works! Thank you very much for the help. I didn't try concat before.
    I was using a alphanumeric field, so it was required to add one more concat
    for enclosing the value with single quotes. For numerical fields, one concat would
    be enough as you had shown.
    My xsl looks like this now:
    <xsl:if test="orcl:query-database(concat(concat("select empno from emp
    where empno='",/tns:Root-Element/tns:Data/:tns:Empno),"'"),
    false(),false(),"jdbc/DbConnection") > 0">
    This works properly.
    Regards,
    -Ruban

Maybe you are looking for

  • Error while deploying a composite  (Message part "body" is undefined)

    Hi All, I am trying to deploy a composite but i am getting the following error. Buildfile: C:\Oracle\MiddlewareJdev\jdeveloper\bin\ant-sca-compile.xml scac: [scac] Validating composite "C:\JDeveloper\mywork\Sample\SampleDequeueBPEL\composite.xml" [sc

  • Help required for importing a repository data file in the B2B console

    I am trying to import a repository data file with the delivery-channel element and attributes as below. <delivery-channel name="GM_DC" syncReplyMode="none" nonrepudiation-of-origin="false" nonrepudiation-of-receipt="false" secure-transport="true" con

  • File can not be written????

    The last couple of times I have tried to sync my ipad it tells me that certain files, usually movies, can't be written and then it completely freezes and doesn't complete the sync.  This has also started happening with my iphone. I'd rather not delet

  • Text Field with javascript tags execute

    We have a form with multiple text fields on it for users to enter information. If a user puts in something like the following: <script type="text/javascript">window.location="http://www.oracle.com";</script> into a text field and submits the page, an

  • Wrong percentage publisher grand total

    Hi experts, I have created a publisher report based in obiee answers analysis. My problem is in percentage column, I don't want a sum of percentages. Is there any way to fix this? I add an image to explain my problem: http://imagizer.imageshack.us/v2