Inserting XML String into Table with help of Stored Proc

I will be getting XML String from JAVA, which I have to insert in Table A, XML String is as follows
<?xml version = '1.0'?>
< TableA>
<mappings Record="3">
< MESSAGEID >1</ MESSAGEID >
< MESSAGE >This  is available at your address!</ MESSAGE>
</mappings>
<mappings Record="3">
< MESSAGEID >2</ MESSAGEID>
< MESSAGE >This isn’t available at your address. </ MESSAGE>
</mappings>
</ TableA >
Table Structure*
MESSAGEID     VARCHAR2(15 BYTE)
MESSAGE     VARCHAR2(500 BYTE)
This is the stored procedure which I have written to insert data into TableA, V_MESSAGE will be input parameter for inserting XML String 
create or replace procedure   AP_DBI_PS_MESSAGE_INSERT
V_MESSAGE VARCHAR2(1024)
AS
declare
charString varchar2(80);
finalStr varchar2(4000) := null;
rowsp integer;
V_FILEHANDLE UTL_FILE.FILE_TYPE;
begin
-- the name of the table as specified in our DTD
xmlgen.setRowsetTag('TableA');
-- the name of the data set as specified in our DTD
xmlgen.setRowTag('mappings');
-- for getting the output on the screen
dbms_output.enable(1000000);
-- open the XML document in read only mode
v_FileHandle := utl_file.fopen(V_MESSAGE);
--v_FileHandle := V_MESSAGE;
loop
BEGIN
utl_file.get_line(v_FileHandle, charString);
exception
when no_data_found then
utl_file.fclose(v_FileHandle);
exit;
END;
dbms_output.put_line(charString);
if finalStr is not null then
finalStr := finalStr || charString;
else
finalStr := charString;
end if;
end loop;
-- for inserting the XML data into the table
rowsp := xmlgen.insertXML('ONE.TableA',finalStr);
dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
xmlgen.resetOptions;
end;Please Help
Edited by: 846857 on Jul 18, 2011 10:55 PM

