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

Similar Messages

  • Passing PL/SQL table type as IN Parameter to DB Adapter

    Hi,
    I have an requirement to pass multiple record values(array of values) to an API from BPEL process.
    For this,
    1) I have created a package procedure having PL/SQL table type variable as IN Parameter.
    2) In the BPEL process, created a DB adpater pointing to the above API.(Created wrapper API impicitly)
    When I intiated the BPEL process passing multiple values, the API is taking only the first value, ignoring rest of the values.
    Any reason, why only the first value is accepted by the API ?
    Thanks,
    Rapp.

    If I understand correctly, JPublisher generates a wrapper API for an underlying API that takes a PL/SQL table as an IN parameter. The wrapper will generate and use a SQL nested table as the type for the IN parameter of the wrapper procedure.
    The DB adapter DOES support nested tables, varrays, and objects as IN parameters of an API. The problem you are seeing is most likely due to the way you are modeling your BPEL process, specifically with respect to your Assign activities.
    When you Assign TO an IN parameter, make sure that you drill down all the way and choose the parameter name in the InputParameters root element. Similarly, when you Assign FROM the API value, you must drill down and choose the name of the OUT parameter in the OutputParameters root element.
    In a Transform activity, you would use the FOR construct on the target side to get the values of the nested table or varray from the source side.

  • PL/SQL table type in Forms 4.5

    Hi
    I am trying to use a pl/sql table type variable in Oracle forms 4.5 . I am able to compile this and run it on the database that the application connects to but in forms , it gives me a compilation error.
    Is there some restriction on using this datatype in forms 4.5
    Following is the syntax I am using:
    TYPE block_list_type IS TABLE of VARCHAR2(200) INDEX BY BINARY_INTEGER;
    block_list block_list_type;
    I get fatal syntax error even though the syntax is correct(checked it on the database).
    please let me know if I am doing something wrong.
    thanks a lot

    That explains it!!
    Thanks. My company is on oracle 10.7 and is too reluctant to move to higher versions. They finally bought I2 and are developing their own custom java applications and will phase out 10.7 but are not willing to move to the next version of Oracle !!
    Seems like they are done with Oracle .
    thanks for the input anyways.

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • Retrieving PL/SQL Table Type returned by stored procedure using Java.

    Hi All,
    I am facing an issue in a Stored Procedure (SP) which returns Table Type, the PL/SQL complex type.
    Below mentioned is how my stored procedure looks like.
    CREATE OR REPLACE package sp_test_pkg as
    TYPE v_value_table_type is table of SW_VALID_CODE.swValue%Type
    index by binary_integer;
    v_swRMAStatus v_value_table_type;
    procedure sp_test
    (locale      in int,
              name      in SW_CODE.swName%Type,
              v_value_table out v_value_table_type,
    batch_size in int,
    out_batch_size in out int,
    status out int);
    end sp_test_lcode_code_pkg;
    My java program to access this stored procedure is as given below:
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class OracleTest {       
         public static void main(String args[]) {
         Connection con = null;
    OracleCallableStatement cstmt = null;
    String url = "url";
         String userName = "username";     
         String password = "password";
    try
              DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());     
              con = DriverManager.getConnection(url, userName, password);
         cstmt = (OracleCallableStatement)con.prepareCall("begin " +
              "sp_test_pkg.sp_test_pkg(?,?,?,?,?,?); end;");
              cstmt.setInt(1, 1);
         cstmt.setString(2, "Test");
              cstmt.registerOutParameter(3, OracleTypes.ARRAY);
              cstmt.setInt(4, 10);
              cstmt.setInt(5, 1);
              cstmt.registerOutParameter(5, Types.INTEGER);
              cstmt.registerOutParameter(6, Types.INTEGER);
              cstmt.execute();
    } catch(Exception ex) {
    ex.printStackTrace(System.err);
    } finally {
    if(cstmt != null) try{cstmt.close();}catch(Exception _ex){}
    if(con != null) try{con.close();}catch(Exception _ex){}
    When i execute this java program, i get the following error:
    java.sql.SQLException: Parameter Type Conflict: sqlType=2003
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:187)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:229)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameterBytes(OracleCallableStatement.java:245)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:389)
         at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:452)
         at OracleTest.main(OracleTest.java:49)
    I am not sure where i am going wrong. I have never worked on such complex types before. I want to retrieve the complex table type returned by the stored procedure using my java source code.
    Can anyone please help me out in resolving this issue?. This is very urgent.

    JDBC does not recognise types declared in PL/SQL. This is documented in the Dev Guide. [Find out more|http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oraarr.htm#1057625].
    The only work around would be to build a wrapper which calls your existing PL/SQL procedures and returns a SQL type instead. Obviously not knowing your precise scenario I have no idea how much work this entails for you. It may be worth building a code generator.
    Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Database Adapter does not generate proper output for PL/SQL table type

    Hi,
    I have a DB Adapter to invoke a stored procedure on Oracle which returns a table type.
    I am getting the following output from the adapter:
    </DB_Test_InputVariable><DB_Test_OutputVariable><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    <db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/APPS/BPEL_DB_TEST/XXC_KEMET_TEST_PKG-24GETITEMONH/">
    <ITEM_QTY_UOM_OUT>
    <ITEM_QTY_UOM_OUT_ITEM>
    <SERIAL_NUM>1</SERIAL_NUM>
    <ITEM_QTY_OUT>1</ITEM_QTY_OUT>
    <UOM_OUT>BOX</UOM_OUT>
    </ITEM_QTY_UOM_OUT_ITEM>
    <ITEM_QTY_UOM_OUT_ITEM>
    <SERIAL_NUM>2</SERIAL_NUM>
    <ITEM_QTY_OUT>5</ITEM_QTY_OUT>
    <UOM_OUT>BOX</UOM_OUT>
    </ITEM_QTY_UOM_OUT_ITEM>
    </ITEM_QTY_UOM_OUT>
    </db:OutputParameters>
    </part>
    </DB_Test_OutputVariable>
    When I try to transform it, it tries to select /db:OutputParameters/db:ITEM_QTY_UOM_OUT/db:ITEM_QTY_UOM_OUT_ITEM/db:SERIAL_NUM from it and does not give me any output.
    I assume it's the same issue with namespace prefix.
    If anyone has faced a similar issue or knows how to fix this, please let me know.

    I am using a DB adapter to run a stored procedure for a simple Select Query with a table as my out parameter.This creates an XSD when the partner link is created.The elementFormDefault=qualified is by default formed in the xsd.When i change it to unQualified it returns me compilation error.
    Where do i need to change the root element?
    My output of BPEL(P.S. - I have used synchronous BPEL) on the console is
    Your test request was processed synchronously. It took 359.0milliseconds to finish and generated the following output:
    Value: <ProcessResponsehttp://www.w3.org/2001/XMLSchema-instancehttp://www.example.org>
    <null>
    <null>
    <null>database_K_DKL_NW02</null>
    <null>2008-07-07T00:00:00.000+05:30</null>
    <null>2008</null>
    <null>3435</null>
    <null>http://www.google.com</null>
    </null>
    <null>
    <null>database_config.txt</null>
    <null>2006-03-14T00:00:00.000+05:30</null>
    <null>2006</null>
    <null>342345</null>
    <null>\\01hw180464\MOTO\database_config.txt</null>
    </null>
    <null>
    <null>database_help.txt</null>
    <null>2008-07-01T00:00:00.000+05:30</null>
    <null>2008</null>
    <null>68</null>
    <null>\\01hw180464\MOTO\database_help.txt</null>
    </null>
    <null>
    <null>database_search.txt</null>
    <null>2007-12-03T00:00:00.000+05:30</null>
    <null>2007</null>
    <null>365</null>
    <null>\\01hw180464\MOTO\database_search.txt</null>
    </null>
    </null>
    </ProcessResponse>
    whereas the output shown in Invoke in the visual flow is
    <messages>
    -<Invoke_1_Callin_Db_InputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="InputParameters">
    -<InputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/VODAT/BPEL_CALLIN_DB/MOTOROLA_BSC_DB-24VIEW_MOTOROLA/">
    <IN_FILENAME/>
    </InputParameters>
    </part>
    </Invoke_1_Callin_Db_InputVariable>
    -<Invoke_1_Callin_Db_OutputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    -<db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/VODAT/BPEL_CALLIN_DB/MOTOROLA_BSC_DB-24VIEW_MOTOROLA/">
    -<MYCURSOR>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_K_DKL_NW02
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-07T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>3435
    </FILE_SIZE>
    <FILE_PATH>http://www.google.com
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_config.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2006-03-14T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2006
    </CREATION_TIME>
    <FILE_SIZE>342345
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_config.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_help.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-01T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>68
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_help.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_search.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2007-12-03T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2007
    </CREATION_TIME>
    <FILE_SIZE>365
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_search.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    </MYCURSOR>
    </db:OutputParameters>
    </part>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]
    </part>
    </Invoke_1_Callin_Db_OutputVariable>
    </messages>
    and the output shown in ReplyOutput is :-
    <outputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    -<ProcessResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.example.org">
    -<MYCURSOR xmlns="">
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_K_DKL_NW02
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-07T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>3435
    </FILE_SIZE>
    <FILE_PATH>http://www.google.com
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_config.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2006-03-14T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2006
    </CREATION_TIME>
    <FILE_SIZE>342345
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_config.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_help.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2008-07-01T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2008
    </CREATION_TIME>
    <FILE_SIZE>68
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_help.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    -<MYCURSOR_ITEM>
    <SOFTWARE_PKGS>database_search.txt
    </SOFTWARE_PKGS>
    <CREATION_DATE>2007-12-03T00:00:00.000+05:30
    </CREATION_DATE>
    <CREATION_TIME>2007
    </CREATION_TIME>
    <FILE_SIZE>365
    </FILE_SIZE>
    <FILE_PATH>\\01hw180464\MOTO\database_search.txt
    </FILE_PATH>
    </MYCURSOR_ITEM>
    </MYCURSOR>
    </ProcessResponse>
    </part>
    </outputVariable>
    Can you please tell me why am i getiing null value in my output xml in my BPEL console??
    What is the solution?where do i need to change the db: prefix?

  • Need help on syntax of PL/SQL Table type

    Hi Everyone
    I have the following Procedure
    DECLARE
    TYPE ln_empno IS TABLE OF NUMBER;
    ln_empno1 ln_empno;
    dml_errors EXCEPTION;
    PRAGMA EXCEPTION_INIT (dml_errors, -24381);
    ERRORS NUMBER;
    BEGIN
    UPDATE emp
    SET empno = empno
    RETURN empno
    BULK COLLECT INTO ln_empno1;
    FORALL idx IN 1 .. ln_empno1.COUNT SAVE EXCEPTIONS
    INSERT INTO t1
    VALUES (ln_empno1 (idx));
    EXCEPTION
    WHEN dml_errors
    THEN
    ERRORS := SQL%BULK_EXCEPTIONS.COUNT;
    FOR i IN 1 .. ERRORS
    LOOP
    DBMS_OUTPUT.put_line ( 'Error '
    || i
    || ' occurred during '
    || 'iteration '
    || SQL%BULK_EXCEPTIONS (i).ERROR_INDEX
    DBMS_OUTPUT.put_line ( 'Oracle error is '
    || SQLERRM (-SQL%BULK_EXCEPTIONS (i).ERROR_CODE
    END LOOP;
    END;
    This will collect the single column, I am not able to get the syntax to create a record containg empno and ename and bulk collect into a collection type.
    Can anyone help me to execute this procedure for ln_empno as a record of empno and ename.
    Thanks in Advance
    -Ahmed

    Also,
    If you want it as an update then why not just alter as per my example... e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    TYPE lt_emp_rec IS RECORD (empno NUMBER, deptno NUMBER);
      3    TYPE lt_emp IS TABLE OF lt_emp_rec INDEX BY PLS_INTEGER;
      4    lr_emp lt_emp;
      5  BEGIN
      6    UPDATE emp
      7    SET deptno = deptno+10
      8    RETURNING empno, deptno
      9    BULK COLLECT INTO lr_emp;
    10    FOR idx IN 1 .. lr_emp.COUNT
    11    LOOP
    12      DBMS_OUTPUT.PUT_LINE('EmpNo: '||to_char(lr_emp(idx).empno)||' ::: DeptNo: '||to_char(lr_emp(idx).deptno));
    13    END LOOP;
    14* END;
    SQL> /
    EmpNo: 7369 ::: DeptNo: 30
    EmpNo: 7499 ::: DeptNo: 40
    EmpNo: 7521 ::: DeptNo: 40
    EmpNo: 7566 ::: DeptNo: 30
    EmpNo: 7654 ::: DeptNo: 40
    EmpNo: 7698 ::: DeptNo: 40
    EmpNo: 7782 ::: DeptNo: 20
    EmpNo: 7788 ::: DeptNo: 30
    EmpNo: 7839 ::: DeptNo: 20
    EmpNo: 7844 ::: DeptNo: 40
    EmpNo: 7876 ::: DeptNo: 30
    EmpNo: 7900 ::: DeptNo: 40
    EmpNo: 7902 ::: DeptNo: 30
    EmpNo: 7934 ::: DeptNo: 20
    PL/SQL procedure successfully completed.
    SQL>Was that so hard?

  • 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

  • SQL table type - How to retrieve in Java?

    Hello,
    I need to return a SQL object to Java from a PL/SQL function.
    In PL/SQL, sample code to create the scalar types, function and calling script would be:
    CREATE OR REPLACE TYPE tMessage AS OBJECT (tType CHAR(20), tText VARCHAR2 (400));
    CREATE OR REPLACE TYPE tMessage_Table AS TABLE OF tMessage;
    CREATE OR REPLACE FUNCTION Return_Message RETURN tMessage_Table AS
    vTable tMessage_Table;
    BEGIN
    vTable := tMessage_Table(NULL);
    vTable.Extend(1);
    vTable(1) := tMessage ('Header', 'Business Rule');
    vTable.Extend(1);
    vTable(2) := tMessage ('Phn', '9053098461');
    -- Output the data to reporting caller
    RETURN vTable;
    END Return_Message;
    DECLARE
    vTmp_Track tMessage_Table;
    BEGIN
    vTmp_Track := Return_Message;
    FOR i IN 1..vTmp_Track.Count LOOP
    DBMS_OUTPUT.PUT_LINE (vTmp_Track(i).tType);
    DBMS_OUTPUT.PUT_LINE (vTmp_Track(i).tText);
    DBMS_OUTPUT.PUT_LINE (' ');
    END LOOP;
    END;
    Is there a way in Java to declare and retrieve an object of type tMessage_Table?
    The only other way I can think of doing this would be to create a table and a ref cursor to browse over it, which I can read back from Java.
    Thank you.

    25266,
    Following code was executed using JDK 1.4.2_07, Oracle 9i (9.2.0.4) database, and "ojdbc14.jar" JDBC (thin) driver:
    [Note that I used your "type" definitions and PL/SQL function.]
    import java.sql.Array;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.Struct;
    import java.sql.Types;
    import java.util.Arrays;
    public class SqlStruc {
      public static void main(String[] args) {
        CallableStatement cs = null;
        Connection dbConn = null;
        String url = "jdbc:oracle:thin:scott/tiger@host:1526:orcl";
        try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
          dbConn = DriverManager.getConnection(url);
          cs = dbConn.prepareCall("{? = call RETURN_MESSAGE()}");
          cs.registerOutParameter(1, Types.ARRAY, "T_MSG_TBL");
          cs.execute();
          Object obj = cs.getObject(1);
          System.out.println(obj);
          if (obj != null) {
            System.out.println("Class: " + obj.getClass().getName());
          Array arr = (Array) obj;
          Object[] objArr = (Object[]) arr.getArray();
          for (int i = 0; i < objArr.length; i++) {
            Struct struct = (Struct) objArr;
    Object[] attrs = struct.getAttributes();
    System.out.println(Arrays.asList(attrs));
    catch (Exception x) {
    System.err.println("SqlStruc: Exception caught.");
    x.printStackTrace();
    finally {
    if (cs != null) {
    try {
    cs.close();
    catch (Exception x) {
    System.err.println("Failed to close statement.");
    x.printStackTrace();
    if (dbConn != null) {
    try {
    dbConn.close();
    catch (Exception x) {
    System.err.println("Failed to close database connection.");
    x.printStackTrace();
    And results were:
    oracle.sql.ARRAY@166a22b
    Class: oracle.sql.ARRAY
    [Header              , Business Rule]
    [Phn                 , 9053098461]Good Luck,
    Avi.

  • Passing parameters to the SQL Report from a text box in jsp

    Hi All,
    I want to dynamically generate the SQL Server Reporting Services by passing the query parameter from the url like this :
    "http://localhost/Reports/Pages/Report.aspx?ItemPath=%2fDashboardReports%2fHorse_Profile&rs:Command=Render&rs:HorseID=117415"
    Where horseid id my parameter which is needed by report to generate the required data.
    This query paramter value is picked from the text box on my jsp page.
    But my problem is when i go to this url it says the message
    "The 'HorseID' parameter is missing a value ".
    I have done a lot of search on this topic. Everybody says that we can pass the values from the url like i am using. But still its not working.
    Any body has any idea please give me some idea.
    Regards.

    If you receive a picture via email or text message in ios 7 and when you press the action icon to save the picture and you do not get the option to save to your camera roll. Press and hold on the the image and you will get an overlay pop up to save the image. I have no idea why some attachments don't have option in action menu to save in the camera roll but by experimentation and earned frustration I found the above to work in certain situations.
    Be well and have fun and feel rewarded in your frustrations. For without challenges, life would be an utter bore.

  • 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 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                                                                                                                                                                                                                                                                                                                                                       

  • DB Adapter not returning all columns from a sql table type

    Using Soa Suite 10.1.3.4.
    Calling DB Adapter from bpel to a database package procedure with an OUT NOCOPY parameter based on a TABLE OF type.
    It works fine except that I only get the first 14 columns out of 55.
    Can query all columns from Sqldeveloper or Sqlplus.
    XML skema reflects all columns correct.
    Same result without NOCOPY in parameter.
    HaveI missed some details/limitations?

    hi
    here is how I solved it.
    first create custom view that will find all requred data.
    in my case it was
    tables :
    ADRCITYT
    ADRCITY
    ADRPCDCITY
    T005S
    T005U
    joins :
    ADRCITY     CLIENT     =     ADRCITYT     CLIENT
    ADRCITY     COUNTRY     =     ADRCITYT     COUNTRY
    ADRCITY     CITY_CODE     =     ADRCITYT     CITY_CODE
    ADRCITY     CLIENT     =     ADRPCDCITY     CLIENT
    ADRCITY     COUNTRY     =     ADRPCDCITY     COUNTRY
    ADRCITY     CITY_CODE     =     ADRPCDCITY     CITY_CODE
    T005S     MANDT     =     ADRCITY     CLIENT
    T005S     BLAND     =     ADRCITY     REGION
    T005S     MANDT     =     T005U     MANDT
    T005S     LAND1     =     T005U     LAND1
    T005S     BLAND     =     T005U     BLAND
    and finaly searh help
    ORT01     3     3     PAD_ORT01
    CITY_CODE     0     2     CITY_CODE
    PSTLZ     1     1     PSTLZ_HR
    STATE     4     4     REGIO
    BEZEI     5     5     BEZEI20
    COUNTRY     0     6     LAND1
    LANGU     0     7     LANGU

  • Passing parameters in pl/sql concurrent request

    hi..
    i want to add parameters in the code of concurrent programe that we are registering from the back end..
    IF p_status = 'CL' THEN*/
    v_id := FND_REQUEST.SUBMIT_REQUEST('AR'
         ,'XRAXINV_SEL'
         ,SYSDATE
         ,FALSE
         ,'TRX_NUMBER','Yes','' ,'' , p_trx_number, p_trx_number, p_cust_trx_id,'' ,'' ,'' ,'' ,'' , 'N', 'N', '', 'SEL', 1, 'N',10, '','' ,''
    this is the registered code for this i want to add parameters..

    This has nothing to do with the SQL and PL/SQL languages - and sounds like you're dealing with a product called Oracle Applications or something or another.
    Wrong forum for that. Please have a look at the forum indexes and ask product related questions in the correct forum.
    Please close this thread.
    Thanks.

  • How to pass parameters to a SQL query or Data template

    Hi,
    The requirement is that my final report will take 'date' as input from the user and print only those records which have date later than the user-supplied 'date'. ('Date' is a field in the database).
    I know the way to achieve this is to use user-defined parameters.
    I have read the user guide, and have created user parameters. From the user guide: "The Report Editor allows you to define your query, define
    the parameters that you want users to pass to the query,..."
    However there is no example given. (I could not find).
    Any guidance?

    Are you using Enterprise Server environment ? If so, you can find a sample report in the Shared Folders under HR Manager - Employee Salary Report. Please revert if you still have confusion.

Maybe you are looking for

  • Fonts in mail have gone screwy

    after installing a bunch of fonts, I opened mail and when I type out a message it comes out in a totally different unreadable font. I fixed it in preferences, but I can't find a way to fix it in the top area (to:, from:, date:, etc...) any ideas??? t

  • How to display text in script as same as text in news paper

    Hi Expets I have a requirement i need to display text in script as same as text displayed in news paper with out creating any windows. iie ( Abcdef should be in one cloum after some space i need to display 1234) please let me know how can i achieve t

  • Configure SLD service user roles

    Hello to all, we set up a system landscape directory. Now I want to connect a new system to it. The guide told me to set up to HTTP destinations. SLD_DataSupplier with user SLD_DS_<SID> SLD_Client with user SLD_CL_<SID> Up to now we've used the user

  • PeopleCode Evaluate Statement

    I want to write people code, kind of like the following, so I can validate the data entry for a specific edit field. The validation must go against a view. This obviously errors or, does anyone know of an alternative where something like the followin

  • Is there a device I can buy to prevent lost time loading add-ons at public libraries?

    I'm only self-taught via trial and error in internet browsing. My access to the web is at various public libraries. Each time I log in, the library pc makes me go thru the time consuming process of loading 8 or 9 add-ons. I suspect there might be a s