How to insert object values into table.

Hi All,
I have a problem with passing java object to procedure. Procedure is running properly when I execute in oracle,but it is not executing when I call from Java.
I am getting Error :
java.sql.SQLException: invalid name pattern: Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY
     at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
     at oracle.jdbc.oracore.OracleTypeADT.initMetadata(OracleTypeADT.java)
     at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java)
     at oracle.sql.ArrayDescriptor.initPickler(ArrayDescriptor.java)
     at oracle.sql.ArrayDescriptor.<init>(ArrayDescriptor.java)
     at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java)
     at JavaObjectToOracle.main(JavaObjectToOracle.java:31)
Here I am copying my procedure,oracle version is 9i.
Package specification:
CREATE OR REPLACE PACKAGE Pkg_Bulk_Insert AS
TYPE ITW_EMP_OBJ_ARRAY IS VARRAY(20) OF VARCHAR2(200);
PROCEDURE BULK_INSERT_TEST(strTable IN ITW_EMP_OBJ_ARRAY);
END Pkg_Bulk_Insert;
package body:
CREATE OR REPLACE PACKAGE BODY Pkg_Bulk_Insert AS
PROCEDURE BULK_INSERT_TEST(strTable IN ITW_EMP_OBJ_ARRAY) AS
i BINARY_INTEGER;
BEGIN
FORALL i IN 1..strTable.COUNT
INSERT INTO TEMP(NAME)
VALUES(strTable(i));
COMMIT;
END BULK_INSERT_TEST;
END Pkg_Bulk_Insert;
Here I am invoking the procedure:
DECLARE
x Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY;
BEGIN
x := Pkg_Bulk_Insert.ITW_EMP_OBJ_ARRAY('A','B','C');
Pkg_Bulk_Insert.BULK_INSERT_TEST(x);
DBMS_OUTPUT.PUT_LINE('AFTER INSERTION');
END;
Please any body can help me on this regard.

Your PL/SQL seems reasonable.
My suspicion would be that the oracle.sql.ArrayDescriptor.createDescriptor class only supports persistent collection types, i.e. those declared at the schema level with CREATE TYPE.

