How to fill an oracle CLOB with a XML document using Unicode UTF8

Hi,
I'm working with C# and oracle database v8.1.7 (release 3), and i'm having some problems to fill correctly an oracle CLOB parameter with XML document using UTF8 encoding.
It works fine with "Encoding.Unicode" but not with "Encoding.UTF8". The problem is that i can't use Unicode (UTF16) with oracle 8.
Can someone help me ? Thanks.
Here is my code.
OracleTransaction tx = conn.BeginTransaction();
OracleCommand cmd = conn.CreateCommand();
cmd.Transaction = tx;
cmd.CommandText = "declare xx clob; begin dbms_lob.createtemporary(xx, false, 0); :tempclob := xx; end;";
cmd.Parameters.Add(new OracleParameter("tempclob", OracleType.Clob)).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
OracleLob tempLob = (OracleLob)cmd.Parameters[0].Value;
MemoryStream MemStrm = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(MemStrm, Encoding.UTF8);
writer.Formatting = Formatting.Indented;
WriteXMLExample(writer, "MSFT", 74.125, 5.89, 69020000);
writer.Close();
cmd.Parameters.Clear();
cmd.CommandText = "test_xml";                    
cmd.CommandType = CommandType.StoredProcedure;
tempLob.Write(MemStrm.GetBuffer(), 0, MemStrm.GetBuffer().Length );
tempLob.Position = 0;
cmd.Parameters.Add(new OracleParameter("xml_inout", OracleType.Clob)).Value = (OracleLob) tempLob;
cmd.ExecuteNonQuery();
Console.WriteLine( "Param 0 = " + cmd.Parameters[0].Value.ToString() );
tx.Commit();

Hi,
I'm working with C# and oracle database v8.1.7 (release 3), and i'm having some problems to fill correctly an oracle CLOB parameter with XML document using UTF8 encoding.
It works fine with "Encoding.Unicode" but not with "Encoding.UTF8". The problem is that i can't use Unicode (UTF16) with oracle 8.
Can someone help me ? Thanks.
Here is my code.
OracleTransaction tx = conn.BeginTransaction();
OracleCommand cmd = conn.CreateCommand();
cmd.Transaction = tx;
cmd.CommandText = "declare xx clob; begin dbms_lob.createtemporary(xx, false, 0); :tempclob := xx; end;";
cmd.Parameters.Add(new OracleParameter("tempclob", OracleType.Clob)).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
OracleLob tempLob = (OracleLob)cmd.Parameters[0].Value;
MemoryStream MemStrm = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(MemStrm, Encoding.UTF8);
writer.Formatting = Formatting.Indented;
WriteXMLExample(writer, "MSFT", 74.125, 5.89, 69020000);
writer.Close();
cmd.Parameters.Clear();
cmd.CommandText = "test_xml";                    
cmd.CommandType = CommandType.StoredProcedure;
tempLob.Write(MemStrm.GetBuffer(), 0, MemStrm.GetBuffer().Length );
tempLob.Position = 0;
cmd.Parameters.Add(new OracleParameter("xml_inout", OracleType.Clob)).Value = (OracleLob) tempLob;
cmd.ExecuteNonQuery();
Console.WriteLine( "Param 0 = " + cmd.Parameters[0].Value.ToString() );
tx.Commit();

