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.

Similar Messages

  • To display comma separted value into multiple column

    Hi,
    I want to display value into multiple column like below
    data is like this
    col1
    res_menaHome:MenaHome
    res_menaHomeEmp:MenaHome Employee
    res_MDSpecialSer:MD Special Services
    res_Smart:Smart
    now i want to display like
    col1 col2
    res_menaHome MenaHome
    res_menaHomeEmp MenaHome Employee
    res_MDSpecialSer MD Special Services
    res_Smart Smart
    Thanks in advance.

    You mean like this?
    with q as (select 'res_menaHome:MenaHome' myString from dual)
    select substr(myString, 1, instr(myString, ':') - 1) col1,
    substr(myString, instr(myString, ':') + 1) col2
    from q
    COL1,COL2
    res_menaHome,MenaHome

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

  • Multiple columns and rows in MessageService

    I am attempting to create a message (via MessageService) which has multiple lines of data, and each line has multiple data columns.
    Background:  My program reads data from a web store, and creates Sales Orders in SBO.  A single run might process multiple orders.  When all orders have been entered, the program should send a (single) message to a list of recipients.  The message will have one line of data for each sales order produced.  Each line will contain two fields: the linked SBO sales order number, and the unlinked web order number.
    When the message is initially created, I'm defining the multiple columns and initializing the data lines:
    pMessageDataColumns = oMessage.MessageDataColumns
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "SalesOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tYES
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "WebOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tNO
    oLines = pMessageDataColumn.MessageDataLines()
    Later, as each Sales Order is processed, I'm attempting to inject the two data values into the message data:
    oLine = oLines.Add()
    oLine.Value = Str(pOrd.DocNum)
    oLine.Object = 17
    oLine.ObjectKey = Str(pOrd.DocEntry)
    oLine = oLines.Add()
    oLine.Value = pOrd.WebOrder
    The above code would be invoked for each Sales Order processed.  However, it generates an "Internal error (-5002) occurred" when the message is ultimately sent.
    The SDK documentation states:
    The MessageDataLine is a child data structure related to the MessageDataColumn. It contains the value of a specified cell in the Data table, which is defined by its column number (vtIndex of Item of MessageDataColumns) and row number (vtIndex of Item of MessageDataLines).
    I guess I don't understand the relationship between adding a "line" in my data display versus adding data into a "column".  It appears that the "oLines.Add()" is used to bump across the columns of the data.  If so, how do I advance to the next entire row of data in the message?
    Thanks, Dave

        Class Item
            Public ItemCode As String
            Public Dscription As String
        End Class
    Dim ItemCodes as new list( of item)
    Dim one as new item
    one.ItemCode = "ItemCode"
    one. Dscription ="Name of Item"
    itemcodes.add (one)
            Try
                Dim oCmpSvc As SAPbobsCOM.CompanyService = _ocmp.GetCompanyService()
                Dim oMsgSvc As SAPbobsCOM.MessagesService = oCmpSvc.GetBusinessService(ServiceTypes.MessagesService)
                Dim oMsg As SAPbobsCOM.Message = oMsgSvc.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)
                oMsg.Subject = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                oMsg.Text = Msg
                Dim oMsgDataColumn As SAPbobsCOM.MessageDataColumn
                If ItemCodes.Count > 0 Then
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Product / Item Code"
                    oMsgDataColumn.Link = BoYesNoEnum.tYES
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Object = "4"
                        oMsgDataLine.ObjectKey = oneitem.ItemCode
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Description"
                    oMsgDataColumn.Link = BoYesNoEnum.tNO
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                End If
                        Dim oMsgRecipient As SAPbobsCOM.Recipient = oMsg.RecipientCollection.Add()
                        oMsgRecipient.UserCode = "manager"
                        oMsgRecipient.SendInternal = BoYesNoEnum.tYES
                        oMsgRecipient.SendEmail = BoYesNoEnum.tNO
                oMsgSvc.SendMessage(oMsg)
                MsgBox("SAP B1 internal Message sent...")
            Catch ex As Exception
                MsgBox("Unable to send SAP B1 internal message. Error:" + ex.Message)
            End Try
        End Sub

  • How to insert a UUID into multiple tables in the same form

    I am trying to insert a UUID into 2 different tables at the
    same time ie to let this be created in the form and then insert
    this ID into 2 linked tables in a database using Access.
    Does anybody have any suggestions on how to accomplish this?
    Thanks very much

    So you have one form that processes information for two
    tables, or do you
    have two forms (one for each table - except the UUID)?
    If it is one form just run two SQL insert statements. One for
    the primary
    table, then one for the related table.
    If it is two forms run the above two SQL statements then an
    update statement
    to finish filling the second table.
    Or am I completely misunderstanding the issue?
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) ::
    http://www.adobe.com/communities/experts/
    "weelco" <[email protected]> wrote in
    message
    news:esjtjj$qtc$[email protected]..
    > Thanks for your quick reply, and yes I do know how to do
    that however I
    > would
    > like to do this all in one form field so I would like to
    create the UUID
    > whith
    > the same form that also submits it to another table, is
    this possible or
    > do I
    > have to do that using multiple 'pages'?
    >

  • How to insert embedded image into TextArea htmlText (and add IOErrorEvent.IO_ERROR listener).

    I unsuccessfully tried to find way to insert embedded image into TextArea via <img> tag. Can you point me out how to do this?
    Also, please, tell me how to handle IOErrorEvent from TextArea because adding IOErrorEvent.IO_ERROR listener to TextArea doesn't cause any effect when image url of img tag has not been found.
    Thanks

    i 've successfully inserted the image into the database... here is my code
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.io.File;
    import java.io.FileInputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class Browse_java
    static Connection con=null;
    public static void main(String args[])
    try{
    System.out.println("(browse.java) just entered in to the class");
    con = new PMS.DbConnection().getConnection();
    System.out.println("(browse.java) connection string is"+con);
    PreparedStatement ps = con.prepareStatement("INSERT INTO img_exp VALUES(?,?)");
    System.out.println("(browse.java) prepare statement object is"+ps);
    File file =new File("C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    FileInputStream fs = new FileInputStream(file);
    byte blob[]=new byte[(byte)file.length()];
    fs.read(blob);
    ps.setString(1,"C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    ps.setBytes(2, blob);
    System.out.println("(browse.java)length of picture is"+fs.available());
    int i = ps.executeUpdate();
    System.out.println("image inserted successfully"+i);
    catch(Exception e)
    e.printStackTrace();
    finally
    try {
    con.close();
    } catch (SQLException ex) {
    ex.printStackTrace();
    }

  • 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

  • Problem inserting clob value into xmltype column

    Hi all,
    I have created a table in XML DB using as:
    CREATE TABLE TransDetailstblCLOB ( id number, data_xml XMLType) XmlType data_xml STORE AS CLOB;
    I am trying to insert large xml data into the data_xml column which is of type XMLTYPE.
    I followed this link (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html) to create a clob object and insert into xml.
    I am getting the following error:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00229: input source is empty
    Error at line 0
    ORA-06512: at "SYS.XMLTYPE", line 254
    ORA-06512: at line 1
    My code snippet:
    private static CLOB getCLOB(String xmlData, Connection conn) throws SQLException{
         CLOB tempClob = null;
         if(conn==null){
              log.debug("Connection object is null");
              throw new SQLException("Connection object is null");
         try{
         // If the temporary CLOB has not yet been created, create new
         tempClob = CLOB.createTemporary(conn, true, CLOB.MODE_READWRITE);
         // Open the temporary CLOB in readwrite mode to enable writing
         tempClob.open(CLOB.MODE_READWRITE);
         // Get the output stream to write
         writer = tempClob.getCharacterOutputStream();
         writer.write(xmlData);
         } catch(SQLException sqlexp){
              tempClob.freeTemporary();
         sqlexp.printStackTrace();
         } catch(Exception exp){
         tempClob.freeTemporary();
         exp.printStackTrace();
         return tempClob;      
    public static void insertXML(String xmlData, Connection conn){
         CLOB clob = null;
         String query;
         log.debug("Inside insertXML" +xmlData);
         try{
         query = "INSERT INTO TransDetailstbl1(data) VALUES (XMLType(?)) ";// Changed prev TransDetailstbl
         // Get the statement Object
         pstmt = conn.prepareStatement(query);
         //      xmlData is the string that contains the XML Data.
         // Get the CLOB object using the getCLOB method.
         clob = getCLOB(xmlData, conn);
         // Bind this CLOB with the prepared Statement
         pstmt.setObject(1, clob);
         int i =pstmt.executeUpdate();
         log.debug("pstmt.executeUpdate () status ::: "+i);
         // Execute the Prepared Statement
         if (i == 1) {
         log.debug("Record Successfully inserted!");
         } catch(SQLException sqlexp){
         sqlexp.printStackTrace();
         } catch(Exception exp){
         exp.printStackTrace();
         finally{
              try{
                   pstmt.close();
    //           Flush and close the stream
                   writer.flush();
                   writer.close();
              // Close the temporary CLOB
              tempClob.close();
              catch(Exception e)
                   log.debug("Cant close prepared statement.");
                   e.printStackTrace();
    Can anyone help me out?
    Please let me know if any other info is required.
    Regards,
    Robina

    Hi all,
    I now modified the code to write the data using Stream.
    I am getting this error message: SQLException while updateORA-24813: cannot send or receive an unsupported LOB
    On googling it seems the its usually caused when I am using the different versions of oracle on
    server and client.
    My oracle details:
    Database product version : Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    JDBC driver name : Oracle JDBC driver
    JDBC driver version : 9.2.0.1.0
    DataStoreHelper name is: com.ibm.websphere.rsadapter.OracleDataStoreHelper@22542254.
    JDBC driver type : thin
    Can anyone tell me how to proceed?
    Thanks

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

  • Pivoting multiple coulmn values into multiple columns dynamically

    Hi,
    i have found some topics related to 'pivot' in this forum. but my situation is a lit bit different.
    I have a table like the below
    create
    table #temp
    (id
    int, code
    varchar(8),
    routing varchar(50))
    insert
    into #temp(id,code
    ,routing
    values(1,    
    'code1',     
    'route1')
    ,(1,'code11','route11')
    ,(2,  
    'code22',    
    'route22')
    ,(2,  
    'code222',   
    'route222')
    ,(2,  
    'code2333',  
    'route2333')
    ,(2,  
    'code2',     
    'route2')
    ,(3,  
    'code3',     
    'route3'),
    (4,   
    'code4',     
    'route4'),
    (4,   
    'code44',    
    'route44')
    ID
    CODE
    ROUTE
    1
    code1
    route1
    1
    code11
    route11
    2
    code22
    route22
    2
    code222
    route222
    2
    code2333
    route2333
    2
    code2
    route2
    3
    code3
    route3
    4
    code4
    route4
    4
    code44
    route44
    And I need to display the table below format including column names. And code/routing columns can repeat not more than 10 times.
    id
    code
    routing
    code
    routing
    code
    routing
    code
    routing
    1
    code1
    route1
    code11
    route11
    2
    code2
    route2
    code22
    route22
    code222
    route222
    code2333
    route2333
    3
    code3
    route3
    4
    code4
    route4
    code44
    route44
    I am using sql server 2012.
    i have benefited alot from this forum. a big thank you to the forum.
    I would appreciate  your help.

    Refer below solution with PIVOT. You can extend by using Dynamic Pivot.
    --create table #temp (id int, code varchar(8), routing varchar(50))
    --insert into #temp (id,code ,routing ) values(1,'code1','route1')
    --,(1,'code11','route11'),(2,'code22','route22'),(2,'code222','route222'),(2,'code2333','route2333')
    --,(2,'code2', 'route2'),(3,'code3', 'route3'),(4,'code4','route4'),(4,'code44','route44')
    ;with cte1 as (
    select *,row_number() over (partition by id order by code) rn
    from #temp
    ),cte2 as (
    select *, case
    when id=id then 'code_' + cast(rn as varchar) end codeCol, case
    when id=id then 'routing_' + cast(rn as varchar) end routingCol
    from cte1
    ),cte3 as (
    select id,code_1,routing_1,code_2,routing_2,code_3,routing_3, code_4,routing_4 from cte2
    pivot(max(code) for codeCol in (code_1,code_2,code_3,code_4)) pvt
    pivot(max(routing) for routingCol in (routing_1,routing_2,routing_3,routing_4) ) pvt1
    select id,
    max(code_1) code_1,max(routing_1) routing_1,
    max(code_2) code_2,max(routing_2) routing_2,
    max(code_3) code_3,max(routing_3) routing_3,
    max(code_4) code_4,max(routing_4) routing_4
    from cte3
    group by id
    For dynamic pivot technique refer below query sample,
    DECLARE
    @cols nvarchar(max),
    @stmt nvarchar(max)
    SELECT @cols = isnull(@cols + ', ', '') + '[' + T.[NAME] + ']' FROM (SELECT distinct [NAME] FROM PIVOTTEST) as T
    SELECT @stmt = '
    SELECT *
    FROM PIVOTTEST as T
    PIVOT
    max(T.VALUE)
    for T.[NAME] in (' + @cols + ')
    ) as P'
    exec sp_executesql @stmt = @stmt
    select * from PIVOTTEST
    Regards, RSingh

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

  • How to write parameter-value into a servlet

    I use URL , URLEncoder and HttpURLConnection in java.net package to connect to a servlet in WebSphere 3.0.2 server with Https protocol. I try to write the necessary parameters into one servlet . But the http response code is always 500 ,means Server Error.
    Why can I not get the full html code or Ok http response code as I get the page from IE with inputing parameter directly ? The inputed String in IE address bar is "https://xxxHost/xxxDir/servlet/xxxServlet?para1=value1&para2=value2 ".
    I try to use all kinds of character encoding But the result code is alaways 500.
    The following code is my test code .
    //JVM 1.4.0_01
    //***********************Code Start*************************
    URL url=new URL("https://xxxHost/xxxDir/servlet/xxxServlet");
    HttpURLConnection Conn=(HttpURLConnection)url.openConnection();
    Conn.setDoOutput(true);
    Conn.setDoInput(true);
    Conn.connect();     
    PrintWriter trxOut=new PrintWriter(Conn.getOutputStream());
    String para1=URLEncoder.encode("para=value&para1=value1","ISO-8859-1");     
    trxOut.print(para1);
    trxOut.flush();
    trxOut.close();     
    Conn.getResponseCode();
    //***********************Code End *************************
    Where do i need or is error action? Thank you for this question .

    So, when you hit your servlet from a browser with a url that has the query string of
    para1=value1&para2=value2
    do you bet a 500? If so, it's not your (client) codes fault.
    To read the HTTP response see:
    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html
    Good luck
    Lee

  • 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

Maybe you are looking for