with t as (select xmltype('<TableA >
                           <mappings Record="3">
                           <MessageId>1</MessageId>
                           <Message> This bundle is available at your address!</Message>
                           </mappings>
                           <mappings Record="3">
                           <MessageId>2</MessageId>
                           <Message>This isn’t available at your address. </Message>
                           </mappings>
                           </TableA  >') col FROM dual)
  --End Of sample data creation with subquery factoring.
  --You can use the query from here with your table and column name.
select EXTRACTVALUE(X1.column_value,'/mappings/MessageId') MESSAGEID
      ,EXTRACTVALUE(X1.column_value,'/mappings/Message') MESSAGE
from t,table(XMLSEQUENCE(extract(t.COL,'/TableA/mappings'))) X1;Above Code works as i get result
MESSAGEID     MESSAGE
1             This bundle is available at your address!
2             This isn’t available at your address.
_____________________________________________ now I want to insert the result into Table A... How to proceed... Please help
Edited by: 846857 on Jul 19, 2011 12:15 AM

Similar Messages

  • Problem - insert JSON string into table in CLR function

    Hi
    I create a CLR function to insert JSON string into table.
    With this line 
    mt = JsonConvert.DeserializeObject<MyTable>(jsonStr.ToString());
    The class is OK (no error), but when I try to add the Assembly in Microsoft SQL Server Management Studio, it has error :
    Assembly 'newtonsoft.json, version=4.5.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed.' was not found in the SQL catalog.
    (I have Newtonsoft.Json in the Reference)
    Please help !
    Thanks

    Hi Bob
    Could you elaborate a bit more?
    I think the code is ok. The problem is when I deploy the Visual Studio creates/alters the assembly, and get the error
    Error:  SQL72014: .Net SqlClient Data Provider: Msg 6503, Level 16, State 12, Line 1 Assembly 'newtonsoft.json, version=6.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed.' was not found in the SQL catalog.
    ALTER ASSEMBLY [Database1]
        FROM 0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C0103000DE411540000000000000000E00002210B010B000012000000060000000000008E3000000020000000400000000000100020000000020000040000000000000006000000000000000080000000020000000000000300608500001000001000000000100000100000000000001000000000000000000000003C3000004F00000000400000A802000000000000000000000000000000000000006000000C000000042F00001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000094100000002000000012000000020000000000000000000000000000200000602E72737263000000A8020000004000000004000000140000000000000000000000000000400000402E72656C6F6300000C0000000060000000020000001800000000000000000000000000004
    An error occurred while the batch was being executed.
    Done building project "Database1.sqlproj" -- FAILED.
    This is my FillRow function. Without the bold line, the everything is fine. I can create the assembly, then create the SQL function. Done. When I call select from the SQL function, it returns 10 rows as expected.
    public static IEnumerable getTable(SqlString jsonStr)
            ArrayList resultCollection = new ArrayList();
            MyTable mt;
            //mt = JsonConvert.DeserializeObject<MyTable>(jsonStr.ToString());
            int c = 1;
            while (c < 10)
                mt = new MyTable();
                mt.GlobalId = c.ToString();
                mt.DateSet = "DS=!=" + c.ToString();
                mt.Timestamp = "TS==" + c.ToString();
                mt.PartnerId = "PI==" + c.ToString();
                mt.PartnerUserId = "PUI=" + c.ToString();
                mt.UserIP = "UIP=" + c.ToString();
                mt.UserAgent = "UG=" + c.ToString();
                mt.Referer = "R=" + c.ToString();
                resultCollection.Add(mt);
                c++;
            //resultCollection.Add(mt);
            return resultCollection;

  • Insert XML String into XML file at a certain position

    Hello,
    I have this xml string:
    <jdbc-driver-params>
    <url>jdbc:oracle:thin:@localhost:1521:mydb</url>
    <driver-name>oracle.jdbc.OracleDriver</driver-name>
    <properties>
    <property>
    <name>user</name>
    <value>myuser</value>
    </property>
    </properties>
    <password-encrypted>myuser</password-encrypted>
    </jdbc-driver-params>and i need to insert it into an xml file at a certain position (as child for a node)
    The xml file looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90"
        xmlns:sec="http://www.bea.com/ns/weblogic/90/security"
        xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
        <name>myDB</name>
        <jdbc-data-source-params>
            <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
        </jdbc-data-source-params>
    </jdbc-data-source>And this is how I would like to get it in the end:
    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd">
      <name>mydb</name>
      <jdbc-driver-params>
        <url>jdbc:oracle:thin:@localhost:1521:myDB</url>
        <driver-name>oracle.jdbc.OracleDriver</driver-name>
        <properties>
          <property>
            <name>user</name>
            <value>myuser</value>
          </property>
        </properties>
        <password-encrypted>myuser</password-encrypted>
      </jdbc-driver-params>
      <jdbc-connection-pool-params>
        <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>
      </jdbc-connection-pool-params>
      <jdbc-data-source-params>
        <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
      </jdbc-data-source-params>
    </jdbc-data-source>So, I obtain the node for the given xml string, the jdbc-data-source node from the xml file and i attempt the appendChild. The problem is that nothing really gets inserted into the xml file.
    Someone, any idea?
    My code:
    try
                   DOMParser parser = new DOMParser();
                   parser.parse(xmlFileName);
                   Document doc = parser.getDocument(); // the document we will insert node into
                   Node root = doc.getElementsByTagName("jdbc-data-source").item(0);
                   //get XML string node
                   DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db = factory.newDocumentBuilder();
                   InputSource inStream = new InputSource();
                   inStream.setCharacterStream(new StringReader(xmlString));
                   Document doc4XMLString = db.parse(inStream);
                   Node rootXMLString = doc4XMLString.getElementsByTagName("jdbc-driver-params").item(0);
                   root.appendChild(doc.importNode(rootXMLString, true));
                   return true;
              catch (Exception e)
                   e.printStackTrace();
              }Thanks,
    johnny
    Edited by: smeag0l on Aug 6, 2008 5:08 PM
    Edited by: smeag0l on Aug 6, 2008 5:43 PM

    Well, you helped me again :-) Thank you very much!
    Here is how the code should look:
                            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   DocumentBuilder db4XMLFile = factory.newDocumentBuilder();
                   Document doc4XMLFile = db4XMLFile.parse(xmlFileName);
                   Node root4XMLFile = doc4XMLFile.getElementsByTagName(rootNodeName).item(0);
                   DocumentBuilder db4XMLString = factory.newDocumentBuilder();
                   InputSource inStream = new InputSource();
                   inStream.setCharacterStream(new StringReader(xmlString));
                   Document doc4XMLString = db4XMLString.parse(inStream);
                   Node root4XMLString = doc4XMLString.getElementsByTagName(xmlStringNodeName).item(0);
                   root4XMLFile.appendChild(doc4XMLFile.importNode(root4XMLString, true));
                   File file = new File(xmlFileName);
                            Result result = new StreamResult(file.toURI().getPath());
                   Source source = new DOMSource(doc4XMLFile);
                   Transformer xformer = TransformerFactory.newInstance().newTransformer();
                      xformer.transform(source, result);

  • Can SQL*Loader Insert concatenated string into table

    Hi All,
    I want to insert a column, whose format is "abc" + to_char(sysdate,'YYYYMMDD'), into temp table. How can I do it? Thank you in advance.
    Best Regards,
    Sheng

    Hi Lukasz,
    Thank you for your help! The "abc" is a constant string, it isn't a column. And I use concat function to solve the problem. like this
    LOAD DATA
    INFILE data.txt
    INTO TABLE tmp_table
    fields terminated by "," optionally enclosed by '"'
    ( c1 "concat('abc',TO_CHAR(SYSDATE, 'YYYYMMDD'))"
    Sheng
    Edited by: Sheng on 2013-5-26 下午4:44

  • Problem inserting xml doc into tables

    I'm trying to load and xml doc into a table/columns using putXML. I clearly have elements in my xml doc that I do not want to load into the table. I am receiving the following error: The XML element tag 'VERB' does not match the name of any of the columns/attributes of the target database. I'm having difficulty figuring out how to exclude of ignore these elements.
    Any help would be greatly appreciated.
    Thanks,
    John

    Hi,
    How about applying an XSL on the existing XML doc to create another XML doc to filter out the table column not found in the target db table, so that all the columns are matched and then use putXML to load?
    Hope that helps.
    OTN team@IDC

  • Parse column with csv string into table with one row per item

    I have a table (which has less than 100 rows) - ifs_tables that has two columns: localtable and Fields. Localtable is a table name and Fields contains a subset of columns from that table. Fields is a comma delimited list:  'Fname,Lname'. It looks like
    this:
    localtable         fields
    =========  =============
    customertable   fname,lname
    accounttable     type,accountnumber
    Want to end up with a new table that has one row per column. It should look like this:
    TableName             ColumnName
    ============ ==========
    CustomerTable        Fname
    CustomerTable        Lname
    AccountTable          Type
    AccountTable          AccountNumber
    Tried this code but have two issues (1) My query using the Splitfields functions gets "Subquery returned more than 1 value" (2) some of my Fields has hundreds of collumns in the commas delimited list. It will returns "Msg 530, Level 16, State
    1, Line 8. The statement terminated. The maximum recursion 100 has been exhausted before statement completion.maxrecursion greater than 100." Tried adding OPTION (maxrecursion 0) in the Split function on the SELECT statment that calls the CTE, but
    the syntax is not correct.
    Can someone help me to get this sorted out? Thanks
    DROP FUNCTION [dbo].[SplitFields]
    go
    CREATE FUNCTION [dbo].[SplitFields]
    @String NVARCHAR(4000),
    @Delimiter NCHAR(1)
    RETURNS TABLE
    AS
    RETURN
    WITH Split(stpos,endpos)
    AS(
    SELECT 0 AS stpos, CHARINDEX(@Delimiter,@String) AS endpos
    UNION ALL
    SELECT endpos+1, CHARINDEX(@Delimiter,@String,endpos+1)
    FROM Split
    WHERE endpos > 0
    SELECT 'Id' = ROW_NUMBER() OVER (ORDER BY (SELECT 1)),
    'Data' = SUBSTRING(@String,stpos,COALESCE(NULLIF(endpos,0),LEN(@String)+1)-stpos)
    FROM Split --OPTION ( maxrecursion 0);
    GO
    IF OBJECT_ID('tempdb..#ifs_tables') IS NOT NULL DROP TABLE #ifs_tables
    SELECT *
    INTO #ifs_tables
    FROM (
    SELECT 'CustomerTable' , 'Lname,Fname' UNION ALL
    SELECT 'AccountTable' , 'Type,AccountNumber'
    ) d (dLocalTable,dFields)
    IF OBJECT_ID('tempdb..#tempFieldsCheck') IS NOT NULL DROP TABLE #tempFieldsCheck
    SELECT * INTO #tempFieldsCheck
    FROM
    ( --SELECT dLocaltable, dFields from #ifs_tables
    SELECT dLocaltable, (SELECT [Data] FROM dbo.SplitFields(dFields, ',') ) from #ifs_tables
    ) t (tLocalTable, tfields) -- as Data FROM #ifs_tables
    SELECT * FROM #tempFieldsCheck

    Try this
    DECLARE @DemoTable table
    localtable char(100),
    fields varchar(200)
    INSERT INTO @DemoTable values('customertable','fname,lname')
    INSERT INTO @DemoTable values('accounttable','type,accountnumber')
    select * from @DemoTable
    SELECT A.localtable ,
    Split.a.value('.', 'VARCHAR(100)') AS Dept
    FROM (SELECT localtable,
    CAST ('<M>' + REPLACE(fields, ',', '</M><M>') + '</M>' AS XML) AS String
    FROM @DemoTable) AS A CROSS APPLY String.nodes ('/M') AS Split(a);
    Refer:-https://sqlpowershell.wordpress.com/2015/01/09/sql-split-delimited-columns-using-xml-or-udf-function/
    CREATE FUNCTION ParseValues
    (@String varchar(8000), @Delimiter varchar(10) )
    RETURNS @RESULTS TABLE (ID int identity(1,1), Val varchar(8000))
    AS
    BEGIN
    DECLARE @Value varchar(100)
    WHILE @String is not null
    BEGIN
    SELECT @Value=CASE WHEN PATINDEX('%'+@Delimiter+'%',@String) >0 THEN LEFT(@String,PATINDEX('%'+@Delimiter+'%',@String)-1) ELSE @String END, @String=CASE WHEN PATINDEX('%'+@Delimiter+'%',@String) >0 THEN SUBSTRING(@String,PATINDEX('%'+@Delimiter+'%',@String)+LEN(@Delimiter),LEN(@String)) ELSE NULL END
    INSERT INTO @RESULTS (Val)
    SELECT @Value
    END
    RETURN
    END
    SELECT localtable ,f.Val
    FROM @DemoTable t
    CROSS APPLY dbo.ParseValues(t.fields,',')f
    --Prashanth

  • String into table with separate row and column bytes

    Hello, well I have a string (coming from an I2C eeprom and then through RS232 via MCU) with this format -->  byte1 byte2 byte3 byte4 byte5 \r byte1 byte2 byte3 byte4 byte5 \r and so on, the length of the frame isn't known, it depends on how many sensors have passed over its limit. I am having problems on plotting this information into a table, I don't know at all how to separate each byte in a column and each packet of five bytes in a row. I attached my vi with the example of two sensors information string, I am able only to plot the first sensor .Any help will be welcome.
    Thanks in advance.
    Regards. 
    Attachments:
    string_to_table.vi ‏31 KB

    This is working modification of your code
    Message Edited by EVS on 08-26-2005 09:16 PM
    Jack
    Win XP
    LabVIEW 6.1, 7.0, 7.1, LabWindows/ CVI 7.1
    Let us speek Russian
    Attachments:
    Clip_5.jpg ‏53 KB

  • 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

  • Help needed badly Insert text data from xml files into tables

    Hi all, I have asked to do insertion of text from a xml file into tables upon receiving using pro*c. i've done quite an amount of research on xml parser in c but there wasn't much information for mi to use for implementation...
    Guys don't mind helping me to clarify few doubts of mine...
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?
    2. Is there any tutorials or help files for xml parser libs where i can read up?
    I need the xml parser to recognise the tags, followed by recognising the text after the tags.
    eg. xml format
    <studentID> 0012 </studentID>
    <student> john </student>
    <studentID> 0013 </studentID>
    <student> mary </student>
    text willl be inserted into tables like this:
    studentID | student
    0012 | john
    0013 | mary
    by the way i'm using oracle 8i on HP-UX. Thanks in advance.

    I can answer one of of your questions at least
    1. Where can i get the oracle xml parser libs? Is it included when i installed oracle 8i?You need the XML XDK. You can use http://www.oracle.com/technology/tech/xml/xdkhome.html as your starting point. I believe the 9i version works for 8i.
    I have no pro*c experience so I can't offer any other suggestions regarding how to do this in pro*c.

  • Does anyone can help me to import XML string into a ORACLE database

    Hi guys!
    i have some problem that my friend wants me to convert XML string to Oracle relational database which means.
    let's say, there is a table that a row has XML string.
    so table has XML string with varchar type.
    what my friend want me to do is, the string needs to be solved as a relational database.
    like
    A table has 'ID', 'data', 'result' rows
    and Data column has XML string like <?xml version...............>
    then wants to convert that data column's XML data into TABLE B with structure normally XML has.
    i'm so confused and have no idea at all.. also i couldn't find any solution related to my stuff..
    if someone knows how to solve the problem, just let us know
    thx

    The database is 10.2.0
    What sort of example do u want me to give you..
    i thought i give all information on the post..
    i will explain it
    let's say there are 3 columns ID,Name,Code
    Id = normal integer
    Name= varchar
    Code= varchar
    and i need to conver that XML in the Code column into relational databases
    the code column has normal XML code which is starting from <?xml version.... and so on
    so does it explain?
    please help me!

  • Trying To Insert XML String Greater Than 4000 Characters in PHP Fails

    Dear Sir,
    Subject:-Trying To Insert XML String Greater Than 4000 Characters in PHP Fails ORA-01704.
    In an attempt to design web app in PHP and inserting data into "CLOB" field of "articles" table associated with it, returning ORA-01704: string literal too long error.
    Platform: OEL5
    Database 11g(11.0.7.0)
    php : 5.2
    I refer to oracle document ID: [ID 336888.1] it is asking to contact support.
    Please help us in this regards.
    Many Thanks,
    mkyazdani

    Hi,
    I appreciate you, yes it is similar i have referred that manual and also inform to our php developer about the changes we need to make in our php script.
    Regards,
    mkyazdani

  • How to get an xml string into a Document w/o escaping mark-up characters?

    Hi,
    I am using one of the latest xerces using Java. I am pretty sure I am using xerces-2.
    I have an existing Document and I am trying to add more content to it. The new content itself is xml string. I am trying to insert this xml string into the document using document.createTextNode. I am able to insert, but somewhere it is escaping the mark-up characters (<,>,etc). When I convert the document into String, I can see, for example, <userData> instead of <userData>.
    There is an alternative option to accomplish this by creating a new document with this xml string, get the root element, import this element into my document. Execution time for this procedure is very high - means, this is very bad in terms of time-wise performance.
    Can any help on how to accomplish this (bringing an xml string into a document without escaping mark-up characters) in time-efficient way.

    So you want to treat the contents of the string as XML rather than as text? Then you have to parse it.
    Or if your reason for asking is just that you don't like the look of escaped text, then use a CDATA section to contain the text.

  • Inserting XML content into Database

    Hallo
    i´m new to Oracle.
    i want to insert xml content into the database. for testing i installed the version 10g on a windowsxp computer.
    i read the oracle xmldb developer´s guide. on page 3-4 ff. it is explained how i can insert content into the database. that´s how i did it (with isqlplus):
    create table example1(key_column varchar2(10) primary key, xml_column xmltype)
    -->works fine
    create table example2 of xmltype
    -->works fine
    now i made a directory under c:\myXmlFilesForDb in WinXp
    create directory xmldir as 'c:/myXmlFilesForDb in WinXp'
    (also tried: create directory xmldir as 'c:\myXmlFilesForDb in WinXp')
    --> in this directory is a file named: mydokument.xml
    --> works fine
    insert into example2 values(xmltype(bfilename('xmldir','mydokument.xml'), nls_charset_id('AL32UTF8')))
    the following error message is displayed (in German):
    ORA-22285: Verzeichnis oder Datei für FILEOPEN-Vorgang nicht vorhanden
    ORA-06512: in "SYS.DBMS_LOB",Zeile 523
    ORA-06512: in "SYS:XMLTYPE",Zeile 287
    ORA-06512: in Zeile 1
    whats wrong? can anybody help me please?
    ohhh....
    thank you very much
    cu
    George

    Directory entries are case sensitive.
    Select * From dba_directories to ensure you case is the same as you are using in your insert statement.
    Are you using the same user? if not grant read on directory directoryname to username;
    try to just select.
    select dbms_lob.getLength(BFileName('directoryname','filename.xml'))
    as length
    from dual;

  • XMLStreamException: Unable to write XML string which starts with the illegal XML char 0x0000

    Hi,
    I am trying to run a WebLogic 8.1 Workshop webservice using Tuxedo Controls. I
    am running in to an XML error:
    <faultcode>JWSError</faultcode>
    <faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
    com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
    the illegal XML char 0x0000</faultstring>
    <detail>
    If i look into the application server log file, It says:
    <FML32Deserializer::deserializeInteger>
    ####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer> <ExecuteThread:
    '11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
    <000000> <Exception deserializing field BUFFERSIZE, exception: weblogic.jws.control.ControlException:
    Error getting field BUFFERSIZE as a Integer, exception: 4 (FNOTPRES)>
    ####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer> <ExecuteThread:
    '11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
    <000000> <FML32Deserializer::deserializeField - Name=ROWID, type=class java.lang.String>
    But these fields are in the field table class file generated using java weblogic.wtc.jatmi.mkfldclass32

    I am pasting the response i get while i try to run this web service using WebLogic
    Workshop.
    Anyones help would be much appreciated.
    Thanks,
    Deepak
    Service Response
    Submitted at Friday, December 19, 2003 1:25:00 PM CST
    <error>
    <faultcode>JWSError</faultcode>
    <faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
    com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
    the illegal XML char 0x0000</faultstring>
    <detail>
    com.bea.wlw.runtime.core.request.ResponseValidationException: com.bea.xml.marshal.XmlEncodingException:
    Error writing XML stream: com.bea.xml.pure.XMLStreamException: Unable to write
    XML string which starts with the illegal XML char 0x0000
    at com.bea.wlw.runtime.jws.request.MimeXmlResponse.setReturnValue(MimeXmlResponse.java:35)
    at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.runAsInvoke(BaseDispatcherBean.java:242)
    at com.bea.wlw.runtime.core.bean.BaseDispatcherBean.invoke(BaseDispatcherBean.java:54)
    at com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(SyncDispatcherBean.java:159)
    at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(SyncDispatcher_k1mrl8_EOImpl.java:100)
    at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatcher.java:134)
    at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.java:46)
    at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.exploreExec(HttpServerHelper.java:253)
    at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executeGetRequest(HttpServerHelper.java:570)
    at com.bea.wlw.runtime.core.dispatcher.HttpServer.doGet(HttpServer.java:81)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6316)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    Caused by: com.bea.xml.marshal.XmlEncodingException: Error writing XML stream:
    com.bea.xml.pure.XMLStreamException: Unable to write XML string which starts with
    the illegal XML char 0x0000
    at com.bea.xml.marshal.MarshalContext.error(MarshalContext.java:140)
    at com.bea.xml.marshal.MarshalContext.writeCharacterData(MarshalContext.java:178)
    at com.bea.xml.marshal.AtomicValueMPlan.marshal(AtomicValueMPlan.java:79)
    at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
    at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
    at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:349)
    at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
    at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
    at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:358)
    at com.bea.xml.marshal.MarshalContext.writeElementObjectOrHref(MarshalContext.java:426)
    at com.bea.xml.marshal.BaseMPlan.writeValueUsingStrategy(BaseMPlan.java:307)
    at com.bea.xml.marshal.BaseMPlan.marshal(BaseMPlan.java:349)
    at com.bea.xml.marshal.MethodMPlan.marshal(MethodMPlan.java:260)
    at com.bea.wlw.runtime.core.dispatcher.DispMessage.marshalXml(DispMessage.java:386)
    at com.bea.wlw.runtime.jws.request.MimeXmlResponse.writePart(MimeXmlResponse.java:105)
    at com.bea.wlw.runtime.jws.request.MimeXmlResponse.writeOutputPart(MimeXmlResponse.java:97)
    at com.bea.wlw.runtime.jws.request.MimeXmlResponse.setReturnValue(MimeXmlResponse.java:31)
    ... 22 more
    </detail>
    </error>
    "Deepak" <[email protected]> wrote:
    >
    >
    >
    Hi,
    I am trying to run a WebLogic 8.1 Workshop webservice using Tuxedo Controls.
    I
    am running in to an XML error:
    <faultcode>JWSError</faultcode>
    <faultstring>com.bea.xml.marshal.XmlEncodingException: Error writing
    XML stream:
    com.bea.xml.pure.XMLStreamException: Unable to write XML string which
    starts with
    the illegal XML char 0x0000</faultstring>
    <detail>
    If i look into the application server log file, It says:
    <FML32Deserializer::deserializeInteger>
    ####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer>
    <ExecuteThread:
    '11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
    <000000> <Exception deserializing field BUFFERSIZE, exception: weblogic.jws.control.ControlException:
    Error getting field BUFFERSIZE as a Integer, exception: 4 (FNOTPRES)>
    ####<Dec 19, 2003 1:25:00 PM CST> <Debug> <WLW> <centurytelweb> <cgServer>
    <ExecuteThread:
    '11' for queue: 'weblogic.kernel.Default'> <<anonymous>> <BEA1-0237CF026485B78A2335>
    <000000> <FML32Deserializer::deserializeField - Name=ROWID, type=class
    java.lang.String>
    But these fields are in the field table class file generated using java
    weblogic.wtc.jatmi.mkfldclass32

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

Maybe you are looking for