Similar Messages

  • Sqlloader: how to insert -ve value into table

    hi..
    i had problem during loading. The error is Record 1: Rejected - Error on table FILE01, column AMOUNT.
    ORA-01722: invalid number
    For AMOUNT, the datatype is number(20,2).
    here is my .ctl
    LOAD DATA
    INFILE 'file1bp0103.txt'
    BADFILE 'file01.bad'
    APPEND
    INTO TABLE file01
    acct_no POSITION(01:13),
    amount POSITION(14:28),
    description POSITION(29:32)
    my .dat file
    A500000030401- 32.74PYMT
    A500000320106- 46.95PYMT
    A500000520408- 63.95PYMT
    A500000610301- 12.99PYMT
    A500001720110- 56.21PYMT
    A500001800103- 55.65PYMT
    A500002000109- 27.25PYMT
    A500002000305- 53.35PYMT
    A500002080210- 75.04PYMT
    A500002250106- 103.38PYMT
    A500002500104- 60.69PYMT
    A500002620902- 509.77PYMT
    A500002621010- 398.69PYMT
    what is the problem? is it because of my datatype?
    please help me..
    TQ

    Is there a need to use dynamic sql here?
    at the very least, try using bind variables instead of concatenating values like that.
    EXECUTE IMMEDIATE 'insert into your_table (column_list) values (:val1, :val2, ...)'
    USING l_val1, l_val2, l_val3 ... ;

  • How to insert column values into database as rows

    Hi,
    I have 8 columns and some not null columns. Based on not null columns I want to insert into table as rows. The 8 columns may contain values or no value. If the first column contains data, then I have to insert into one row. if the second column contains data I have to insert a row and in second column. respectively...So How can I insert column values into rows. Can I write 8 insert statements. (OR) is it possible to insert data from columns using where clause.
    Please help me out....
    Thanks in Advance

    Lines Table:
    line_id, orcl_bank_account_num, product_type, service_type, lease_type,
    funding_type, cpi, billing_frequency_unit_cd , annual_due_date ,
    pricing_start_date, pricing_end_date, install_date, contract_end_date ,
    prdct_replacement_cost_amt, cradle_replacement_amt, supranet_contract,
    issuance_fee, board_inactive_date, header_id, creation_date, last_modified_date,
    created_by_nam, modified_by_nam, activeinactive_flg, prdct_bill_amt_yr1,
    prdct_bill_amt_yr2, prdct_bill_amt_yr3, prdct_bill_amt_yr4, prdct_bill_amt_yr5,
    prdct_bill_amt_yr6, prdct_bill_amt_yr7, prdct_bill_amt_yr8, activation_fee_yr1,
    activation_fee_yr2, activation_fee_yr3, activation_fee_yr4, activation_fee_yr5,
    activation_fee_yr6, activation_fee_yr7, activation_fee_yr8,
    In this table the columns structure is :
    -- PRDCT_BILL_AMT_YR (1 to 8) NUMBER(14,4)
    -- ACTIVATION_FEE_YR (1 to 8) NUMBER(8,2)
    I have one more table:
    PRDCT_INS_AMT               NUMBER(14,4)
    ACTIVATION_FEE_AMT          NUMBER(14,4)
    I want to insert prdct_bill_amt_yr (1 to 8) columns data into PRDCT_INS_AMT column. similarly activation_fee (1 to 8) columns data.
    But the data should be inserted based product_type, service_type, lease_type columns values. (These 3 columns may contain upto 45 combinations).

  • How to insert a value into a field of binary type?

    I've been using Oracle for a while now but never dealt with BLOB
    or long raw type before. Does anyone here know how to insert a
    record into a field of either blob or long raw type?
    Any suggestions would be very appreicated.
    Thanks.

    pls used the loadfromfile procedure which is in the DBMS_LOB
    package to insert the data from external os file into blob data
    type column.
    Kunjan

  • How to insert data with & into table..

    Hi,
    i want to insert following data to table
    sql>insert into emp values('company & co');
    Enter value for co:
    how to avoid this ?

    You should disable the interactive prompt in SQL Plus. How to do check this link
    http://www.orafaq.com/wiki/SQL*Plus_FAQ#How_does_one_disable_interactive_prompting_in_SQL.2APlus.3F

  • How to insert parameter value into multiple columns and rows

    Hi All,
    I have one procedure insert_tab and I am passing
    100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
    Table:
    Col1 Col2 Col3
    100 101 102
    103 104 105
    106 107 108
    Awaiting for your reply..

    That's not more clear for me...
    Anyway, if you really want a procedure for that, try :
    SQL> create table tblstr (col1 number,col2 number,col3 number);
    Table created.
    SQL>
    SQL> create or replace procedure insert_fct (p_string IN varchar2)
      2  as
      3  v_string     varchar2(4000):=p_string||':';
      4  v_substring  varchar2(4000);
      5 
      6  begin
      7      while instr(v_string,':') > 0 loop
      8            v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
      9            insert into tblstr(col1,col2,col3)
    10            values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
    11                    substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
    12                    substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
    13            v_string:=substr(v_string,instr(v_string,':')+1);
    14      end loop;
    15  end;
    16  /
    Procedure created.
    SQL>
    SQL> show err
    No errors.
    SQL>
    SQL> select * from tblstr;
    no rows selected
    SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
    SQL> exec insert_fct('109~~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~110~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~~111')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
           109
                      110
                                 111
    6 rows selected.
    SQL> Nicolas.

  • How to insert a value into a table

    I have an ordering system. It displays all the orders by
    customer ID. If an order is complete, a check number is entered for
    the corresponding line item, otherwise it is left blank.
    My code uses the following code to display the form. All are
    display fields only, except for the last one, where the check
    number can be entered.
    <cfoutput query="qryDetail" group="partNumber">
    <tr>
    <td valign="top" class="TitleText"
    align="center">#lineItem#</td>
    <td valign="top" class="TitleText"
    align="center">#OrderNumber#</td>
    <td valign="top" class="TitleText"
    align="center">#partNumber#</td>
    <td valign="top" class="TitleText"
    align="center">#dollarformat(qryDetail.unitValue)#</td>
    <td valign="top" class="TitleText" align="center">
    <cfinput type="text" name="checkNumber#keyID#">
    <input type="hidden" name="keyID"
    value="#qryDetail.keyID#">
    </td>
    I use something like the following to update the table with
    the check numbers entered.
    <cfloop index="KeyID" list="#form.KeyID#"
    delimiters=",">
    <cfquery name="qryUpdate" datasource="dbName">
    update tblChecks
    set checkNumber = '#Evaluate("form.checkNumber#KeyID#")#'
    where custID = '#form.custID#'
    and KeyID = '#KeyID#'
    </cfquery>
    </cfloop>
    Now we have another table that will contain the customer
    order history. If the check number was entered for a particular
    line item, I need to insert that line item nubmer into this table,
    along with some other columns. I tried to use the same loop, then
    other loops, but cannot seem to get this to work. Seems simple
    enough, but I obvisouly am missing something.
    How would I insert the line item number (only if a check
    number was entered for that line item) into the table ?

    Here is the code with the queries commented out :
    <cfloop list="#form.fieldnames#" index="field">
    <cfif left(field, 11) is "checkNumber" AND
    len(trim(form[field]))>
    <cfset keyID = listlast(field, '_')>
    <cfset lineItem = listgetat(field, 2, '_')>
    <cfset checknum = form[field]>
    <!---cfquery name="qryUpdate" datasource="dbName">
    UPDATE tblChecks
    SET checkNumber = '#checknum#'
    WHERE custID = #form.custID#
    AND KeyID = #keyid#
    </cfquery--->
    <cfoutput> loop is
    field: <b>#field#</b><br>
    checknum: #checknum#<br>
    lineitem: #lineitem#<br>
    keyID: #keyID#<br>
    </cfoutput>
    <cfelse>
    <cfoutput>Else is
    field: <b>#field#</b><br>
    form[field]: #form[field]#<br>
    len: #len(trim(form[field]))#<br>
    </cfoutput><cfabort>
    </cfif>
    </cfloop>
    This is the output. If I do not put in cfabort, the code just
    drops thru and I never see any output display, so I use cfabort to
    stop so I can see the output.
    loop is field: CHECKNUMBER_11_218
    CHECKNum: xxxxxxxxxxxxxxxxxxxx
    lineitem: 11
    keyID: 218
    Else is field: CHECKNUMBER_1_24
    form[field]:
    I entered the x's into checknum for line item 11, so that is
    correct.
    I then took out the comments from the update query and tried
    it again and it updated for line item 11 (you were right, I had to
    take out the single quotes in the query). I then removed the
    commets for the insert query and it did not insert. I tried the
    whole thing again and tried to add to line item 10 and it dropped
    straight to the else part, displaying :
    Else is field: CHECKNUMBER_1_24
    form[field]:
    len: 0
    So it seems the if statement if failing the second time thru
    the loop :
    <cfif left(field, 11) is "checkNumber" AND
    len(trim(form[field]))>
    This is my input statement :
    <cfinput type="text"
    name="checkNumber_#lineItem#_#keyID#">
    I am really confused now. It seems to work the first time
    thru the loop, then the second time it fails.

  • How to insert date value into oracle?

    hi,
    iam reading date from xml using vb.net and inserting it into oracle table.
    the date value in xml file is in the format of "01012003".
    i want to insert into oracle table.but iam getting an error "ORA-1843: not a valid month".
    how to solve this problem.
    Any suggestions or examples...

    That's not a date. It's just a string. Convert it to a date using,
    DateTime d = DateTime.ParseExact("01022003", "MMddyyyy", null);
    or
    Dim d As DateTime = DateTime.ParseExact("01022003", "MMddyyyy", Nothing)
    and then bind it to a parameter. ODP.NET will take it from there.
    You should never be hard-coding the date literal into your SQL query.
    David

  • How to insert the '&' character into table which is between in a string

    SQL> create table s(ss varchar(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss varchar2(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss nvarchar2(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss char(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    SQL> drop table s;
    Table dropped.
    SQL> create table s(ss nchar(10));
    Table created.
    SQL> insert into s values('2 & 3');
    Enter value for 3:
    old 1: insert into s values('2 & 3')
    new 1: insert into s values('2 ')
    1 row created.
    SQL> select * from s;
    SS
    2
    Edited by: user10438587 on 06-Jan-2009 07:57

    Here is one way ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.41
    satyaki>
    satyaki>
    satyaki>select '2 '||chr(38)||' 3' res from dual;
    RES
    2 & 3
    Elapsed: 00:00:00.20
    satyaki>Regards.
    Satyaki De.

  • How to insert new value into an array

    I have an already declared array (including the size) and want to write a method for inserting a new value. Do I have to re-declare the array to the new size? ie old size + 1, then add the new value or is there a java method for this. I can't find one.
    Thanks in advance....
    Mike

    Hi,
    there is no method for that. Look up class Vector. That class implements automatic growing of the Vector.
    Phil

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • How to insert  Legacy data into QP_RLTD_MODIFIERS table?

    How to insert  Legacy data into QP_RLTD_MODIFIERS table in R12 instance.

    I would use the API QP_Modifiers_PUB.Process_Modifiers for pushing legacy pricing data into R12.  QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environnment, only promos have data in this table).

  • How to insert varchar2 value in timestamp column in table?

    Hi all,
    Hope doing well,
    sir i am using one stored procedure and storing time in varchar2 variable in this format: 08:00:00
    now i have to insert this value in timestamp column in table. how to insert this value in timestamp column?
    thanks

    952646 wrote:
    Hi all,
    Hope doing well,
    sir i am using one stored procedure and storing time in varchar2 variable A "Very Bad Idea"(tm)
    When you do this, there is no fundamental difference between "08:00:00" and "here's your sign".
    Data should always be stored in the correct data type. For dates and times, that data type is either DATE or TIMESTAMP. Period.
    in this format: 08:00:00
    now i have to insert this value in timestamp column in table. how to insert this value in timestamp column?
    Hopefully as remediation to the original bad design.
    thanks

  • How to insert a value from sequence in Bussiness Components?

    How to insert a value from sequence in Bussiness Components?
    I would like to do it, but without a triger that would do it before insert.
    I know that there is a type DBSequence in BC where you can insert a sequence name but it does not work when I type there my sequence name.
    Do you now how to fix that problem?
    Bart.

    The newer way to do it is to make the type DBSequence and enter the name of the Sequence object in the sequence field. It must match the same name of the sequence object in the database. Next, you have to create a before insert for each row trigger on the table. Basically, something like this:
    CREATE OR REPLACE TRIGGER TGB_THEME_SEQ
    BEFORE INSERT ON THEME
    FOR EACH ROW
    DECLARE
    BEGIN
    -- Assign the id from the sequence if null
         IF( :new.theme_id IS NULL ) THEN
              SELECT THEME_ID_SEQ.nextval
              INTO :new.theme_id
              FROM dual;
         END IF;
    END;
    In the above example, THEME_ID_SEQ is the seuence object name in the database. If you have the name right but it still fails, then the user you are logging in as probably doesn't have access to the sequence in the database.
    Hope this helps.
    Erik

Maybe you are looking for

  • Where is old ImageReady Layers to Files functionality?

    Back in CS2 in ImageReady (now long gone from the Adobe lineup) there was the ability to efficiently export the layers in a Photoshop doc to individual layers. It did this very very quickly and it gave you a TON of control on how the files were named

  • Clickboxes in Sliderocket

    Hello, We are using Sliderocket to publish our SWF files in order to track their usage. Despite clicking the setting in SlideRocket to "Allow SWF to handle clicks" when adding the SWF to a slide, it does not work. I am able to embed the SWF and it wi

  • Firefox does not save my settings when I reboot

    I have Windows 7 Ultimate. I was having problems with Firefox 3.6.16 crashing to the point where it wouldn't work. I uninstalled it and downloaded version 4 but had problems with it hanging all the time. I went through the help section, one of the th

  • WHY IS COMMAND OPTION A MISSING ?

    OK, for you knowlagable (Spelling?) I wanted to display my YouTube Activities but my Command Option A isn't bringing up the activities window. Has anyone else ever experienced this? How do I get it back? I appreciate any help. Thanks PS, I see my spe

  • "Lossless" exporting of a .mov

    Hi! Is there a way to export a .mov file out of adobe premier pro as "lossless"? Any insight is appreciated! Thanks!