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?

Similar Messages

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

  • Inserting large xml data into xmltype

    Hi all,
    In my project I need to insert very large XML data into xmltype column.
    My table:
    CREATE TABLE TransDetailstblCLOB ( id number, data_xml XMLType) XmlType data_xml STORE AS CLOB;
    I am using JDBC approach to insert values. It works fine for data less than 4000 bytes when using preparedStatement.setString(1, xmlData). As I have to insert large Xml data >4000 bytes I am now using preparedStatement.setClob() methods.
    My code works fine for table which has column declared as CLOB expicitly. But for TransDetailstblCLOB where the column is declared as XMLTYPE and storage option as CLOB I am getting the error : "ORA-01461: can bind a LONG value only for insert into a LONG column".
    This error means that there is a mismatch between my setClob() and column. which means am I not storing in CLOB column.
    I read in Oracle site that
    When you create an XMLType column without any XML schema specification, a hidden CLOB column is automatically created to store the XML data. The XMLType column itself becomes a virtual column over this hidden CLOB column. It is not possible to directly access the CLOB column; however, you can set the storage characteristics for the column using the XMLType storage clause."
    I dont understand its stated here that it is a hidden CLOB column then why not I use setClob()? It worked fine for pure CLOB column (another table) then Why is it giving such error for XMLTYPE table?
    I am struck up with this since 3 days. Can anyone help me please?
    My code snippet:
    query = "INSERT INTO po_xml_tab VALUES (?,XMLType(?)) ";
              //query = "INSERT INTO test VALUES (?,?) ";
         // Get the statement Object
         pstmt =(OraclePreparedStatement) conn.prepareStatement(query);
         // pstmt = conn.prepareStatement(query);
         //xmlData="test";
    //      If the temporary CLOB has not yet been created, create new
         temporaryClob = oracle.sql.CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
         // Open the temporary CLOB in readwrite mode to enable writing
         temporaryClob.open(CLOB.MODE_READWRITE);
         log.debug("tempClob opened"+"size bef writing data"+"length "+temporaryClob.getLength()+
                   "buffer size "+temporaryClob.getBufferSize()+"chunk size "+temporaryClob.getChunkSize());
         OutputStream out = temporaryClob.getAsciiOutputStream();
         InputStream in = new StringBufferInputStream(xmlData);
    int length = -1;
    int wrote = 0;
    int chunkSize = temporaryClob.getChunkSize();
    chunkSize=xmlData.length();
    byte[] buf = new byte[chunkSize];
    while ((length = in.read(buf)) != -1) {
    out.write(buf, 0, length);
    wrote += length;
    temporaryClob.setBytes(buf);
    log.debug("Wrote lenght"+wrote);
         // Bind this CLOB with the prepared Statement
         pstmt.setInt(1,100);
         pstmt.setStringForClob(2, xmlData);
         int i =pstmt.executeUpdate();
         if (i == 1) {
         log.debug("Record Successfully inserted!");
         }

    try this, in adodb works:
    declare poXML CLOB;
    BEGIN
    poXML := '<OIDS><OID>large text</OID></OIDS>';
    UPDATE a_po_xml_tab set podoc=XMLType(poXML) WHERE poid = 102;
    END;

  • Steps to insert xml data into oracle

    Please give me next steps to insert xml data into oracle 9i:
    i've been doing this steps :
    1. create folder in oracle port:8080
    2. copy xsd into folder
    3. register schema
    4. Give me next step...
    5.
    6.
    Thanks

    this is my complete xmlschema
    <?xml version = "1.0" encoding = "UTF-8"?>
    <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
         <xs:element name = "A3A8Vers" type = "xs:string"/>
         <xs:element name = "F1F5Vers" type = "xs:string">
         </xs:element>
         <xs:element name = "sequence" type = "xs:string">
         </xs:element>
         <xs:element name = "amf" type = "xs:string">
         </xs:element>
         <xs:element name = "trnsKeyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "mac" type = "xs:string">
         </xs:element>
         <xs:element name = "encryptionKey" type = "xs:string">
         </xs:element>
         <xs:element name = "signature" type = "xs:string">
         </xs:element>
         <xs:element name = "signer">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "keyNumber"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "entityNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "keyNumber" type = "xs:string">
         </xs:element>
         <xs:element name = "pblKey">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "entityNumber"/>
                        <xs:element ref = "entityRole"/>
                        <xs:element ref = "keyNumber"/>
                        <xs:element ref = "publicKeyVal"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "ntrTime" type = "xs:string">
         </xs:element>
         <xs:element name = "deActionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "actionTime" type = "xs:string">
         </xs:element>
         <xs:element name = "entityRole">
              <xs:complexType>
                   <xs:attribute name = "role" default = "INVALID">
                        <xs:simpleType>
                             <xs:restriction base = "xs:NMTOKEN">
                                  <xs:enumeration value = "TKD"/>
                                  <xs:enumeration value = "SKD"/>
                                  <xs:enumeration value = "INVALID"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:attribute>
              </xs:complexType>
         </xs:element>
         <xs:element name = "publicKeyVal">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref = "exponent"/>
                        <xs:element ref = "mod"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name = "exponent" type = "xs:string">
         </xs:element>
         <xs:element name = "mod" type = "xs:string">
         </xs:element>
         <xs:element name = "encriptionTransKey" type = "xs:string">
         </xs:element>
         <xs:element name = "keyType" type = "xs:string">
         </xs:element>
    </xs:schema>.
    I use command to create table :
    create table elements of xmltype
    xmlschema "http://192.168.1.1:8080/test.xsd"
    element "publicKey"
    . But why the result,table as object type. so i cant use command "desc <table_name>;"

  • 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

  • Insert XML Data Into An Existing PDF Form

    I am working on an application, written with XHTML and JavaScript, and running on AIR, so it is a desktop application.
    Users enter data into an XHTML form and upon submission I create an XML file of the data using JavaScript.
    At any later time users will be able to open the XML file from the application. I will use JavaScript, again, to read the XML and fill in an XHTML form. But at this point I will provide a button for users to generate a PDF with the data. I would then like to insert the XML data into the appropriate fields of the existing PDF form. I would like to continue to do this from within the AIR application using JavaScript.
    Is this possible?
    What version of Acrobat would I need as the developer? Professional or Standard or Other or None?
    What version of Acrobat would the end users need? Professional or Standard or Other or None?
    Can this all be done using only JavaScript and the Acrobat SDK? Does using AIR offer any help (all Adobe products)?
    When the end user clicks the generate PDF button would Acrobat have to open? Can this be done without the user seeing Acrobat open? Either way is ok, I would just like the user to see an alert saying that the file has be generated and point them to its location on the local machine. But again, this is not a requirement.
    Thanks in advance.
    Not asking for source code here, just if its possible. :)
    I'll figure out the how.

    You have two choices
    1) You can use JavaScript in your AIR application to communicate with the JavaScript in the PDF to fill in the form directly. This can all be done inside of your AIR app. This is certainly the best route to go and there is (IIRC) a sample in the AIR SDK.
    2) You can create an XFDF file from your XML data and then have Acrobat/Reader open the XFDF file to fill in the data.
    Both methods will work with Acrobat and Reader - HOWEVER, Reader users won't be able to save the PDF unless it has been Reader Enabled.
    Leonard

  • Insert XML data into oracle table

    I want to insert xml data returned by the VB code into oracle table.
    As a prequisite I have installed the XDK capabilities for Oracle by installing JServer & running
    SQL scripts catxsu.sql,xmlparserv2.jar,load.sql to load the XMLSQL Utility (DBMS_XMLQuery) into the database.
    I have also granted following privileges to the user.
    Grant users access to XMLParser and XMLDom packages:
         grant execute on xmldom to public;
         grant execute on xmlparser to public;
         create public synonym xmldom for sys.xmldom;
         create public synonym xmlparser for sys.xmlparser;
    But still i am not able to create procedure which will accept input parameter as an XML document coming from front end which in turn will insert that record into simple oracle table . I am using Oracle 8.1.7
    Thanks in advance

    Would you specify the database version?
    Since DBMS_XMLSave requires DOM, you normally need to divide the huge XML before insertion.

  • Inserting XML data into and XML template

    I have XML data structured according to a schema. I also have a
    template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
    I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
    Suggestions?
    thanks
    d1

    I have XML data structured according to a schema. I also have a
    template structured with the same schema, plus a schema for document formatting. I want to merge the XML data into the Template to produce an output file.
    I know I can write a program to use XPath or DOM, but I am sure a generic solution already exists for this. I did not have any luck with google.
    Suggestions?
    thanks
    d1

  • Loading data into XMLType column using dbms_xmlsave.insertxml get ORA-29532

    The following simple test case succeeded in 9.2.0.1 but failed in 9.2.0.2.
    CREATE OR REPLACE procedure InsertXML(xmlDoc IN VARCHAR2, tableName IN VARCHAR2) is
    insCtx DBMS_XMLSave.ctxType;
    rows number;
    begin
    insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
    rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
    dbms_output.put_line(to_char(rows) || ' rows inserted');
    DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
    end;
    CREATE TABLE XMLtable
    (column1 xmltype)
    exec insertxml('<?xml version = "1.0"?><ROWSET><ROW><COLUMN1><TEST>HELLO</TEST></COLUMN1></ROW></ROWSET>', 'XMLTABLE');

    Hi,
    For your XML file I think you just need to enclose XML elemnts in ROWSET AND ROW TAGS - so xml should look like :
    <ROWSET>
    <ROW>
    <DEPT>
    </DEPT>
    and just pass it as CLOB to dbms_xmlsave.insertXML proc.
    I hope it should work.
    I am also trying to insert XML file but with a bit complex structure having multiple nested elements.
    I am not sure how to transform the external XML file to wrap it in ROWSET/ROW using XSLT. It's mandatory to use ROWSET/ROW tags to be able to insert in oracle tables. I am facing this problem right now. I am using object views to accomplish the purpose but still needs to figure out the way to apply stylesheet to incoming XML file.
    If you come to know of any way, pls do let me know also.
    Thanks

  • 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

  • Insert XML data into a diferents fiels in a TABLE.

    We have an xml to import in to a table with XMLType of fields.
    The xml file has on field that the content of that field is a full xml file.
    Example.
    <BD>
    <J>
    <T> 1212 </T>
    </J>
    <BDI>
    <INFO><?xml version="1.0" encoding="UTF-8"?> <BuriedDropTask xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="buriedDropSchema.xsd"> <TaskName>UTFS277779</TaskName>.......
    <PhoneNumber>303303033</PhoneNumber>......
    </INFO>
    </BDI>
    </BD>
    This is just an idea and not the actual document.
    We need to insert in a table the data from <J> </J> and some fields of the ineer document like <BuriedDropTask> </BuriedDropTask> to other field in the same table to process the data.
    What is the rigth process to follow?
    The previus programmer was using utl_http.request_pieces to read the xml from an url and acummulated in a varchar2 variable. But the process is not working.
    Thank you for your help in advance.
    Jose Galan

    The XML file with <?xml?> somewhere inside the tags is not valid.
    I think, at first stage the unneeded garbage should be striped of with replace/instr/whatever.
    Then extract() functions should be applied to bulk process the XML.
        insert into tasks (id, t, task_name)
        select tasks_seq.nextval
               t,
               task_name
          from (
            select extractvalue(xml, '//J/T') t,
                   extractvalue(xml, '//BDI/INFO/TaskName') task_name
              from (
                  select extract(xml, '/BD') xml from xml_table
          )

  • Illegal combination when importing xml file into xmltype column

    I have the following control file.
    LOAD DATA
    CHARACTERSET UTF8
    INFILE *
    INTO TABLE IMPORTRAWXML TRUNCATE
    SITEID constant 0
    ,VENDORID constant 17
    ,SITEFORMATID constant 2
    ,"\\plutonium\outcomes\AHA GWTG-Outpatient\Programs\DataTransfer\LoadTest\V17_standard_test.xml" filler char(1000)
    ,RAWDATA LOBFILE ("\\plutonium\outcomes\AHA GWTG-Outpatient\Programs\DataTransfer\LoadTest\V17_standard_test.xml")
    TERMINATED BY EOF
    )When I run it using sqlldr command line I get the following error:
    SQL*Loader-350: Syntax error at line 1.
    Illegal combination of non-alphanumeric characters
    <?xml version="1.0" encoding="ISO-8859-1"?>Does anyone have any idea what I am doing wrong here? If I remove the fully resolved path (both the control file and xml file are in the same folder) it tells me it can't find the file to load.
    HELP!!!!
    Thanks,
    Eva

    evaleah wrote:
    I have made sure all my home settings are correct in my registry editor and they are. Another thing to note is the control file I am using works 100% perfectly, beautifully when called from Toad for Oracle. It is when called from the command line utility that it fails. Is there anyway to determine what the difference could be?
    So we know that I can work (toad works), but it doesn't yet work in a "cmd" environment.
    Just as any other program Toad is also a client and uses NLS and other environment settings. Maybe these are stored in the registry, maybe the are being set by Toad by reading a configuration file while it is started or while running.
    As said, on Windows its tricky...
    Setting properties in the registry will not mean that they are the same a "cmd" window or maybe not even been set.
    If you execute / run "cmd" then the "set" statement/command will output the environment settings that will be used during the livetime of that "cmd" session.
    C:/> setIn my laptop environment (windows 7 64 bit) it will show the following
    C:\>set
    ALLUSERSPROFILE=C:\ProgramData
    APPDATA=C:\Users\marco\AppData\Roaming
    CommonProgramFiles=C:\Program Files\Common Files
    CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
    CommonProgramW6432=C:\Program Files\Common Files
    COMPUTERNAME=00-00-000
    ComSpec=C:\Windows\system32\cmd.exe
    DEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Users\marco
    LOCALAPPDATA=C:\Users\marco\AppData\Local
    LOGONSERVER=\\AMISNT
    MpConfig_ProductAppDataPath=C:\ProgramData\Microsoft\Windows Defender
    MpConfig_ProductCodeName=AntiSpyware
    MpConfig_ProductPath=C:\Program Files\Windows Defender
    MpConfig_ProductUserAppDataPath=C:\Users\marco\AppData\Local\Microsoft\Windows
    Defender
    MpConfig_ReportingGUID=CA08B82B-EF0A-4107-89D8-ED5BB37E7515
    NUMBER_OF_PROCESSORS=2
    OS=Windows_NT
    Path=C:\oracle\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Win
    dows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PERL5LIB=c:\oracle\product\10.2.0\db_1\perl\5.8.3\lib\MSWin32-x64;c:\oracle\prod
    uct\10.2.0\db_1\perl\5.8.3\lib;c:\oracle\product\10.2.0\db_1\perl\site\5.8.3;c:\
    oracle\product\10.2.0\db_1\perl\site\5.8.3\lib;c:\oracle\product\10.2.0\db_1\sys
    man\admin\scripts;
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=170a
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    PUBLIC=C:\Users\Public
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\marco\AppData\Local\Temp
    TMP=C:\Users\marco\AppData\Local\Temp
    USERDNSDOMAIN=AMIS
    USERDOMAIN=AMIS
    USERNAME=marco
    USERPROFILE=C:\Users\marco
    VBOX_INSTALL_PATH=C:\Program Files\Sun\VirtualBox\
    VSEDEFLOGDIR=C:\ProgramData\McAfee\DesktopProtection
    windir=C:\Windows
    C:\>The only thing that identifies that I have Oracle installed is set in the %PATH% variable and %PERL5LIB%. From the path setting you can also deduct that I have Oracle 11 and Oracle 10 software installed. So when I execute "sqlldr" what NLS settings will it use and which tnsnames.ora alias for example to connect to the database...?
    You can you do it and see what happens...
    C:\>sqlldr
    SQL*Loader: Release 11.2.0.1.0 - Production on Wed May 12 20:36:25 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Usage: SQLLDR keyword=value [,keyword=value,...]
    Valid Keywords:
    ...So it will pick the first "sqlldr" in the %PATH% environment setting. But what about NLS...? As said to be absolute sure you will have to set it in your environment.
    C:/> set ORACLE_HOME="C:\oracle\product\10.2.0\db_1"
    C:\> set
    Path=C:\oracle\product\11.2.0\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Win
    dows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    PERL5LIB=c:\oracle\product\10.2.0\db_1\perl\5.8.3\lib\MSWin32-x64;c:\oracle\prod
    uct\10.2.0\db_1\perl\5.8.3\lib;c:\oracle\product\10.2.0\db_1\perl\site\5.8.3;c:\
    oracle\product\10.2.0\db_1\perl\site\5.8.3\lib;c:\oracle\product\10.2.0\db_1\sys
    man\admin\scripts;
    ORACLE_HOME="C:\oracle\product\10.2.0\db_1"
    C:\> echo %ORACLE_HOME%
    "C:\oracle\product\10.2.0\db_1"Because if I enter "sqlldr" it will pick the executable from the 11.2 install, but the ORACLE_HOME is set to the wrong environment
    Executing sqlldr now will give me an error
    C:\>sqlldr
    Message 2100 not found; No message file for product=RDBMS, facility=ULMessage 21
    00 not found; No message file for product=RDBMS, facility=UL
    C:\>Another thing you can notice now is that from that output alone, you can't deduct the Oracle "sqlldr" version anymore. Setting the ORACLE_HOME environment to either 10.2 or 11.2 will cause "sqlldr" to execute normally (at least thats how it looks) BUT in the case of the oracle 10.2 setting it will use the wrong message files etc. At least not the correct software versions / files "sqlldr" is shipped with. So you can (and most of the time) will get strange errors.
    C:\> set ORACLE_HOME=C:\oracle\product\10.2.0\db_1
    C:\>sqlldr
    SQL*Loader: Release 11.2.0.1.0 - Production on Wed May 12 20:45:00 2010
    C:\>set ORACLE_HOME=C:\oracle\product\11.2.0\dbhome_1
    C:\>sqlldr
    SQL*Loader: Release 11.2.0.1.0 - Production on Wed May 12 20:49:50 2010
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Usage: SQLLDR keyword=value [,keyword=value,...]
    ...In the registry you can find a lot of those variables are set for ORACLE_HOME, ORACLE_BASE, SQLPATH, maybe TNS_ADMIN, ORACLE_SID, NLS_LANG. You can find the variables IN the registry on two places. The most common one is the SYSTEM wide environment settings under //HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE and in my case for 11.2 under //HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/KEY_OraDb11g_Home1.
    You could overrule this for to be active on "my user session", my login session as account "marco" under //HKEY_CURRENT_USER/Software/Oracle, but no one using Windows is doing this.
    Besides the "cmd" and registry environment, there is a different place as well were you can set these parameters. In windows go to "start", click "control panel", click "system", click tab "Advanced" and then click on the button on the bottum with "Environment Variables". Here you can see the distinction between user and system wide variables as well. Here you can also set NLS_LANG, ORACLE_HOME etc. If I am not mistaken than these will be the default values used in a fresh "cmd" window session. But they can and will interfere with programs you start via clicking them. For example something a Java program like SQL Developer (and/or Toad). If those values are not overrulled by the program by for example using his own variables from a config file or else, those sessings from the "system" / control panel item will be used. If it is the wrong mix, you will encounter strange issues.
    Setting ORACLE_HOME and ORACLE_BASE will be used by a lot of derived other settings for example the default place SQL*Net drivers and tnsnames aliases etc will be checked. For example setting the ORACLE_HOME to
    C:\> set ORACLE_HOME=C:\oracle\product\10.2.0\db_1will result in that the tnsnames aliases from
    C:\> set ORACLE_HOME=C:\oracle\product\10.2.0\db_1\NETWORK\adminwill be used and NOT the ones maybe needed from
    C:\oracle\product\11.2.0\dbhome_1\NETWORK\adminYou can overrule this behavior by setting the TNS_ADMIN variable. By default, most explicit form for example on linux and Unix, the following rule will be used by Oracle
    1) .tnsnames.ora in the home directory of the user
    2) standard default: $ORACLE_HOME/network/admin
    3) behavior can be overruled via setting $TNS_ADMINThe fact that you are able via Toad to execute it correctly proves you that it can be done. But Toad uses in your session "SQL*Net" or JDBC or ODBC or ADO or ? via its own configuration environment settings that are being set on which values...?
    Both Oracle and Toad use the OSI model (http://en.wikipedia.org/wiki/OSI_model), both have to follow the same rules. There hasn't been changed that much over the years, character set conversions are done in the "two task common" layer of the data transport on either side (client/server) when data travels between a client and server. And don't forget a database can be also be a client when for instance database links are being used. One of the reasons to read old manuals because there the basics are still perfectly explained: http://download.oracle.com/docs/cd/A57673_01/DOC/net/doc/NWUS233/ch2.htm#twotask (Oracle 7.3.4 Networking Manual).
    This long long story is just to show you that you have more control if you set variables explicitly in a "cmd" window (and or in a linux/unix shell (as long as the session isn't "forked")) BUT you will have to be precise. Check the environment a set those environment variables that control / that are being used by "sqlldr" (and that are probably more then you realised, for example that SQL_PATH variable is the default directory where SQL*Plus is looking and saving its "SQL" and spool "LIS" files).
    HTH

  • Error while inserting xml data into table

    Hello
    I am running thid stored procedure and this compiles correctly , but when I try to execute it gives me a error, I have been trying this form the past 3 days , could anyone please help me ASAP
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Procedure created.
    SQL> exec loadxml12
    In Exception
    BEGIN loadxml12; END;
    ERROR at line 1:
    ORA-20000: ORU-10028: line length overflow, limit of 255 bytes per line
    ORA-06512: at "SYS.DBMS_OUTPUT", line 99
    ORA-06512: at "SYS.DBMS_OUTPUT", line 65
    ORA-06512: at "CARCLUB_RW2.LOADXML12", line 20
    ORA-06512: at line 1
    null

    Could you explain what your procedure does, please. I also tried to compile it but always got error message:
    PL/SQL: SQL Statement ignored
    PLS-00385: type mismatch found at 'FIL' in SELECT...INTO
    statement
    SQL> CREATE OR REPLACE PROCEDURE loadxml12 AS
    2 fil BFILE;
    3 buffer RAW(32767);
    4 len INTEGER;
    5 insrow INTEGER;
    6 BEGIN
    7 SELECT f_lob INTO fil FROM xml_temp12 WHERE key = 1;
    8 DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    9 len := DBMS_LOB.GETLENGTH(fil);
    10 DBMS_LOB.READ(fil,len,1,buffer);
    11 xmlgen.resetOptions;
    12 insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    13 DBMS_OUTPUT.PUT_LINE(insrow);
    14 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    15 DBMS_LOB.FILECLOSE(fil);
    16 END IF;
    17 EXCEPTION
    18 WHEN OTHERS THEN
    19 DBMS_OUTPUT.PUT_LINE('In Exception');
    20 DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    21 IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    22 DBMS_LOB.FILECLOSE(fil);
    23 END IF;
    24 end;
    25 /
    Bober
    null

  • Insert data into the column which is having null values.

    Hi,
    I have a column called "Classification_CD" .This column is having NULL values.I want to insert the data into this column.
    I tried to write the query as follows. But it is showing the mesg error "SQL Error: ORA-01400 cannot insert NULL into ("ABC"."A_CMP_W"."A_CMP_SEQ_NUM")"
    Can any one please help me out to write query to insert the dat afor this.
    Thanks.

    I think you are taking about updating the null value.So you can do this..
    SQL> select * from table_a;
            ID SCHEDULED MARK                       PRID
             5 07-NOV-10 T05                           7
             6 18-SEP-10 T06                           8
             4 31-JAN-11 T02                           2
             1 18-JAN-11 T01                           2
             2 18-JAN-11 T02
             3 18-JAN-11 T03                           1
    6 rows selected.See that prid is Null for id 2
    SQL> update table_a
      2  set prid =10
      3  where id =2;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL> select * from table_a;
            ID SCHEDULED MARK                       PRID
             5 07-NOV-10 T05                           7
             6 18-SEP-10 T06                           8
             4 31-JAN-11 T02                           2
             1 18-JAN-11 T01                           2
             2 18-JAN-11 T02                          10
             3 18-JAN-11 T03                           1
    6 rows selected.
    SQL> But remember while updating u should choose a primary key column in
    where condition so that only desired row or record is updated..
    Regards
    Umesh

  • Inserting String data to BLOB column

    Hi All
    I want to insert String data into BLOB column using DBAdapter - through database procedure.
    anybody can help?
    Regards
    Albin Issac

    I have used utl_raw.cast_to_raw('this is only a test')).But for bigger string I get the error as "string literal too long" do we have any similar function for longer string.
    Thanks,
    -R

Maybe you are looking for

  • Why don't my event show up in different colors like i hear they would

    when i watched the video of ipad 2, it showed that the events were in diferent colors to help distinguish them, but on my ipad it is all purple

  • Adobe Photoshop 12 Mac, Installation problem

    Hi there ! I have a Adobe Photoshop Elements bought a few days ago 12 full version in retail and this is now trying to install on my Imac. Now I am annoyed about the following problem. " This serial number for Adobe Photoshop turning 12 could not be

  • WiFi Connection Problems WPA-Enterprise

    I am having an issue connecting to our WiFi at work using my Lumia 900.  I can connect to the network, but then it disconnects after about 15 seconds.  My Home and other Wifi networks do not exhibit this problem. Any Ideas?

  • DB adapter - Trim spaces in column

    Hi, We are facing an issue while using DB adapter when retrieving data from a column (VARCHAR2). Our column contains data like 'XXXX<spaces>XXX<spaces>'. Whenever we retrieve this column using Db adapter (both custom sql and Select option) and we are

  • Is 1000Base-T GBIC Supported in Catalyst 6006 now in China?

    Is 1000Base-T GBIC Supported in Catalyst 6006 now? If so, what is the hardware/software environment it needs (i.e.1000Base-T GBIC Card type and the CatOS or IOS version)?