Sys.Xmltype.Createxml performance

Hello all,
I have these two functions,these functions are present in a package and this package is being called from .net code.There is a lot of performance issue with this code,It is taking 27 minutes for inserting 1000 rows,please help me fine tune this piece of code.And also there is a before insert trigger for the table XXXXXX
since we are using the concept of VPD here
There are close to 14000 rows to be inserted,please help.
Database version
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE     10.2.0.5.0     Production
TNS for Solaris: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
Procedure Some_Information(in_Some_Details In Clob, in_Batch_Id In Varchar2, in_Modified_User_Uid In Varchar2, in_Modified_Date In Varchar2, out_Status Out Varchar2, out_Error Out Varchar2)
As
Begin
Xml_Type:=Sys.Xmltype.Createxml(in_Some_Details);
Insert Into XXXXXX(I_Batch_Id,I_Client_Account_Id,V_Client_Legal_Name,
V_Old_Office_Code, V_Old_Office_Business_Name,V_New_Office_Code,V_New_Office_Business_Name,
V_Old_Cost_Center_Code,V_Old_Cost_Center_Name,V_New_Cost_Center_Code, V_New_Cost_Center_Name,
V_Client_Status,D_Client_Inactivation_Date,V_Select_Ynflag,
V_Replace_Ynflag,V_Replace_All_Policy_Ynflag,V_Replace_All_Service_Ynflag,
I_Created_By_Uid,I_Modified_By_Uid,
D_Created_Timestamp,D_Modified_Timestamp,
V_Batch_Status,D_Pol_Eff_Date_From,D_Pol_Eff_Date_To
(Select in_Batch_Id, A.CLIENT_ACCOUNT_ID, A.CLIENT_LEGAL_NAME, A.OLD_OFFICE_CODE, A.OLD_OFFICE_BUSINESS_NAME,
A.NEW_OFFICE_CODE, A.NEW_OFFICE_BUSINESS_NAME, A.OLD_COST_CENTER_CODE, A.OLD_COST_CENTER_NAME,
A.NEW_COST_CENTER_CODE, A.NEW_COST_CENTER_NAME, A.CLIENT_STATUS,
CASE
WHEN A.CLIENT_INACTIVATION_DATE =' ' THEN NULL
ELSE To_Date(A.CLIENT_INACTIVATION_DATE,'DD/MM/YYYY')
END ,
A.SELECT_FLAG, A.REPLACE_FLAG, A.REPLACE_ALL_POLICY_FLAG, A.REPLACE_ALL_SERVICE_FLAG,
in_Modified_User_Uid,in_Modified_User_Uid,
To_Date(in_Modified_Date,'yyyyMMddhh24miss'),To_Date(in_Modified_Date,'yyyyMMddhh24miss'),'A',
CASE
WHEN A.POL_EFF_DATE_FROM =' ' THEN NULL
ELSE To_Date(A.POL_EFF_DATE_FROM,'DD/MM/YYYY')
END ,
CASE
WHEN A.POL_EFF_DATE_TO =' ' THEN NULL
ELSE To_Date(A.POL_EFF_DATE_TO,'DD/MM/YYYY')
END
From (
SELECT
(CLIDETAIL.EXTRACT('//InformationSet/I_CLIENT_ACCOUNT_ID/text()').getstringval()) as CLIENT_ACCOUNT_ID,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_LEGAL_NAME/text()').getstringval()) as CLIENT_LEGAL_NAME,
(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_OFFICE_CODE/text()').getstringval()) as OLD_OFFICE_CODE,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_OFFICE_NAME/text()').getstringval()) as OLD_OFFICE_BUSINESS_NAME,
(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_OFFICE_CODE/text()').getstringval()) as NEW_OFFICE_CODE,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_OFFICE_NAME/text()').getstringval()) as NEW_OFFICE_BUSINESS_NAME,
(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_COSTCENTER_CODE/text()').getstringval()) as OLD_COST_CENTER_CODE,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_OLD_COSTCENTER_NAME/text()').getstringval()) as OLD_COST_CENTER_NAME,
(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_COSTCENTER_CODE/text()').getstringval()) as NEW_COST_CENTER_CODE,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_NEW_COSTCENTER_NAME/text()').getstringval()) as NEW_COST_CENTER_NAME,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_STATUS/text()').getstringval()) as CLIENT_STATUS,
(CLIDETAIL.EXTRACT('//InformationSet/V_CLIENT_INACTIVATION_DATE/text()').getstringval()) as CLIENT_INACTIVATION_DATE,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_SELECT_FLAG/text()').getstringval()) as SELECT_FLAG,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_FLAG/text()').getstringval()) as REPLACE_FLAG,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_ALL_POLICY_FLAG/text()').getstringval()) as REPLACE_ALL_POLICY_FLAG,
Escape_Chars(CLIDETAIL.EXTRACT('//InformationSet/V_REPLACE_ALL_SERVICE_FLAG/text()').getstringval()) as REPLACE_ALL_SERVICE_FLAG,
(CLIDETAIL.EXTRACT('//InformationSet/V_POL_EFF_DATE_FROM/text()').getstringval()) as POL_EFF_DATE_FROM,
(CLIDETAIL.EXTRACT('//InformationSet/V_POL_EFF_DATE_TO/text()').getstringval()) as POL_EFF_DATE_TO
FROM TABLE(XMLSEQUENCE(Xml_Type.EXTRACT('//NewDataSet/InformationSet')))CLIDETAIL
) A
Where Not Exists (Select 1 From XXXXX1 M Where M.I_Batch_Id=in_Batch_Id And M.I_Client_Account_Id=A.Client_Account_Id)
out_Status:='0';
out_Error:='No Error 2';
dbms_output.put_line(out_Status);
EXCEPTION WHEN OTHERS THEN
out_Status:='100';
out_Error:= SQLERRM;
End;
Function Escape_Chars(in_Details Varchar2) Return Varchar2 Is
Begin
If Replace(Replace(Replace(Replace(Replace(Trim(in_Details),
''||'&'||' amp;',''||'&'||''),
''||'&'||' quot;','"'),
''||'&'||' lt;','<'),
''||'&'||' gt;','>'),
''||'&'||' apos;',''''
) = '' Then
Return Null;
Else
Return Replace(Replace(Replace(Replace(Replace(Trim(in_Details),
''||'&'||'amp;',''||'&'||''),
''||'&'||'quot;','"'),
''||'&'||'lt;','<'),
''||'&'||'gt;','>'),
''||'&'||'apos;',''''
End If;
End;

Hello Marco,
I am a novice in Oracle with xml,please help me out with the following question listed in the points below
1) re-write the whole
From (
SELECT (CLIDETAIL.EXTRACT('//InformationSet/I_CLIENT_ACCOUNT_ID/text()').getstringval()) as CLIENT_ACCOUNT_ID,
Escape
bit to 1 XMLTABLE statement, if not only you will be easily see issues and/or get rid of all the clutter via "extract"
Point 1 I am exploring it,since I do not know anything about XMLTABLE.
2) Use the full XPath path in this statement - do not use // everywhere in the statement (this alone will be drastically improve your performance).
I have made the change mentioned in point 2 except for this section in the previous post,please let me know if i have to make the change here also,
FROM TABLE(XMLSEQUENCE(Xml_Type.EXTRACT('//NewDataSet/InformationSet')))
My Xml will be of the format
<NewDataSet>
<InformationSet>
<I_CLIENT_ACCOUNT_ID>Some value</I_CLIENT_ACCOUNT_ID>
</NewDataSet>
</InformationSet>
3) Do not use the OO notation. eg. "user.table.xmltype.extract.operator" but the supported notation, eg. "extract(user.table.xmltype, '$XPath', '$namspce').operator"
Point 3 I have made the changes
4) Do not use XML/SQL operators anymore, they will be deprecated/desupported in future versions (11, 12, xx). Use the offcial W3 XML standards, in the case XQuery alternatives like XMLTABLE. If not only they do already support XPath V2 while the XML/SQL stuff only supports XPath V1.
Point 4 can you please elaborate on XML/SQL operators that I am using in my code,so sorry this is dumb but still.
5) escape handling can also be done by a by Oracle supported function in package DBMS_XMLGEN (convert? and other procedures/functions), why write your own (would something like a regular expression comparison etc not be easier instead of replace(replace(replace...)
Thank you very much,I have handled the point 5 by using the DBMS_XMLGEN.convert

Similar Messages

  • Sys.XMLType.createxml  unable to insert in 9i through sqlplus

    I am trying to insert xmltype (sys.XMLType.createxml()) data through sqlplus in oracle.
    i am getting error as literal string too long.
    setting long as 1000000
    i am able to read and display the contents.
    But still NOT able to INSERT. The data is around 47784 charaters.
    any clues or any useful links.
    the query that i am using
    insert into sometable values("",sys.XMLType.createxml('string of around 48000 chars'));
    error that i recieve
    ORA-01704: string literal too long

    I am trying to insert xmltype (sys.XMLType.createxml()) data through sqlplus in oracle.
    i am getting error as literal string too long.
    setting long as 1000000
    i am able to read and display the contents.
    But still NOT able to INSERT. The data is around 47784 charaters.
    any clues or any useful links.
    the query that i am using
    insert into sometable values("",sys.XMLType.createxml('string of around 48000 chars'));
    error that i recieve
    ORA-01704: string literal too long

  • Sys.XMLType.createxml unable to insert through sqlplus

    I am trying to insert xmltype (sys.XMLType.createxml()) data through sqlplus in oracle.
    i am getting error as literal string too long.
    setting long as 1000000
    i am able to read and display the contents.
    But still NOT able to INSERT. The data is around 47784 charaters.
    any clues or any useful links.
    the query that i am using
    insert into sometable values("",sys.XMLType.createxml('string of around 48000 chars'));
    error that i recieve
    ORA-01704: string literal too long

    Actually the limit is approx 32K bytes for a SQL*PLUS literal...
    If your XML is schema based 9iR2 allows you to upload the XML direct to the database and store in tables you define using FTP or WebDAV.
    If the content is not schema based and you can ftp the file to the local file system of the machine running the server you can do something like this using the bfile mechanism.
    Note this is a 9iR2 example, that takes care of converting the character set of the file into the character set of the database...
    set echo on
    create or replace function getContent(file bfile,
                              charset varchar2 default 'WE8MSWIN1252'
    return CLOB deterministic
    is
      charContent     CLOB;
      targetFile      bfile;
      dest_offset     number :=  1;
      src_offset      number := 1;
      lang_context    number := 0;
      conv_warning    number := 0;
      begin
        targetFile := file;
        DBMS_LOB.createTemporary(charContent,true,DBMS_LOB.SESSION);
        DBMS_LOB.fileopen(targetFile, DBMS_LOB.file_readonly);
        DBMS_LOB.loadClobfromFile
           charContent,
           targetFile,
           DBMS_LOB.getLength(targetFile),
           dest_offset,
           src_offset,
           nls_charset_id(charset),
           lang_context,
           conv_warning
        DBMS_LOB.fileclose(targetFile);
        return charContent;
    end;
    show errors
    create or replace function getFileContent(file bfile,
                               charset varchar2 default 'WE8MSWIN1252'
    return CLOB deterministic
    is
    begin
        return getContent(file,charset);
    end;
    show errors
    create or replace function getDocument(filename varchar2,
                               charset varchar2 default 'WE8MSWIN1252'
    return CLOB deterministic
    is
       file            bfile := bfilename('DIR',filename);
    begin
      return getFileContent(file,charset);
    end;
    show errors
    create or replace function getXML(filename varchar2,
                          charset varchar2 default 'WE8MSWIN1252'
    return XMLTYPE deterministic
    is
      DOC clob;
      XML xmltype;
    begin
      DOC := getDocument(filename,charset);
      XML := xmltype(DOC);
      dbms_lob.freeTemporary(DOC);
      return XML;
    end;
    show errors
    drop directory DIR
    create directory DIR as '/tmp/xmlDir'
    commit
    insert into some table values ("",getXML('Filename.xml'));The above example assumes that the file in the directory '/tmp/xmlDir';

  • ORA-21700 error using sys.xmlType in Oracle 9.2

    I'm working on an application which uses the XMLType column in some of its database tables. When we started, we were using Oracle 9.0.1, and this test code works (which emulates how we have to, in some occasions, populate the XMLType column).
    However, we installed Oracle 9.2.0.3 on the same machine and created database instances using this version of Oracle. We didn't upgrade the original 9.0.1 installation (which still exists side-by-side). When we run this code, we get the following exception...
    java.sql.SQLException: ORA-21700: object does not exist or is marked for delete
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1451)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:862)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1846)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1771)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2361)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:422)
    at com.edh.oracle.TransactionTester.testClob(TransactionTester.java:134)
    at com.edh.oracle.TransactionTester.main(TransactionTester.java:251)
    This exception occurs after we've written the data to a Clob and are attempting to call createXML to update the column.
    Is there anything additional I need to do to get this working in Oracle 9.2 again? Thanks.
    Code is:
    * TransactionTester.java
    * Created on 11 October 2002, 14:08
    package com.edh.oracle;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    * @author ehillman
    public class TransactionTester {
    private static String ORACLE_URL = "jdbc:oracle:thin:@wallaby:7012:CT2";
    /** Creates a new instance of TransactionTester */
    public TransactionTester() throws SQLException {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    private void createTables(Connection conn) throws SQLException {
    String createText = "create table SillyData (XML_VALUE XMLTYPE, XML_STORAGE CLOB)";
    Statement stmt = conn.createStatement();
    stmt.execute(createText);
    System.out.println("Tables created");
    private void dropTables(Connection conn) throws SQLException {
    String dropText = "drop table SillyData ";
    Statement stmt = conn.createStatement();
    stmt.execute(dropText);
    System.out.println("Tables dropped");
    private void testClob() throws SQLException, java.io.FileNotFoundException,
    java.io.IOException {
    System.out.println("testClob - START");
    Connection conn = DriverManager.getConnection(ORACLE_URL,
    "ehillman", "ehillman");
    System.out.println("connection received");
    createTables(conn);
    try {
    System.out.println("Loading MyFn.xml");
    java.io.FileReader inputReader = new java.io.FileReader(
    "C:\\Documents and Settings\\ehillman\\.netbeans\\edh test\\oracle jdbc\\com\\edh\\oracle\\MyFn.xml");
    conn.setAutoCommit(false);
    Statement stmt2 = conn.createStatement();
    stmt2.execute("insert into SillyData (XML_STORAGE) values (EMPTY_CLOB())");
    System.out.println("empty row inserted");
    stmt2 = conn.createStatement();
    ResultSet rs = stmt2.executeQuery("select XML_STORAGE from SillyData for update");
    System.out.println("Empty CLOB retireved");
    rs.next();
    java.sql.Clob clobValue = rs.getClob(1);
    oracle.sql.CLOB oraClob = (oracle.sql.CLOB) clobValue;
    System.out.println("casted");
    java.io.Writer writer = oraClob.getCharacterOutputStream();
    char[] buffer = new char[ oraClob.getChunkSize() ];
    for (int charsRead = inputReader.read(buffer); charsRead > -1; charsRead = inputReader.read(buffer)) {
    writer.write(buffer, 0, charsRead);
    writer.close();
    System.out.println("data written to Clob");
    PreparedStatement pState = conn.prepareStatement(
    "update SillyData set XML_VALUE = sys.XMLType.createXML(?)");
    pState.setClob(1, clobValue);
    int result = pState.executeUpdate();
    System.out.println("executeQuery returned " + result);
    } finally {
    dropTables(conn);
    conn.close();
    System.out.println("connection closed");
    System.out.println("testClob - END");
    * @param args the command line arguments
    public static void main(String[] args) {
    try {
    TransactionTester tst = new TransactionTester();
    tst.testClob();
    } catch (Exception ex) {
    ex.printStackTrace();

    I've found this....
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96620/xdb05obj.htm#1032058
    Does this mean that, for a table to use an XMLType column, it has to have a single schema definition for every row in the table?
    This won't fit for what we're doing.... that is, our table stores XML data for each row, but they are all different types of XML... they don't have the same structure,they don't use the same schema.
    Please let me know if I'm missing something

  • Xmltype.createxml not working after upgrading to 11202 from 10203

    Hi,
    i was referred here from Java Database Connectivity (JDBC) forum. the link to the original post:
    using XML with websphere jdbc adapter 2.6 on 11.2.0.2
    again, the adapter is using the function xmltype.createxml (and there it uses xmltype_lib) and it fails right at the beginning because it cannot parse the xml properly.
    so what im asking is, was there any major changes from 10.2 to 11.2 to the way xml creation works? maybe a different encoding? how can i check the encoding of the xml created? is there a property for it?
    thanks in advance.
    Edited by: andrey on Mar 12, 2012 4:47 AM

    yes the client and the server are same version.
    the error stack from the adapter:
    [Time: 2012/03/13 13:00:00.177] [system: ConnectorAgent] [SS: jdbc_orclConnector] [Thread: JDBC_ORCL.REQUECTQUEUEJmsThreadPool.thread18(#746207754)] [Type:error] [MsgID: 10556] [Mesg: Exception Detail: com.crossworlds.cwconnectorapi.exceptions.VerbProcessingFailedException
    [Type: Error] [MsgID:37010] [Mesg: Stored Procedure Execution Failed: java.SQLException: [IBM-CrossWorlds][Oracle JDBC Driver][Oracle]
    ora-30676: socket read or write failed
    ora-06512: at "SYS.XMLTYPE", line 5
    ora-06512: at "SCHEMA_NAME.FUNC_NAME", line 1695
    ora-06512: at "SCHEMA_NAME.FUNC_NAME", line 78
    ora-06512: at line 1

  • Want to insert a XSL file's data into a column of type SYS.XMLTYPE??

    Hello Friends
    I want to insert a XSL file's data into a column of a table of type SYS.XMLTYPE. Following is the XSL which i want to add into a table please help in.....
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
         xmlns:fn="http://www.w3.org/2005/xpath-functions">
         <xsl:output method="html" encoding="UTF-8" />
         <xsl:template match="clinical_study">
         <xsl:variable name="status">
              <xsl:apply-templates select='overall_status' />
         </xsl:variable>
    <html>
    <head>
    <title>Summary</title>
    <link href="merckcancer.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
         <div id="trialtop" class="trialtop">
              <div id="trialtophead" class="trialtophead">
                   <H1>Summary</H1>
              </div>
    <!-- start of trial body-->
         <div id="trialmiddle" class="trialmiddle">
                             <span class="trialtitle1"><xsl:apply-templates select='brief_title'/></span>
                   <span class="tealbold">Official Title: </span><xsl:apply-templates select='official_title' />
                   <span class="tealbold" title="ClinicalTrials.gov Identifier">NCT Id: </span><xsl:apply-templates select='//nct_id'/>
    <span class="tealbold">Conditions: </span><xsl:for-each select="//condition[position()!=last()]"><xsl:value-of select="normalize-space(.)" /><xsl:text>, </xsl:text></xsl:for-each>
    <xsl:for-each select="//condition[position()=last()]"><xsl:value-of select="normalize-space(.)" /></xsl:for-each>
    <span class="tealbold">Phase: </span><xsl:apply-templates select='phase' />
    <span class="tealbold">Status: </span><xsl:value-of select="$status" />
    <span class="tealbold">Interventions: </span><xsl:for-each select="//intervention[position()!=last()]"><xsl:value-of select="normalize-space(intervention_type)" />: <xsl:value-of select="normalize-space(intervention_name)" /><xsl:text>, </xsl:text></xsl:for-each><xsl:for-each select="//intervention[position()=last()]"><xsl:value-of select="normalize-space(intervention_type)" />: <xsl:value-of select="normalize-space(intervention_name)" /></xsl:for-each>
    <xsl:apply-templates select='eligibility'><xsl:with-param name="type">short</xsl:with-param></xsl:apply-templates>
    </div><!-- end of middle -->
    </div><!-- end of top-->                         
    <div id="detail" class="detail">
         <div id="detailtophead" class="detailtophead">
              <H1>Details</H1>
         </div>
    <!-- end of detailtop-->
    <!-- start of detail body-->
    <div id="detailmiddle" class="detailmiddle">
    <span class="trialtitle2">Trial Description:</span>
         <span class="trialtitle4"><xsl:apply-templates select='brief_summary/textblock' /></span>
         <span class="trialtitle1">Eligibility: </span>
              <xsl:apply-templates select='eligibility'><xsl:with-param name="type">long</xsl:with-param></xsl:apply-templates>
    </div><!--end of detail middle-->
    </div><!-- end of detail top-->
    <div id="enroll" class="enroll">
    <div id="enrolltophead" class="enrolltophead">
    <H1>Enrollment</H1>
    </div>
    <!-- end of enroll top head-->
    <!-- start of enroll body-->
    <div id="enrollmiddle" class="enrollmiddle">
    <xsl:choose>
                                       <xsl:when test="$status = 'Recruiting'">
         This study has participating centers in a number of locations.
         To take the next step in learning more about participating in this clinical study please call one of these trial contacts.<p/>
         The trial contacts will know this study as <span class="tealbold"><xsl:apply-templates select='//org_study_id'/></span>
         or may know the study under the ClinicalTrials.gov identifier <span class="tealbold"><xsl:apply-templates select='//nct_id'/></span>.<p/>
         <p/>
                                       <xsl:apply-templates select='overall_contact'/>
                                       <xsl:for-each select="location">
                                            <xsl:call-template name='location'/><p/>
                                       </xsl:for-each>
                                       </xsl:when>
                                       <xsl:otherwise>
         This study is not currently Recruiting, it is <xsl:value-of select="$status" />.
                                       </xsl:otherwise>
                                       </xsl:choose>
    </div><!--end of enroll middle-->
    </div><!-- end of enroll -->
    <div id="credit" class="credit">
    <div id="credittophead" class="credittophead">
    <H1>Credits</H1>
    </div>
    <!-- end of credit top head-->
    <!-- start of credit body-->
    <div id="creditmiddle" class="creditmiddle">
                                  Information about this trial has been gathered from ClinicalTrials.gov. Please see
                                  <a>
                                       <xsl:attribute name="href" >
                                            /ctcpub/redirect.jsp?redirectURL=http://ClinicalTrials.gov
                                       </xsl:attribute>
                                       ClinicalTrials.gov
                                  </a> for more complete information.<p/>
                                  <xsl:apply-templates select='required_header/download_date'/><p/>
                                  <a>
                                       <xsl:attribute name="href" >
                                            /ctcpub/redirect.jsp?redirectURL=<xsl:apply-templates select='required_header/url'/>
                                       </xsl:attribute>
                                       <xsl:apply-templates select='required_header/link_text'/>
                                  </a> <p/>
                                  This trial data was last updated on <xsl:apply-templates select='//lastchanged_date'/><p/>
    </div><!--end of credit body-->
    </div><!--end of credit-->
    </body>
    </html>
    </xsl:template>
    <xsl:template match="brief_title">
              <span class="trialtitle"><xsl:value-of select="normalize-space(.)" /></span>
         </xsl:template>
         <xsl:template match="official_title">
              <span class="tealbold">Official Title: </span>     <xsl:value-of select="normalize-space(.)" />
         </xsl:template>
         <xsl:template match="phase">
              <span class="tealbold">Phase: </span> <xsl:value-of select="normalize-space(.)" />
         </xsl:template>
         <xsl:template match="overall_status">
              <xsl:value-of select="normalize-space(.)" />
         </xsl:template>
         <xsl:template match="eligibility">
              <xsl:param name="type" />
              <xsl:choose>
                   <xsl:when test="$type = 'short'">
                        <span class="tealbold">Eligibility: </span> <xsl:call-template name="ages">
                             <xsl:with-param name="min"><xsl:value-of select="normalize-space(minimum_age)" /></xsl:with-param>
                             <xsl:with-param name="max"><xsl:value-of select="normalize-space(maximum_age)" /></xsl:with-param>
                        </xsl:call-template>, <xsl:apply-templates select='gender' />
                   </xsl:when>
                   <xsl:when test="$type = 'long'">
                        <span class="trialtitle">Eligibility: </span>
                             <span class="tealbold">Age: </span> <xsl:call-template name="ages">
                                       <xsl:with-param name="min"><xsl:value-of select="normalize-space(minimum_age)" /></xsl:with-param>
                                       <xsl:with-param name="max"><xsl:value-of select="normalize-space(maximum_age)" /></xsl:with-param>
                                  </xsl:call-template>
                             <span class="tealbold">Genders Eligible for Study: </span> <xsl:apply-templates select='gender' />
                             <xsl:text>
                             </xsl:text>
                             <span class="tealbold">Eligibility Criteria: </span>
    <xsl:apply-templates select='criteria/textblock' />
                   </xsl:when>
                   <xsl:otherwise></xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <xsl:template match="gender">
              <xsl:choose>
                   <xsl:when test=". = 'Both'">Male or Female</xsl:when>
                   <xsl:otherwise>
                        <xsl:value-of select="normalize-space(.)" />
                   </xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <xsl:template match="overall_contact">
         <span class="trialtitle">Central Contact: </span>
              <xsl:apply-templates select='./first_name' /><xsl:text> </xsl:text>
              <xsl:apply-templates select='./middle_name' /><xsl:text> </xsl:text>
              <xsl:apply-templates select='./last_name' />
              <xsl:apply-templates select='./phone' />
              <xsl:apply-templates select='./email' />
         </xsl:template>
         <xsl:template name="ages">
              <xsl:param name="min" />
              <xsl:param name="max" />
              <xsl:choose>
                   <xsl:when test="($min != '') and ($max != '')">Between <xsl:value-of select="$min" /> and <xsl:value-of select="$max" /></xsl:when>
                   <xsl:when test="($min != '') and ($max = '')"><xsl:value-of select="$min" /> and Above</xsl:when>
                   <xsl:when test="($min = '') and ($max != '')">Under <xsl:value-of select="$max" /></xsl:when>
                   <xsl:otherwise></xsl:otherwise>
              </xsl:choose>
         </xsl:template>
         <xsl:template match="brief_summary/textblock">
              <span class="trialtitle">Trial Description: </span> <xsl:call-template name="substitute">
    <xsl:with-param name="string" select="." />
    </xsl:call-template>
         </xsl:template>
         <xsl:template name="location">
              <span class="trialtitle"><xsl:apply-templates select='.//country' /><xsl:apply-templates select='.//state' /></span>
              <xsl:apply-templates select='./facility/name' /><xsl:apply-templates select='.//city' /><xsl:apply-templates select='.//zip' /><xsl:apply-templates select='.//status' />
              <xsl:apply-templates select='./contact' />
         </xsl:template>
         <xsl:template match="contact">
              <span class="tealbold">Site Contact: </span>
              <xsl:apply-templates select='first_name' />
              <xsl:apply-templates select='middle_name' />
              <xsl:apply-templates select='last_name' />
              <xsl:apply-templates select='phone' />
              <xsl:apply-templates select='email' />
         </xsl:template>
         <xsl:template match="criteria/textblock">
              <xsl:call-template name="substitute">
         <xsl:with-param name="string" select="." />
         </xsl:call-template>     
    </xsl:template>     
         <xsl:template match="facility/name"><xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="country"><xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="city">, <xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="zip">, <xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="state">, <xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="status">, <xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="first_name"><xsl:value-of select="normalize-space(.)" />&#160;</xsl:template>     
         <xsl:template match="middle_name"><xsl:value-of select="normalize-space(.)" />&#160;</xsl:template>     
         <xsl:template match="last_name"><xsl:value-of select="normalize-space(.)" /></xsl:template>     
         <xsl:template match="phone">Phone: <xsl:value-of select="normalize-space(.)" />
    </xsl:template>     
         <xsl:template match="email"><xsl:if test='. != ""'>EMail: <xsl:value-of select="normalize-space(.)" />
    </xsl:if></xsl:template>     
    <xsl:template name="substitute">
    <xsl:param name="string" />
    <xsl:param name="from" select="'&#xA;'" />
    <xsl:param name="to">
    </xsl:param>
    <xsl:choose>
    <xsl:when test="contains($string, $from)">
    <xsl:value-of select="substring-before($string, $from)" />
    <xsl:copy-of select="$to" />
    <xsl:call-template name="substitute">
    <xsl:with-param name="string"
    select="substring-after($string, $from)" />
    <xsl:with-param name="from" select="$from" />
    <xsl:with-param name="to" select="$to" />
    </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$string" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>
    </xsl:stylesheet>
    Please do as early as possible..
    thanks in advance

    Hi I tried with below querry but iam getting an error message?
    SQL> Insert into temp_clob_tab
    2 SELECT XMLELEMENT("soap:Envelope",
    3 XMLATTRIBUTES ('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi",
    4 'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd",
    5 'http://schemas.xmlsoap.org/soap/envelope/' as "xmlns:soap"),
    6 XMLELEMENT("soap:Body"),XMLELEMENT("AddListing",
    7 XMLATTRIBUTES ('http://www.christielites.com' as "xmlns" )),
    8 XMLELEMENT ( "SCOMCODE",a.SCOMCODE), XMLELEMENT ( "SLOCCODE",SLOCCODE),
    9 XMLELEMENT ( "DSTART",DSTART),XMLELEMENT ( "DEND",DEND),XMLELEMENT ( "SECODE",SECODE),
    10 XMLELEMENT ( "IAVAIL",IAVAIL),XMLELEMENT ("IOWNED",IOWNED),XMLELEMENT ("SPOSTTRANS",SPOSTTRANS))
    11 from LiteExchangeAvailablity a;
    SELECT XMLELEMENT("soap:Envelope",
    ERROR at line 2:
    ORA-00932: inconsistent datatypes: expected CLOB got -

  • Conversion/Type Cast of sys.XMLType to NUMBER and VARCHAR2

    How do we typecast or convert a variable of the type sys.XMLType to NUMBER and VARCHAR2?
    For e.g. I have a variable :-
    v_STATE sys.XMLType
    I want to convert it to either of the type NUMBER or VARCHAR2.

    How do we typecast or convert a variable of the type sys.XMLType to NUMBER and VARCHAR2?
    Your question is too vague to give a relevant answer.
    Typecasting doesn't make sense in this situation, XMLType is an opaque datatype, it's not like converting VARCHAR2 to NUMBER (or vice versa).
    Do you mean serializing the XML document, or extracting atomic node values, or something else ?
    Depending on your requirement, you may want to look for XMLSerialize() or XMLCast() functions.
    And on a side note, don't always expect people to search for your previous threads to find some useful information, such as a db version...

  • Importing XML data into sys.XMLType  - encoding problem

    Hi,
    I'm using "modplsql Gateway" to upload XML file with encoding "windows-1250" with some regional characters in database table.
    The table definition:
    CREATE TABLE NAHRAJ_DATA (
    NAME VARCHAR(128) UNIQUE NOT NULL,
    MIME_TYPE VARCHAR(128),
    DOC_SIZE NUMBER,
    DAD_CHARSET VARCHAR(128),
    LAST_UPDATED DATE,
    CONTENT_TYPE VARCHAR(128),
    CONTENT LONG RAW,
    BLOB_CONTENT BLOB
    The file was uploaded correct.
    My database have
    NLS_CHARACTERSET EE8MSWIN1250
    NLS_NCHAR_CHARACTERSET AL16UTF16
    After upload, I convert data from hex(blob) to dec and with function chr() to char. BLOB -> CLOB.
    Next I create sys.XMLType from CLOB. With this progression works all in order.
    In other system where are
    NLS_CHARACTERSET AL32UTF8
    NLS_NCHAR_CHARACTERSET AL16UTF16
    BLOB_CONTENT column(table NAHRAJ_DATA) starts with "FF FE FF FE" in HEX before my XML data. Exactly convert is OK, bud if I can create sys.XMLType I get this
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing
    LPX-00200: could not convert from encoding UTF-8 to UCS2 Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    I haven't any idea what's wrong.
    Whats mean the HEX code in BLOB_CONTENT column after upload?
    Thangs
    Lukas

    Please post your question in XMLDB forum

  • Importing XML data into sys.XMLType

    Hi,
    I'm using "modplsql Gateway" to upload XML file with encoding "windows-1250" with some regional characters in database table.
    The table definition:
    CREATE TABLE NAHRAJ_DATA (
    NAME VARCHAR(128) UNIQUE NOT NULL,
    MIME_TYPE VARCHAR(128),
    DOC_SIZE NUMBER,
    DAD_CHARSET VARCHAR(128),
    LAST_UPDATED DATE,
    CONTENT_TYPE VARCHAR(128),
    CONTENT LONG RAW,
    BLOB_CONTENT BLOB
    The file was uploaded correct.
    My database have
    NLS_CHARACTERSET EE8MSWIN1250
    NLS_NCHAR_CHARACTERSET AL16UTF16
    After upload, I convert data from hex(blob) to dec and with function chr() to char. BLOB -> CLOB.
    Next I create sys.XMLType from CLOB. With this progression works all in order.
    In other system where are
    NLS_CHARACTERSET AL32UTF8
    NLS_NCHAR_CHARACTERSET AL16UTF16
    BLOB_CONTENT column(table NAHRAJ_DATA) starts with "FF FE FF FE" in HEX before my XML data. Exactly convert is OK, bud if I can create sys.XMLType I get this
    ORA-31011: XML parsing failed ORA-19202: Error occurred in XML processing
    LPX-00200: could not convert from encoding UTF-8 to UCS2 Error at line 1
    ORA-06512: at "SYS.XMLTYPE", line 0
    ORA-06512: at line 1
    I haven't any idea what's wrong.
    Whats mean the HEX code in BLOB_CONTENT column after upload?
    Thangs
    Lukas

    Please post your question in XMLDB forum

  • Validating XML with XMLType.CreateXML and a schema

    I created a schema with:
    dbms_xmlschema.registerSchema('com/company/user/project/forexample.xsd', xsd_as_clob);
    This works fine and I can see the elements of my schema in the enterprise manager.
    However when I try to use this schema with:
    xmltype_variable := XMLType.CreateXML(xml_as_clob, 'com/company/user/project/forexample.xsd', 0, 0);
    I get the following message:
    ORA-31000: Resource 'com/company/user/project/forexample.xsd' is not an XDB schema document.
    What am I doing wrong?
    I have 9.2.0.1.0 running on Windows 2000.

    your path looks wrong to me 'com/company/...' should really be something like '/com/company/...' since I take it that your com folder is really under the Resources top level folder. /com is an absolute path com is a relative path and it is difficult to know your current context so a relative path could be pointing to anything!

  • Xdb.jar and ojdbc14.jar incompatibility ( XMLType.createXML() ) ??

    I am using the latest xdb.jar (from xdk_java_9_2_0_5_0.zip) and ojdbc14.jar
    and it appears that xdb.jar calls a method that does not exist in ojdbc14.jar.
    It happens when executing
    OPAQUE opaque = rset.getOPAQUE("value");
    XMLType xt = XMLType.createXML(opaque); // <-- here
    The exact error message is:
    java.lang.NoSuchMethodError: oracle.jdbc.internal.OracleConnection.getProtocolType()Ljava/lang/String;
         at oracle.xdb.XMLType.initConn(XMLType.java:2072)
         at oracle.xdb.XMLType.<init>(XMLType.java:903)
         at oracle.xdb.XMLType.createXML(XMLType.java:493)

    Hi,
    There are known problems with xdb.jat that is bundled with XDK 9205.
    As a workaround, you need to use an older version of xdb.jar from either XDK-9.2.0.3 or XDK-9.2.0.4 since the mentioned exception is generally thrown due to problems in xdb.jar that comes with XDK-9205.
    If you do not have any of these versions of XDK, you could use the xdb.jar that comes with the database 9.2.0.3. The xdb.jar is present in <oracle_home>/rdbms/jlib folder.
    Hope that helps.
    Shefali

  • How to use "sys.XMLTYPE.getClobVal( )"?

    Hi all
    Can any one explain me
    SELECT * FROM (
    SELECT
    A.CID CID,
    A.USERID USERID,
    A.SCORE SCORE,
    A.RESULT RESULT,
    A.ANNOTATION ANNO,
    SYS.XMLTYPE.GETCLOBVAL(A.XML) TRANSACTIONINFO,
    SYS.XMLTYPE.GETCLOBVAL(B.ATTRIB) CUSTOMERINFO,
    ROW_NUMBER() OVER (ORDER BY B.FRAUD_ID DESC) RN
    FROM
    GENERALFRAUDLOG A LEFT JOIN FRAUDCUSTOMERS B
    ON
    A.CID=B.CID
    WHERE A.FRAUDID=674003)
    WHERE RN=1
    How we can use this query exactly in Oracle Html Db
    Thanks&Regards
    Suresh

    wt suresh wt do u want cud u com my wsI think your vowel keys on your keyboard are a bit stuck. Time for a new keyboard perhaps?
    cud u com my wsAnd that part of it just sounds perverted. :o\

  • Forms 10g crashes on XMLType.createXML()

    Hello,
    I'm using Forms 10g services for calling a web service, I'm using standard soap request / respond function :
    function myfun() returns varchar2 is
      soap_request varchar2(30000);
      soap_respond varchar2(30000);
      http_req utl_http.req;
      http_resp utl_http.resp;
      resp XMLType;
    begin
    soap_request:='<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    http_req:= utl_http.begin_request (url, 'POST', 'HTTP/1.1');
    utl_http.set_header(http_req, 'Content-Type', 'text/xml');
    utl_http.set_header(http_req, 'Content-Length', length(soap_request));
    utl_http.set_header(http_req, 'SOAPAction','');
    utl_http.write_text(http_req, soap_request);
    http_resp:= utl_http.get_response(http_req);
    utl_http.read_text(http_resp, soap_respond);
    utl_http.end_response(http_resp);
    resp:= XMLType.createXML(soap_respond);
    resp:= resp.extract('/soap:Envelope/soap:Body/child::node()', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
    resp:=resp.extract('ns1:MyResponse/MyReturn/text()','xmlns:ns1="urn:wslice_vstv"');
    return resp.getClobVal();
    end;soap_respond looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:wslice_vstv" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <ns1:MyResponse>
    <MyReturn xsi:type="xsd:string">testno# testname# testname2# testname3# testname4# </MyReturn>
    </ns1:MyResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>Forms crashes on resp:= XMLType.createXML(soap_respond) with error:
    FRM-92101: There was a failure in the Forms Server during startup. This could happen due to invalid configuration.
    Please look into the web-server log file for details.
    Details...
    Java Exception:
    oracle.forms.net.ConnectionException: Forms session <92> abourted: unable to communicate with runtime process.
    at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
    at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
    at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
    at oracle.forms.net.HTTPNStream.flush(Unknown Source)
    at java.io.DataOutputStream.flush(Unknown Source)
    at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    Does anyone have any idea why this happens? There is no xmlparse error or something similar, just what I wrote above.
    Thanks,
    Jelena

    Hello,
    1.) You missed out important informations like database and forms versions
    2.) where did you write this? dbms_output.put_line will not display anything in forms (unless you get the lines you put on the buffer back with get_lines which is kind of useless in your case)
    3.) You might want to read all responses; here:
    Jelena Stankov wrote:
    "Forms is an old product and does not support all the new PL/SQL database types. If you can't see the datatype in the list displayed for 'Data Type' for a form's item then you most probably won't be able to use it in a form." (http://www.orafaq.com/forum/t/128146/2/)
    is the solution to your problem.
    4.) this
    cursor cursor_xml (p_id in varchar2)
      is select * from MY_TABLE where id=p_id for update;
      rec cursor_xml%rowtype;is a bad idea. using %rowtype and select * is a real bad coding practice and will lead to unexpected behaviour when you do changes to the underlying table. In fact why do you want to do this anyway? You take some informations out of your table, create an xmltype of it and put it back into the table? What happens when you do changes to your data? You will have to do this again (probably in a database trigger <sigh>)...
    Why not simply:
    SQL> select level, xmltype('<company>'||level||'</company>') from dual connect by level < 20;
         LEVEL|XMLTYPE('<COMPANY>'||LEVEL||'</COMPANY>')
    ----------|---------------------------------------------------------------------------------------------------------------
             1|<company>1</company>
             2|<company>2</company>
             3|<company>3</company>
             4|<company>4</company>
             5|<company>5</company>
             6|<company>6</company>
             7|<company>7</company>
             8|<company>8</company>
             9|<company>9</company>
            10|<company>10</company>
            11|<company>11</company>
            12|<company>12</company>
            13|<company>13</company>
            14|<company>14</company>
            15|<company>15</company>
            16|<company>16</company>
            17|<company>17</company>
            18|<company>18</company>
            19|<company>19</company>
    19 rows selected.create a view upon that end never bother again with updating your xmltype column?
    cheers

  • ORA-30625 sys.xmltype

    every time when I run function GET_PURCHASEORDER_VALUE Oracle rises error ora-30625 in line*. I work in Oracle release 9.0.1.3.0. what shuld I do? help me. please.
    create or replace function GET_PURCHASEORDER_VALUE(PURCHASEORDER in sys.XMLTYPE)
    return number is
    LINEITEMS sys.XMLTYPE;
    LINEITEM sys.XMLTYPE;
    COST number;
    QUANTITY number;
    TOTAL number := 0;
    I binary_integer := 1;
    begin
    LINEITEMS := PURCHASEORDER.extract('//LineItem'); *
    loop
    LINEITEM := LINEITEMS.extract('/LineItem['||I||']');
    exit when LINEITEM is null;
    COST := LINEITEM.extract('/LineItem/Part/@UnitPrice').getNumberVal();
    QUANTITY := LINEITEM.extract('/LineItem/Part/@Quantity').getNumberVal();
    TOTAL := TOTAL + (COST * QUANTITY );
    I := I + 1;
    end loop;
    return TOTAL;
    end GET_PURCHASEORDER_VALUE;
    ORA-30625 method dispatch on NULL SELF argument is disallowed

    9.1.0.3 has limited XPATH support. Can you upgrade to 9.2.0.2?
    Can you try extractValue instead of extract?

  • Ctxsys.context index creation :ORA-01031: insufficient privileges on sys.XMLType

    Hi,
    in the following enviroment:
    Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
    With the Partitioning option
    JServer Release 9.0.1.1.1 - Production
    On an MS 2K box
    I experience the following problem:
    if I create a table
    create table test(c type);
    where type is varchar2 o clob I then succesfully issue this
    command:
    create index test_ctx on test(c) indextype is ctxsys.context;
    but if type is sys.XMLType I get :
    ORA-01031: insufficient privileges.
    Any suggestion
    Thanks
    Alex

    Under user sys as sysdba the following happens:
    SQL> create table test(c XMLType);
    Table created.
    SQL> create index test_ctx on test(c) indextype is
    ctxsys.context;
    create index test_ctx on test(c) indextype is ctxsys.context
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE
    routine
    ORA-20000: Oracle Text error:
    DRG-50857: oracle error in drixtab.create_index_tables
    ORA-00955: name is already used by an existing object
    ORA-06512: at "CTXSYS.DRUE", line 157
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 176

Maybe you are looking for