Similar Messages

  • How do I Load a clob from an XML field in an XMLTYPE using XMLTABLE ?

    I am trying to load data into a CLOB from a XML field using XMLTABLE.
    I have a SUMMARY xml field with over 100 K of data (potentialy)
    and I can load all the other datatype fields to columns but can not load the xml fields over 4000 characters.
    example
    First I create a table of XMLTYPE. I need to sqlload new files in at regular intervals.
    Create table WEB_XML of XMLTYPE;
    Then I create my relational table....
    create table WEB_WORKING
    request_id varchar(10),
    ref_number varchar(20),
    summary clob
    The I use the .ctl file to sqlload the xml data in
    LOAD DATA
    INFILE *
    INTO TABLE WEB_XML
    append
    xmltype(XMLDATA)
    ext_fname filler char(90),
    XMLDATA LOBFILE(ext_fname) TERMINATED BY EOF
    BEGINDATA
    XMLFILE1.xml
    After loading the WEB_XML table using sqlldr, I try to load my relational table using XMLTable
    INSERT into WEBBAR_WORKING
    request_id ,
    ref_number ,
    summary
    SELECT X.* FROM WEB_XML P2,
    XMLTable ( '//Request//REQUESTVIEW'
    PASSING P2.object_value
    COLUMNS
    "request_id" VARCHAR(10) PATH 'REQUEST_ID',
    "ref_number" VARchar(20) PATH 'REF_NUMBER',
    "SUMMARY" clob PATH 'SUMMARY'
    ) AS X;
    This gives an error saying its not expecting clob
    My XML looks somthing like
    -<Request>
    -<REQUESTVIEW>
    <REQUEST_ID>3140</REQUEST_ID>
    <ref_number>2003-04-02</RECEIVED_DATE>
    <SUMMARY>
    OVER 100 K of data
    </SUMMARY>
    </REQUESTVIEW>
    </Request>

    ok
    that helped lot, im getting there however some more help please
    This SQL
    SELECT request_id, recieved_by, X.SUMMARY.getClobVal()
    FROM WEB_XML P2,
    XMLTable
    '//Request//REQUESTVIEW'
    PASSING P2.object_value
    COLUMNS
    "request_id" VARCHAR(10) PATH 'REQUEST_ID',
    "received_by" VARCHAR(10) PATH 'RECEIVED_BY',
    "SUMMARY" xmltype PATH 'SUMMARY'
    ) AS X;
    SELECT request_id, recieved_by, X.SUMMARY.getClobVal()
    ERROR at line 1:
    ORA-00904: "RECIEVED_BY": invalid identifier
    If I use the X.request_id, X.received_by ......
    i get the error message
    Package or function is in aan invalid state.
    But this SQL was successful in getting the clob by itself but with the XML tgs around it still, how do I strip the XML tags from around this result ?
    SELECT X.SUMMARY.getClobVal()
    FROM WEBBAR_XML P2,
    XMLTable
    '//Request//REQUESTVIEW'
    PASSING P2.object_value
    COLUMNS
    "SUMMARY" XMLTYPE PATH 'SUMMARY'
    ) AS X;
    ----------------------------------------------------------

  • How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?

    How can I associate 2 appleids with one account or use a different Appleid for imessage as described in another post?
    I have rejoined the iPhone community, not with one iPhone but with two. My wife agreed to move from the unenlightened!
    I have set up both under my apple account and want to keep it that way. But I do not want iMessages going to both phones. I would like separate message queues but share all apps and other purches from the store.
    I have created a separate AppleID for her but under Settings>Message>Receive At (it currently says 2 addresses) > ... will not allow me to change the current eMail address and when I add hers (her appleid) it errors out. The only thing I can do in the Apple ID field is to manage my account and not change it to hers.
    How can I have 2 iPhones (and my iPad) on the same account but have separate identies?
    Thanks,
    LpGrumpy

    1. Yes. Restart with the Option key held down as needed.
    2. No, it won't be a problem.
    (83373)

  • WIth LabVIEW how do I control an instrument with a RS232 output, using a RS232 to USB converter cable.

    WIth LabVIEW how do I control an instrument with a RS232 output, using a RS232 to USB converter cable since I dont have rs232 ports. I have two instruments that I want to control in this manner. One is an Imada ZPS force gage with RS232 output. The other is a Panasonic HL-G103-S-J laser micrometer sensor which is RS422. I've done considerable LabVIEW programming using GPIB but I have no experience with devices like these. Any tutorial or examples would be greatly appreciated.
    Thanks.
    Solved!
    Go to Solution.

    I understand that you want to control a device which having RS 232 port as output. If so, you can use an USB-RS232 cable from PC to device and you can control or monitor the device.
    See this link http://zone.ni.com/devzone/cda/epd/p/id/2669
    Also, first check the device in hyperterminal and then continue to program in labVIEW. You can find the serial VI's in Instrument I/O.

  • How to create a Sales order with ref to Contract using Function Module

    How to create a Sales order with ref to Contract using Function Module BAPI_SALESDOCU_CREATEFROMDATA ?

    We have a unique situation where we like change the sold-to customer of the sales order
    once order has been created. These orders have been created using either by function module
    BAPI_SALESDOCUMENT_COPY or using BDC (VA01, Copy with reference).
    These two processes work abosolutely fine except someone might have change the sold-to
    customer of the ship-to customer of the original sales order. If this the case then the new
    sales order will be created with the old sold-to and with not the new sold-to.
    We tried using BAPI_SALESDOCUMENT_CHANGE and commit afterwards. We checked
    the returned parameteres of the BAPIs and they are all successful but sold-to remains the
    same old one.
    Any help would be much more appreciated.

  • How to calculate any two date with diffence calculation by using obiee11g?

    Hi,
    i have a requirement like,
    location wise current month and previous month with movement calculation,can to tell me how to calculate any two date with diffence calculation
    by using obiee11g
    Note,
    I tried to implemented ago function as well as dynamic two dates calculation using $2-$1 methods..but i am getting the o/p it's self i am getiing some null value also that' why it's not tallying with our actual report.
    i tired to used ifnull(mesaurecolumn,0) also case condition on the mesaure colution still it's not tallying.
    THanks and Rds,
    Devarasu.R

    Hi,
    for Date Difference........
    TimestampDiff(interval, timestamp1, timestamp2)
    ex:TimestampDiff(SQL_TSI_DAY, cast('1-apr-2011' as date), current_date)
    Where:
    interval
    The specified interval. Valid values are: SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY,
    SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR.
    Cheers,
    Aravind

  • Searching CLOB column of XML documents with leading wildcard - Performance

    Hi, our table has a text indexed CLOB column of XML documents and when performing a search with a leading wild card, we never retrieve any results.
    The query looks like this:
    select id from <table> where contains(columnname, '(%12345)') > 0;
    I cant even generate an explain plan from this query. I killed it after 39 minutes.
    If the query changes to:
    select id from <table> where contains(columnname, '(12345%)') > 0;
    I get an explain plan immediately with a cost=2 and when I execute the query, I get results in less than a second.
    I'd appreciate any thoughts of what I should check or what the problem might be.
    Thanks! Doug

    Can you provide a script that reproduces the case. I am unable to reproduce the problem with just some small sample data, as shown below. That means that there is nothing wrong with the syntax, but you may be having problems due to the size of your data or other parameters that have not been mentioned.
    SCOTT@10gXE> CREATE TABLE your_table (id NUMBER, columnname CLOB)
      2  /
    Table created.
    SCOTT@10gXE> insert into your_table
      2  select 1, dbms_xmlgen.getxml
      3             ('select deptno, dname,
      4                   cursor (select empno, ename
      5                        from      emp
      6                        where  emp.deptno = dept.deptno ) employee
      7               from   dept
      8               where  deptno = 10')
      9  from   dual
    10  /
    1 row created.
    SCOTT@10gXE> SELECT * FROM your_table
      2  /
            ID COLUMNNAME
             1 <?xml version="1.0"?>
               <ROWSET>
                <ROW>
                 <DEPTNO>10</DEPTNO>
                 <DNAME>ACCOUNTING</DNAME>
                 <EMPLOYEE>
                  <EMPLOYEE_ROW>
                   <EMPNO>7782</EMPNO>
                   <ENAME>CLARK</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7839</EMPNO>
                   <ENAME>KING</ENAME>
                  </EMPLOYEE_ROW>
                  <EMPLOYEE_ROW>
                   <EMPNO>7934</EMPNO>
                   <ENAME>MILLER</ENAME>
                  </EMPLOYEE_ROW>
                 </EMPLOYEE>
                </ROW>
               </ROWSET>
    SCOTT@10gXE> CREATE INDEX your_idx ON your_table (columnname)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  /
    Index created.
    SCOTT@10gXE> EXEC DBMS_STATS.GATHER_TABLE_STATS ('SCOTT', 'YOUR_TABLE')
    PL/SQL procedure successfully completed.
    SCOTT@10gXE> SET AUTOTRACE ON EXPLAIN
    SCOTT@10gXE> select id from your_table where contains (columnname, '(%839)') > 0
      2  /
            ID
             1
    Execution Plan
    Plan hash value: 2832585188
    | Id  | Operation                   | Name       | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |            |     1 |   888 |     0   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| YOUR_TABLE |     1 |   888 |     0   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | YOUR_IDX   |       |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("COLUMNNAME",'(%839)')>0)
    SCOTT@10gXE> SET AUTOTRACE OFF

  • How to Configure a oracle R12 with RAC on two different  system .

    I have one laptop and one desktop
    Laptop----
    on laptop I have install vmware 8
    Host OS --win7
    Guest OS---linux 4
    Desktop ---
    On Desktop I have install Vmware 8
    Hosts OS --- Win XP
    Guest OS ---Linux 4
    Plz suggest How configure oracle R12 with RAC using both system .

    Hussein Sawwan wrote:
    on laptop I have install vmware 8
    Host OS --win7
    Guest OS---linux 4
    Desktop ---
    On Desktop I have install Vmware 8
    Hosts OS --- Win XP
    Guest OS ---Linux 4
    Plz suggest How configure oracle R12 with RAC using both system .If you want to configure RAC, then you must have the same OS installed on all RAC nodes -- See (RAC: Frequently Asked Questions [ID 220970.1], Does Oracle Clusterware or Oracle Real Application Clusters support heterogeneous platforms?) for details.
    Once you have the same OS, please refer to:
    Oracle E-Business Suite Release 12 High Availability Documentation Roadmap [ID 1072636.1]
    Using Oracle 10g Release 2 Real Application Clusters and Automatic Storage Management with Oracle E-Business Suite Release 12 [ID 388577.1]
    Using Oracle 11g Release 2 Real Application Clusters with Oracle E-Business Suite Release 12 [ID 823587.1]
    Thanks,
    HusseinHi Hussein,
    For Rac I am using both same OS (linux 4) for both nodes .
    Plz suggest its possible to install two nodes on different machine(diiferent virtual machine on different system ) .Can communicate both machine without any problem if its possible plz provide links.

  • Re: how can i interface Oracle 8i with webpages in HTML

    Hi all,
    I am a novice in Oracle 8i. I want to know how to interface some tables that are in Oracle 8i with some static pages in HTML? Can it be done or do I have to use Java?
    I need a prompt reply for this.
    Thanks,
    Sangeeta

    You'll have to use the destype DELIMITEDDATA to render your Report in CSV format. Then set the mime type to Excel. I don't know the exact syntax, so please do a search in metalink for "reports excel" for examples and more info.
    Regards,
    Martin Malmstrom

  • How to fill grid column combobox with data?

    Hi Experts,
    I have a question about ComboBox column in a Grid item. I know how to set column to be a combobox, but question is - how to fill this combobox with ValidValues?
    I execute query for data table binded with grid and then change column's type to combobox.
    Regards
    Szymon Lipnicki

    Hi Szymon,
    You need to add the Value and Description to the Combo's ValidValue collection, just like with a normal Combo.
    I leave you a sample that shows how to fill a Combo from a RecordSet.
                Dim oRS As SAPbobsCOM.Recordset = oCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                oRS.DoQuery("SELECT T0.ListNum, T0.ListName FROM [dbo].[OPLN] T0")
                If oRS.RecordCount > 0 Then
                    Dim oGrid As SAPbouiCOM.Grid = oForm.Items.Item("grid").Specific
                    Dim oColumn As SAPbouiCOM.Column = oGrid.Columns.Item("PriceLst")
                    For i As Integer = 1 To oRS.RecordCount
                        oColumn.ValidValues.Add(oRS.Fields.Item(0).Value.ToString, oRS.Fields.Item(1).Value.ToString)
                        oRS.MoveNext()
                    Next
                End If
    Best Regards,
    Vítor Viera

  • How to fill an 8x10 page with the same image for making buttons?

    How do you make a button template using the grid?  How do you import the image onto that, and how do you fill an entire page with the same image ie-  1" circles

    I'm trying to do the same thing but I want 1" squares.  I just upgraded from Elements 6 and I did this
    quite often for pendant necklaces.  I used to go and print individual prints, but the previous options are not there.  ;(
    And the picture package is only showing 20 (2x2) as being the smallest size.  I don't see a custom button.
    Can anyone tell me how to do this?  We're doing these for a fundraiser and I can't even print anymore.
    Thanks,
    Kimberly

  • Integrating Oracle EBS with web services which use SAML authentication

    Hi,
    I have a requirement to invoke web service using PL/SQL from a Custom Form of EBS.
    The web Service is configured to use SAML as authentication mechanism.
    Coming to question!
    1) How do I make my EBS integrate with a SAML provider preferably (Oracle Identity Federation) ?
    2) How do i get the SAML token in my PL/SQL and pass it on to the web service?
    Regards
    Dharmvir

    user1983888 wrote:
    Hi ,
    We have Oracle EBS R12 (12.1.2) with Oracle Database 11gR2 (11.2.0.2) Database on Linux env.
    We want to implement Oracle Database Vault 11gR2. We are referring to Note: Integrating Oracle E-Business Suite Release 12 with Oracle Database Vault 11gR2 [ID 1091083.1].
    Do we need to install Oracle Database 11gR2 (s/w only) again on the Oracle Database Server or can we use the existing Oracle EBS Database 11gR2 Home which is already on 11.2?
    Regards,
    ThiruAs mentioned in the doc "If your E-Business Suite R12 is already integrated with 11gR2 database, you just need to enable Database Vault 11gR2 & register it with the database as per Task 3", so no installation of ORACLE_HOME is required and you just need to "Register Oracle Database Vault".
    Thanks,
    Hussein

  • How to align text in margin with text in document

    I am using InDesign CS3 and am trying to figure out how to add text to the left of my document where there are figures and tables (so I can later create a table of figures and table of tables). I cannot get the text "Figure 1", "Figure 2", etc. to line up horizontally in the left margin with the figure I placed in the center of the document. What am I doing wrong?

    > What am I doing wrong?
    It's hard to say what you're doing wrong without first knowing what
    you're doing. How are you trying to line up text with figures? In what
    way does it not work?
    Kenneth Benson
    Pegasus Type, Inc.
    www.pegtype.com

  • How to associate a test message with a change document

    I am using solution manager 7.01.
    accessing my change documents through the workcenter I need to create a new test message - so I use the Create transaction button on the button bar, Service Process, Test Message
    Then I am in the create test message screen.  However from here I cannot see how to associate my test message with either the change document that I was processing or to the maintenance cycle.
    Ideally I want to link the test message to the change document however at least to the maintenance cycle.
    How do I do this?
    Am I creating the test message in an incorrect way?
    regards
    Marina

    Anyone?  Does no one use Test Messages?

  • How can I open a link to an xml document with a specific helper application?

    I have an html file with links to multiple xml files. When I click on one of these links, I would like Firefox to use an application of my choosing (e.g., Xmetal) to open the xml file. It works great with sgml files, because I was able to associate the "sgml" content with my external application. I can't seem to make the same thing happen for xml files, though.

    Many people on this thread have a common problem, how to download documents that have a .XML extension and then be able to view/edit them in Word. The issue is that Firefox does not treat a file it receives with a .XML extension as a download candidate, it just displays the XML in a tree structure in a popup window or a new tab. If there was an option to automatically (by configuration) open a .XML file in Word or even if it was a manual select option, that would solve the problem. Today you have to go through the process of saving the page, then when the popup down window indicates is completed, you use the right mouse to select open, when then takes you to Word (assuming Word is configured in your OS to process .XML files. This process is difficult to teach to non technical people because it error prone. Any help would be greatly appreciated.

Maybe you are looking for

  • Date Range Selection

    Dear friends, How to select the record from BSEG table between Date range. Please give me the solution . Am also try to find the solution in SDN also. select-options post_dt for bkpf-budat obligatory default sy-datum NO-EXTENSION. select belnr budat

  • Can you manually advance a Captivate slide presentation with a remote control and a projector.

    I have published a large volument of PowerPoint presentations with Captivate 5.0 and intend to distribute the presentations to live instructors as a means to control content delivered live by instructors to the students.  The files are aggregrated in

  • Not able to select Adapter engine with adapter configuration

    Hello, We've just installed new XI system (PI 7.0 SP7). When we want to configure an comm. channel adapter running on the central adapter (eg. RFC_adapter)engine. In the dropdown bo for the Adapter Engine No entry is available for selection. When loo

  • 3rd & 4th monitors for fcp setup using an Imac?

    I'd be quite interested to hear about other users who have managed to configure their workstation with 3 or 4 monitors using an Imac (or any mac that doesn't have expansion slots) What additional hardware you have considered and/or purchased. What so

  • What kind of email services does the iPad Supports

    I want to know which services are supported and some examples please, because I am interested in purchasing but need to know if covers my emailing needs for both personal and business, thanks