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

Similar Messages

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

  • Inserting XML data into xmltype column

    Oracle version: 10.1.0.5
    OpenVms Alpha V8.3
    1) Tried this and get the error shown below. Removed charset and placed a zero. Same error.
    INSERT INTO xml_demo (xml_data) -- column of xmltype
    VALUES
    xmltype
    bfilename('XML_DIR', 'MOL.XML'),
    nls_charset_id('AL32UTF8')
    ORA-22993: specified input amount is greater than actual source amount
    ORA-06512: at "SYS.DBMS_LOB", line 637
    ORA-06512: at "SYS.XMLTYPE", line 283
    ORA-06512: at line 1
    2) This PL/SQL block works. However maximum raw size around 32K. The file can be around 100K. May be I can load it into a table of raw and somehow concatnate it to insert. Not sure whether this is possible but I am sure there must me a simple way of doing this.
    Subset of the xml file is pasted below.
    set serveroutput on size 1000000
    DECLARE
    file1 bfile;
    v_xml XMLType;
    len1 number(6);
    v_rec1 raw(32000);
    BEGIN
    file1 := bfilename('XML_DIR','MOL.XML');
    DBMS_LOB.fileopen(file1, DBMS_LOB.file_readonly);
    len1 := DBMS_LOB.getLength(file1);
    v_rec1 := dbms_lob.substr(file1,len1,1);
    v_xml := xmltype(UTL_RAW.CAST_TO_VARCHAR2(v_rec1));
    INSERT INTO xml_demo (xml_data) VALUES (v_xml);
    COMMIT;
    DBMS_LOB.fileclose(file1);
    exception
    when others then
    dbms_output.put_LINE (sqlerrm);
    DBMS_LOB.fileclose(file1);
    END;
    <?xml version="1.0" encoding="UTF-8"?>
    <MolDocument DtdVersion="3" DtdRelease="0">
    <DocumentIdentification v="MOL_20100331_1500_1600"/>
    <DocumentVersion v="1"/>
    <DocumentType v="A43"/>
    <SenderIdentification codingScheme="A01" v="17X100Z100Z0001H"/>
    <SenderRole v="A35"/>
    <ReceiverIdentification codingScheme="A01" v="10XFR-RTE------Q"/>
    <ReceiverRole v="A04"/>
    <CreationDateTime v="2010-03-31T14:10:00Z"/>
    <ValidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Domain codingScheme="A01" v="10YDOM-1001A001A"/>
    <MolTimeSeries>
    <ContractIdentification v="RTE_20100331_1500_16"/>
    <ResourceProvider codingScheme="A01" v="10XFR-RTE------Q"/>
    <AcquiringArea codingScheme="A01" v="17Y100Z100Z00013"/>
    <ConnectingArea codingScheme="A01" v="10YFR-RTE------C"/>
    <AuctionIdentification v="AUCTION_20100331_1500_1600"/>
    <BusinessType v="A10"/>
    <BidTimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <MeasureUnitQuantity v="MAW"/>
    <Currency v="EUR"/>
    <MeasureUnitPrice v="MWH"/>
    <Direction v="A02"/>
    <MinimumActivationQuantity v="50"/>
    <Status v="A06"/>
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    </Period>
    </MolTimeSeries>
    </MolDocument>

    Marc
    Thanks. I understand what you are saying. I have been copying files in binary mode from NT servers into VMS. I have to get a proper xml file via FTP from the originating system to further investigate.
    I have one last item i need help on. If anything looks obvious let me know:
    +1) The xsd defintion of Qty (type: QuantityType) and EnergyPrice (type: Amount Type)+
                   <xsd:element name="Qty" type="ecc:QuantityType">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
                   <xsd:element name="EnergyPrice" type="ecc:AmountType" minOccurs="0">
                        <xsd:annotation>
                             <xsd:documentation/>
                        </xsd:annotation>
                   </xsd:element>
    +2) Definition of AmountType and QuantityType in the parent xsd+
         <xsd:complexType name="AmountType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0022</Uid>
                        <Definition>The monetary value of an object</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" use="required">
                   <xsd:simpleType>
                        <xsd:restriction base="xsd:decimal">
                             <xsd:totalDigits value="17"/>
                        </xsd:restriction>
                   </xsd:simpleType>
              </xsd:attribute>
         </xsd:complexType>
         <!--_________________________________________________-->
         <xsd:complexType name="QuantityType">
              <xsd:annotation>
                   <xsd:documentation>
                        <Uid>ET0012</Uid>
                        <Definition>(Synonym "qty") The quantity of an energy product. Positive quantities shall not have a sign.</Definition>
                   </xsd:documentation>
              </xsd:annotation>
              <xsd:attribute name="v" type="xsd:decimal" use="required"/>
         </xsd:complexType>
         <!--________________
    +3. Data in the XML file+
    <Period>
    <TimeInterval v="2010-03-31T15:00Z/2010-03-31T16:00Z"/>
    <Resolution v="PT60M"/>
    <Interval>
    <Pos v="1"/>
    <Qty v="50"/>
    <EnergyPrice v="50.45"/>
    </Interval>
    +4) When I do the load:+
    the EnergyPrice is saved in the xmltype column as <EnergyPrice v="50"/>
    Losing its decimal value of .45
    +5) When I select as follows:+
    **DEV** SQL>> l
    1 SELECT
    2 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice/@v') v1,
    3 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/EnergyPrice') v2,
    4 EXTRACTVALUE(x2.column_value,'/MolTimeSeries/Period/Interval/Qty') v3
    5 FROM balit_mol_xml x,
    6 TABLE(
    7 XMLSEQUENCE(
    8 EXTRACT(x.xml_payload, '/MolDocument/MolTimeSeries')
    9 )
    10 ) x2
    11* WHERE EXISTSNODE(x.xml_payload,'/MolDocument/DocumentIdentification[@v="MOL_20100331_1500_1600"]') = 1
    +6) get the result+
    50
    AmountType479_T(XDB$RAW_LIST_T('1301000000'), 50)
    QuantityType471_T(XDB$RAW_LIST_T('1301000000'), 50)
    +7) XDB$RAW_LIST_T('1301000000'),+
    Does that tell what I am doing wrong?

  • Error inserting CLOB data into xmltype table on Solaris 8 Oracle 9.2.0.1.0

    Hi all,
    I have a table t of type xmltype.
    I have a function getData which parses an XML file and returns the CLOB data.
    I have a statement as
    "insert into t values(xmltype(getData('abc.xml')));"
    I get the following error
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [17177], [0x0], [], [], [], [], [],
    ORA-31011: XML parsing failed
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    ORA-06512: at "ADAPT.AP_CREATE_INSP_LOAD", line 57
    ORA-06512: at line 1
    At line 57 I have the above mentioned "insert into..." statement.
    Can anybody tell me what can be the problem.
    Interestingly enough, the same things work on same Oracle version on Windows 2k, Windows 2k3, another Solaris 8 machine.
    Please help asap as I am in fire fighting mode.
    Thanks & Regards,
    Aniruddha Deshpande

    Hi Aniruddha
    I think you need to post to a db forum rather than XMLP.
    Tim

  • How to insert an upper value into a column?

    Hi!,
    I need to insert an upper value into a column.
    The data is on a flat file and it could be lowercase or uppercase?
    Do I have to create a trigger to solve this problem?
    How could the trigger be?
    Thanks,
    Alex

    If you are using SQL*Loader to load the data from flat file into the db table, then you can achieve inserting the UPPER Case of column value in your sqlloader ctl file itself as in below example
    LOAD DATA
    INFILE *
    APPEND INTO TABLE XXX
    ( field1 position(1:7) char "UPPER(:field1)",
    field2 position(8:15) char "UPPER(:field2)"
    BEGINDATA
    Phil Locke
    Jason Durbin
    So in this case the Names Phil Locke and Jason Durbin will be inserted as PHIL LOCKE and JASON DURBIN into the target table.
    Regards,
    Murali Mohan

  • Insert value into a column based on value of another column

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance.

    Hi,
    I am trying to insert a value into a record based on a column in
    the record, using a trigger. The complication arises because
    the new value is selected from the same table. For example:
    SELECT COL1, COL2, COL3, COL4 from TABLE1
    I want to set COL2 and COL3 based on the value of COL4. And to
    get the value of COL2 and COL3, I will go back to TABLE1 and set
    the condition to TABLE1.COL1 = :NEW.COL4
    I cannot seem to execute the trigger as I get the message "ORA-
    04091: table SYSTEM.TABLE1 is mutating, trigger/function may not
    see it" everytime.
    Is this the correct way to achieve what I wanted? Or is there
    another way?
    Appreciate your feedback. Thank you in advance. I'm not sure what you mean when you insert a value into a
    record, but if you are setting a value in a column of the same
    record using a trigger, then it's easy.
    :new.COL2 := ....:new.COL4...
    :new.COL3 := ....:new.COL4...
    The trigger must be 'INSERT or UPDATE' and 'FOR EACH RECORD'.
    If you are setting a different record in the same table, the
    solution is much more difficult.

  • Inserting a Value into otherTable using an App. Proc. from a Date Picker

    I'm trying to call an Application Process that will insert an Attribute of a Row, into another table, after selecting a date from a Date Picker cell.
    I don't know why this shouldn't be possible. I think I've got all of my "Ducks in a Row", so to speak,
    but the Value that is being inserted into the other table is this:.. [object HTMLTableCellElement]
    (Ultimately, I'd like my Application Process to include Page element values with the insert as well, but I'm trying to handle one problem at a time)
    Here's a list of all the steps I've covered:
    1. I've Created an Application Process, (popDevices). The Process Point is "On-Demand". The Type is "PL/SQL Anonymous Block".
    The Process is defined as such:
    BEGIN
    Insert into P_DEVICES
    NAME,
    IP_ADDRESS,
    MODEL
    ) values
    'Unassigned',
    'Unassigned',
    :P153_MODEL
    COMMIT;
    END;
    2. I've Included the Javascript in the Page HTML Header.
    The Javascript is written as such: (minus the tags)
    function popDevices(PART_NO)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
    get.add('P153_MODEL',PART_NO);
    gReturn = get.get();
    get = null;
    3. I've included the following in the "Element Attributes" field of the Date-Picker Item (Date_Delivered).
    The Region Type is "SQL Query (Updatable Report)"
    onChange="javascript:popDevices(PART_NO);"
    THE RESULTS
    A. A row does get inserted into the other (P_Devices) table,
    But the value of the Attribute from the Page Region is not valid.
    The Inserted value is this: [object HTMLTableCellElement]
    B. I have tried Every conceivable combination of characters in the "Element Attributes" field, such as:
    ...(PART_NO), (#PART_NO#), (||PART_NO||), (+PART_NO+)
    C. The Javascript in the Page HTML Header appears to be correct, since I have written it this same way for other applications without any problems.
    D. If this simply cannot be done by referencing the "onChange" Javascript from the "Element Attributes" field,
    Then can you help me to write the code into the Select statement of the region.
    Thanks for any help you can give me.
    -Gary

    This may not be the most direct approach to the solution. But, none the less, it is a solution.
    For those other novices, like myself, I hope this can be useful at some point in your development:
    MY DESIRED RESULT:
    A. To Insert into another tablle values derived from both; Page Item (i.e. P153_x) and Attributes of a Row in an Updatable Report from which I have selected the Date-Picker.
    B. I want the insert to occur automatically after the user Selects the date from the Date-Picker.
    SOLUTIONS:
    1. I usea Javascript prompt window to prompt for information and store the information in Pre-Created Page Items.
    This is the Javascript as I've entered it into the Page HTML Header region: (Minus the Tags)
    function received_javaprompt () {
    var Serial_Number = prompt("Enter the Serial Number");
    var Bldg_Id = prompt("Enter the Bldg_Id");
    var Clst_Id = prompt("Enter the Clst_Id");
    $x('P153_SERIAL_NO').value = Serial_Number;
    $x('P153_BLDG_ID').value = Bldg_Id;
    $x('P153_CLST_ID').value = Clst_Id;
    2. I needed to identify the (Manufacturer and Part_No) Column Attribute in the Row from which I selected the Date-Picker.
    A. To do this, I enumerated the Columns in the order they were listed in the Select Statement of the region (Click on the Region Definition Tab).
    B. Then (Click on the Report Attributes Tab). Count, In the numerical order which these columns are selected, ONLY the columns that are Editable.
    C. When I counted down as far as the Column I wanted to capture the value of, Then I made a mental note of that number and used it in the following (2) Javascripts (findMaker and findModel).
    3. findMaker (Minus the tags)
    function findMaker (pThis) {
    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    var Maker = html_GetElement('f15_'+vRow).value
    $x('P153_MAKER').value = Maker;
    4. findModel (Minus the tags)
    function findModel (pThis) {
    var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
    var Model = html_GetElement('f16_'+vRow).value
    $x('P153_MODEL').value = Model;
    5. I added one more Javascript, to the Page HTML Header, that references the Application Process which will Insert the values into the "Other" table:
    function popDevices(P153_SERIAL_NO,P153_BLDG_ID,P153_CLST_ID,P153_MAKER,P153_MODEL)
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=popDevices',0);
    get.add('P153_SERIAL_NO',P153_SERIAL_NO);
    get.add('P153_BLDG_ID',P153_BLDG_ID);
    get.add('P153_CLST_ID',P153_CLST_ID);
    get.add('P153_MAKER',P153_MAKER);
    get.add('P153_MODEL',P153_MODEL);
    gReturn = get.get();
    get = null;
    6. I added the "onChange" process to the Element Attributes field of the Table item which utilizes the Date-Picker:
    A. Click on the Report Attributes Tab of the Region.
    B. Click on the Edit icon of the column which utilized the Date-Picker
    C. I added this "onChange" reference to the Element Attributes field, which is found in the Tabular Form section.
    onChange="javascript:received_javaprompt();findModel(this);findMaker(this);popDevices((P153_SERIAL_NO).value,(P153_BLDG_ID).value,(P153_CLST_ID).value,(P153_MAKER).value,(P153_MODEL).value);"
    7. The Application Process which inserts the collected data into the table is as follows:
    (Name= popDevices: Process Point= On-Demand: Type= PL/SQL Anonymous Block)
    BEGIN
    Insert into P_DEVICES
    BLDG_ID,
    CLST_ID,
    NAME,
    IP_ADDRESS,
    SERIAL_NO,
    MAKER,
    MODEL
    ) values
    :P153_BLDG_ID,
    :P153_CLST_ID,
    'Unassigned',
    'Unassigned',
    :P153_SERIAL_NO,
    :P153_MAKER,
    :P153_MODEL
    COMMIT;
    END;
    Well, I hope this may help someone else like me.
    I usually arrive at my solutions by getting help here on the Discussion Forum and also Google. Google inevitably points me to a previous Apex Discussion Forum session.
    Edited by: garyNboston on Mar 15, 2010 10:55 AM

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • Insert a value into bol attribut

    Hiii,
    I will insert a value into a bol attribut with the method "SET_PROPERTY".
    Here is my code so far.
    lr_entity ?= me->typed_context->builheader->collection_wrapper->get_current( ).
    if lr_entity is bound.
          lr_entity->set_property( EXPORTING
                                   iv_attr_name = 'TITLE_KEY'
                                   iv_value = '0100'
    endif.
    The problem here is, I can the in the debug mode, that the value is inserted.
    But by running the debug mode again, the value of the attribut 'TITLE_KEY' is empty.
    My question here is, how can I save the value of attribut?
    Can anybody help me please?
    regards,
    John

    Hallo Ashish,
    I already tried to do this with
    DATA lr_core TYPE REF TO cl_crm_bol_core.
    lr_core = cl_crm_bol_core=>get_instance( ).
    lr_core->modify( ).
    It is also interessting that, after
    lr_core->modify( ).
    I cann't look into the bol entity builheader during debugging.
    Durring debugging, ATTRIBUTE_REF(Container Proxy->DATA REF-> ATTR_REF)
    Do you have any other idea?
    reagards,
    John

  • 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 4K of XML data into XMLType column?

    I use OCCI and our Oracle version is 9.2.0.1.0. I have successfully been able to insert xml data (any size) into a clob column using "insert into...values(.., empty_clob()) returning c1 into :3"; and then using Statement::GetClob() to acquire a reference to the internal clob and populate it. I cannot seem to be able to do the same when the column type is of XMLType.
    I could not find a single sample code which demonstrates inserting into a table with a XMLType column. Using SetDataBuffer(OCCI_SQLT_STR) with data over 4000 bytes does not work.
    I'd greatly appreciate any feedback.

    Pretty sure this was a bug in the base 9.2 release which was fixed in a patch drop. Try 9.2.0.6 or later.

  • Unable to load into XMLTYPE column: enumeration value considered as boolean

    HI Gentlemen,
    I have a problem with my XMLTYPE load procedure. The schemas have been registered:
    SQL> select any_path from resource_view where any_path like '%GKSADMIN/ICD%';
    ANY_PATH                                                                       
    /sys/schemas/GKSADMIN/ICD                                                      
    /sys/schemas/GKSADMIN/ICD/datentypen_V1.40.xsd                                 
    /sys/schemas/GKSADMIN/ICD/ehd_header_V1.40.xsd                                 
    /sys/schemas/GKSADMIN/ICD/ehd_root_V1.40.xsd                                   
    /sys/schemas/GKSADMIN/ICD/icd_body.xsd                                         
    /sys/schemas/GKSADMIN/ICD/icd_header.xsd                                       
    /sys/schemas/GKSADMIN/ICD/icd_root.xsd                                         
    /sys/schemas/GKSADMIN/ICD/keytabs_V1.40.xsd                                    
    8 Zeilen ausgewählt.The table has been created:
    SQL> describe icd
    Name                                      Null?    Typ
    ID                                                 CHAR(2)
    XML_DOCUMENT                                       SYS.XMLTYPE(XMLSchema "ICD/i
                                                        cd_root.xsd" Element "ehd")
                                                        STORAGE Object-relational TY
                                                        PE "ICD$ICD_ROOT_TYP"And I try to insert an instance document:
    SQL> @loadxmlfileascolumn_int
    Geben Sie einen Wert für source_directory ein: c:\gks\kbv\c\icd\xml
    alt   1: create or replace directory SOURCE_DIR as '&source_directory'
    neu   1: create or replace directory SOURCE_DIR as 'c:\gks\kbv\c\icd\xml'
    Verzeichnis wurde erstellt.
    Geben Sie einen Wert für xmltypetable ein: icd
    alt   4:   INSERT INTO &XMLTypeTable
    neu   4:   INSERT INTO icd
    Geben Sie einen Wert für id ein: 01
    Geben Sie einen Wert für instancedocument ein: icdtest.xml
    alt   5:     VALUES (&id, XMLType(bfilename('SOURCE_DIR', '&InstanceDocument'),
    neu   5:     VALUES (01, XMLType(bfilename('SOURCE_DIR', 'icdtest.xml'),
    declare
    FEHLER in Zeile 1:
    ORA-31038: Ungültiger boolean Wert: "j"
    ORA-06512: in Zeile 4
    SQL> spool offAs the schemas are very big, i copied only relevant parts of them to show how the values are defined (in icd_body.xsd):
    <xs:element name="abrechenbar">
      <xs:annotation>
        <xs:documentation>Kennzeichnung, ob (abrechenbarer) ICD-10-GM-Code</xs:documentation>
      </xs:annotation>
      <xs:complexType>
        <xs:attribute name="V" use="required">
          <xs:simpleType>
            <xs:restriction base="xs:string">
           <xs:enumeration value="j"/>
           <xs:enumeration value="n"/>
         </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:complexType>
    </xs:element>
    SQL> spool off
    "j" and "n" are for Yes and No in German. But anyway, how could it become a Boolean? Why is it invalid?
    Can you please help me so that I can load XMLTYPE contents?
    Thanks, regards
    Miklos HERBOLY
    Sorry, I found one place where a boolean will be expected. I modified in the instance document so that it has true or false. And still something is recognized as boolean with the value of "j".
    Edited by: mh**** on Jul 4, 2011 4:43 AM
    Edited by: mh**** on Jul 4, 2011 5:07 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    I don't get it, it should work, right? Although I am not sure if a XMLType Object Relational column is supported, but then again this is not clear in the documentation.
    The only thing I can think of is that the attribute "V" is enforced as a boolean in the database on lower Object Relational level or...

  • How to insert document into xmltype column through an http post request with perl

    Oracle 11.2.0.3
    Windows server 2008r2
    Apache tomcat 7.0
    Oracle APEX 4.2.1
    Oracle APEX Listener 2.0
    I would like to insert a XML document into the database through an APEX restful web service. The POST into the web service in done with PERL. The following code will insert an empty record in a table with column of XMLType type.
    Perl Code
    use strict;
    use warnings;
    use LWP::UserAgent;
    use HTTP:Headers;
    my $headers = HTTP::Headers->new();
    my $url = "http://host:port:apex/<application_workspace>/<restfull service module>/<uri template>/
    my $sendthis = ('<?xml version="1.0" enconding="utf-8"?>
    <students>
    <row>
           <name>Mark</name>
          <age>30</age>
    </row>
    <./students>';)
    $headers -> header('Content-Type' => 'text/xml; charset=utf-8');
    my $request = HTTP:Request->new('POST', $url, $headers, $sendthis);
    $request-> protocol('HTTP/1.1');
    my $browser = LWP::UserAgent->new();
    my $response = $browser->request($request);
    my $gotthis= $response->content();
    my $the_file_data = $response->content();
    APEX restful service
    Method: POST
    Source type: PL/SQL
    MIME Types allowed: blank
    require secure access: none
    source:
    {declare
    doc varchar2(32000);
    begin
    insert into table <column name>
    values(doc);
    commit;
    end;
    Table code
    { create table <tablename>
    (column name XMLType>);
    The above code will insert an empty column into the table.
    Any ideas why?

    It's a really bad idea to assemble XML using strings and string concatenation in SQL or PL/SQL. First there is a 4K limit in SQL, and 32K limit in PL/SQL, which means you end up constructing the XML in chunks, adding uneccessary complications. 2nd you cannot confirm the XML is valid or well formed using external tools.
    IMHO it makes much more sense to keep the XML content seperated from the SQL / PL/SQL code
    When the XML can be stored a File System accessable from the database, The files can be loaded into the database using mechansims like BFILE.
    In cases where the XML must be staged on a remote file system, the files can be loaded into the database using FTP or HTTP and in cases where this is not an option, SQLLDR.
    -Mark

  • How to Insert check box value into database column

    Hi All,
    I had checkbox group in a region which is using an LOV......and having 18 items in that lov.
    i.e. Total 18 checkboxes in Total. User has to select only 2 checkboxes from that 18.
    I created two columns for storing two values of checkboxes. How to insert two selectives in two columns.........Moreover, How to give the query i.e. how to know which values are selected.
    Please Help me in achieving this. apart from the two columns (Focus1,Focus2) .......One more column(l_spo_val) is there which is a foreign key.
    My Insert Statement is like this:
    INSERT INTO SPO_RESEARCH_FOCUS VALUES(l_spo_val
    ,:P4_RESEARCH_LIST_1
                        ,:P4_RESEARCH_LIST_2);
    Please narrate the code if possible.
    Thanks,
    Sekhar.

    Hi Denes,
    I saw the example in your workspace and it is the same what exactly i want and instead of storing in one column i want to store the two selected values into two different columns. Also i need to restrict the selection of checkboxes upto 2 only. So If the user tries to select the third check box it doesnt have to accept.
    Even I am ready to change my table as according to your example i.e. creating only one column. Store the values of selection into that column.
    I was unable to see how u wrote the logic (Code) for your example in your workspace. It helps alot if you provide me the code for that example(Multi Checkbox One Column).
    I was facinated after watching your examples in your workspace and am very much interested to know more about Apex.
    Please help me insolving this as it is long pending issue for my requirement.
    Thanks a lot again,
    Sekhar.
    Edited by: Sekhar Nooney on Mar 26, 2009 4:35 AM

Maybe you are looking for

  • Technical fields in Expert Routine

    Hi, I need to write an Expert Transformation Routine to upload data into a DSO from a Generic Data Source. The Result Package has the following technical fields:      Field: SID SID.         SID           TYPE RSSID,      Field: DATAPAKID Data packet

  • Problem in Oracle net8 easy config. URGENT

    Dear All, I need your favour, actually i instatlled Forms6i on windows XP it is installed successfully and every component(Forms, Reports) are opening without any problem. But whne i am going to configure my Net Services through Oracle Net8 Easy conf

  • HT3680 How do I clean up my start up disk

    How do I clean up my start up disk

  • FireworkCS6 download problem in Creative Cloud

    I have just become a Creative Cloud member and had successfully downloaed most of the APPS I need, however, when I downloaded Fireworks CS6 I cannot find it anywhere on my system, the Application Manager is telling me it's downloaded but I don't have

  • MBAM client installation

    Hi, I am encountering MBAM client installation issues on some Windows7 64bit HP laptop and tablets (same hardware is used for all clients). MBAM with SCCM topology environmnet is in place and tested OK on 32bit and 64bit systems but on some i am gett