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 -

Similar Messages

  • I am unable to insert the sql data into sharepoint column(with type "Person or Group") through SSIS package.

     can anyone suggest me how to insert values to sharepoint list column of datatype (person/group datatype).  Also, Does sharepoint list allows nulls as a value?
    please help.
    Thanks
    Raghavendra

    Hi Raghavendra,
    Based on my test, if we directly insert a column with people account or group name with domain\user or domain\group formats to a SharePoint list, those columns with the values would be ignored when executing the package. Other columns with Null value would
    be insert into the list. If we insert a column with numeric format, the values would change to corresponding user or group based on the site permissions in SharePoint site.
    So to fix this issue, I suggest we can select <ignore> maps to the “People or Group” column in SharePoint list. The “People or Group” column would show null value in SharePoint list. Then we can manually or use workflow feature add values in the “People
    or Group” column in SharePoint list.
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Accessing xsl file in data associations, placed in file based MDS  in BPM 12c

    Hello,
    There is one requirement that we have to access a transformation file(xsl) file in data associations,which is placed in SOA design time Repository (MDS). Please let us know how can we access it.
    Thanks in advance,
    Disha

    This URL should help you solve your problem.
    http://developer.java.sun.com/developer/qow/archive/76/index.html
    Have a nice day.
    nathan

  • I have a mac book pro  OS 10.6.8.  I want to insert a .dmg file into a file i've copied to the MAC.  How do I do it?

    I have a mac book pro  OS 10.6.8.  I want to insert a .dmg file into a file i've copied to the MAC.  How do I do it?  Thanks

    Apple said that customers can still purchase a copy of Snow Leopard or Lion from its online store's telesales agents: 1-800-MY-APPLE (1-800-692-7753) or Customer Service and Sales Support at 1-800-676-2775. For Lion you'll get a redemptions code via e-mail and need to DL from the Mac App Store (requires SL 10.6.6+).

  • Insert data 32K into a column of type LONG using the oracle server side jdbc driver

    Hi,
    I need to insert data of more than 32k into a
    column of type LONG.
    I use the following code:
    String s = "larger then 32K";
    PreparedStatement pstmt = dbcon.prepareStatement(
    "INSERT INTO TEST (LO) VALUES (?)");
    pstmt.setCharacterStream(1, new StringReader(s), s.length());
    pstmt.executeUpdate();
    dbcon.commit();
    If I use the "standard" oracle thin client driver from classes_12.zip ("jdbc:oracle:thin:@kn7:1521:kn7a") every thing is working fine. But if I use the oracle server side jdbc driver ("jdbc:default:connection:") I get the exception java.sql.SQLException:
    Datasize larger then max. datasize for this type: oracle.jdbc.kprb.KprbDBStatement@50f4f46c
    even if the string s exceeds a length of 32767 bytes.
    I'm afraid it has something to do with the 32K limitation in PL/SQL but in fact we do not use any PL/SQL code in this case.
    What can we do? Using LOB's is not an option because we have client software written in 3rd party 4gl language that is unable to handle LOB's.
    Any idea would be appreciated.
    Thomas Stiegler
    null

    In rdbms 8.1.7 "relnotes" folder, there is a "Readme_JDBC.txt" file (on win nt) stating
    Known Problems/Limitations In This Release
    <entries 1 through 3 omiited for brevity >
    4. The Server-side Internal Driver has the following limitation:
    - Data access for LONG and LONG RAW types is limited to 32K of
    data.

  • How to insert  data into BLOB column  using sql

    Hi all,
    How to insert data into BLOB column directly using sql .
    create  table temp
      a blob,
      b clob);
    SQL> /
    Insert into temp  values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
    ERROR at line 1:
    ORA-01465: invalid hex number
    Please help in this.Thanks,
    P Prakash

    see this
    How to store PDF file in BLOB column without using indirect datastore

  • Split flat file column data into multiple columns using ssis

    Hi All, I need one help in SSIS.
    I have a source file with column1, I want to split the column1 data into
    multiple columns when there is a semicolon(';') and there is no specific
    length between each semicolon,let say..
    Column1:
    John;Sam;Greg;David
    And at destination we have 4 columns let say D1,D2,D3,D4
    I want to map
    John -> D1
    Sam->D2
    Greg->D3
    David->D4
    Please I need it ASAP
    Thanks in Advance,
    RH
    sql

    Imports System
    Imports System.Data
    Imports System.Math
    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
    Imports System.IO
    Public Class ScriptMain
    Inherits UserComponent
    Private textReader As StreamReader
    Private exportedAddressFile As String
    Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
    Dim connMgr As IDTSConnectionManager90 = _
    Me.Connections.Connection
    exportedAddressFile = _
    CType(connMgr.AcquireConnection(Nothing), String)
    End Sub
    Public Overrides Sub PreExecute()
    MyBase.PreExecute()
    textReader = New StreamReader(exportedAddressFile)
    End Sub
    Public Overrides Sub CreateNewOutputRows()
    Dim nextLine As String
    Dim columns As String()
    Dim cols As String()
    Dim delimiters As Char()
    delimiters = ",".ToCharArray
    nextLine = textReader.ReadLine
    Do While nextLine IsNot Nothing
    columns = nextLine.Split(delimiters)
    With Output0Buffer
    cols = columns(1).Split(";".ToCharArray)
    .AddRow()
    .ID = Convert.ToInt32(columns(0))
    If cols.GetUpperBound(0) >= 0 Then
    .Col1 = cols(0)
    End If
    If cols.GetUpperBound(0) >= 1 Then
    .Col2 = cols(1)
    End If
    If cols.GetUpperBound(0) >= 2 Then
    .Col3 = cols(2)
    End If
    If cols.GetUpperBound(0) >= 3 Then
    .Col4 = cols(3)
    End If
    End With
    nextLine = textReader.ReadLine
    Loop
    End Sub
    Public Overrides Sub PostExecute()
    MyBase.PostExecute()
    textReader.Close()
    End Sub
    End Class
    Put this code in ur script component. Before that add 5 columns to the script component output and name them as ID, col1, co2..,col4. ID is of data type int. Create a flat file destination and name it as connection and point it to the flat file as the source.
    Im not sure whats the delimiter in ur flat file between the 2 columns. I have use a comma change it accordingly.
    This is the output I get:
    ID Col1
    Col2 Col3
    Col4
    1 john
    Greg David
    Sam
    2 tom
    tony NULL
    NULL
    3 harry
    NULL NULL
    NULL

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

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

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

  • How to import Filenames and File creation Date into Table..

    Hi Folks,
    I am importing Differennt Excels Files into table. my require ment is after importing completed I need to insert all these Filenames ,File creation date into table. (for Auditing).
    Can you please give me any ideas or reference link.  Thanks In Advance.

    Hi Folks,
    I am importing Differennt Excels Files into table. my require ment is after importing completed I need to insert all these Filenames ,File creation date into table. (for Auditing).
    Can you please give me any ideas or reference link.  Thanks In Advance.
    You can also prepare dir command and then exeucte it by using XP_CMDSHELL. This gives you file name, modified date, creation date information.
    Please refer:
    https://sqljourney.wordpress.com/2010/06/08/get-list-of-files-from-a-windows-directory-to-sql-server/
    https://hernandezpaul.wordpress.com/2013/02/15/store-file-names-and-modified-dates-in-a-table-without-a-foreach-loop-task-sql-server-ssis/
    Cheers,
    Vaibhav Chaudhari
    [MCP],
    [MCTS], [MCSA-SQL2012]

  • How to insert more than 32k xml data into oracle clob column

    how to insert more than 32k xml data into oracle clob column.
    xml data is coming from java front end
    if we cannot use clob than what are the different options available

    Are you facing any issue with my code?
    String lateral size error will come when you try to insert the full xml in string format.
    public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
      boolean isUpdated = true;
      Connection connection = null;
      try {
      connection = ConnectionManager.getConnection ();
      //connection.setAutoCommit ( false );
      PreparedStatement PREPARE_STATEMENT = null;
      String sqlQuery = "UPDATE " + tableName + " SET " + columnName + "  = ?  WHERE ID =" + id;
      PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
      // converting string to reader stream
      Reader reader = new StringReader ( strContents );
      PREPARE_STATEMENT.setClob ( 1, reader );
      // return false after updating the clob data to DB
      isUpdated = PREPARE_STATEMENT.execute ();
      PREPARE_STATEMENT.close ();
      } catch ( SQLException e ) {
      e.printStackTrace ();
      finally{
      return isUpdated;
    Try this JAVA code.

  • Store XML data as relational data into Oracle tables using Java and XMLType

    I want to store xml data into an Oracle 11g table as relational storage, not as CLOB or Binary storage. Then I should also be able to query and fetch this data from table into an XML file.
    Any hint on how to write java code using XMLType to achieve this?
    Any help would be appreciated.

    Thanks for the explanation. I still have few confusions. I will try to elaborate my requirement with a simple example...
    I have the following xsd and xml files. "note" would be the table in database and "to", "from", "heading" and "body" would be the columns of note table. "Tove", "Jan", "Reminder" and "Don't forget me this weekend!" would go as data in one row of note table.
    How do I create note table with the xml schema (xsd file)?
    Should the note table be of XMLType or the columns?
    How do I load the XML data into the columns of note table?
    How do I retrieve the row of note table as XML file?
    XML Schema:
    <?xml version="1.0"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.xxxxx.com"
    xmlns="http://www.xxxxx.com"
    elementFormDefault="qualified">
    <xs:element name="note">
      <xs:complexType>
        <xs:sequence>
          <xs:element name="to" type="xs:string"/>
          <xs:element name="from" type="xs:string"/>
          <xs:element name="heading" type="xs:string"/>
          <xs:element name="body" type="xs:string"/>
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    XML Data:
    <?xml version="1.0"?>
    <note>
      <to>Tove</to>
      <from>Jan</from>
      <heading>Reminder</heading>
      <body>Don't forget me this weekend!</body>
    </note>

  • How to display rows of data into different columns?

    I'm new to SQL and currently this is what I'm trying to do: 
    Display multiple rows of data into different columns within the same row
    I have a table like this:
        CREATE TABLE TRIPLEG(
            T#              NUMBER(10)      NOT NULL,
            LEG#            NUMBER(2)       NOT NULL,
            DEPARTURE       VARCHAR(30)     NOT NULL,
            DESTINATION     VARCHAR(30)     NOT NULL,
            CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
            CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
            CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
        INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
        INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
    The result should be something like this:
    > T#  | ORIGIN  | DESTINATION1  |  DESTINATION2 
    > 1   | SYDNEY  | MELBORUNE     | ADELAIDE
    The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
    Thanks!!!

    T#
    LEG#
    DEPARTURE
    DESTINATION
    1
    1
    Sydney
    Melbourne
    1
    2
    Melbourne
    Adelaide
    1
    3
    Adelaide
    India
    1
    4
    India
    Dubai
    2
    1
    India
    UAE
    2
    2
    UAE
    Germany
    2
    3
    Germany
    USA
    On 11gr2, you may use this :
      SELECT t#,
             REGEXP_REPLACE (
                LISTAGG (departure || '->' || destination, ' ')
                   WITHIN GROUP (ORDER BY t#, leg#),
                '([^ ]+) \1+',
                '\1')
        FROM tripleg
        where leg#<=3
    GROUP BY t#;
    Output:
    1 Sydney->Melbourne->Adelaide->India
    2 India->UAE->Germany->USA
    Cheers,
    Manik.

  • I want to insert two text files in to oracle.

    Ex :
    text1.txt contains data as
    1 a
    2 b
    3 c
    text2.txt contains data as
    4 d
    5 e
    6 f
    I want to load both text file into oracle as
    1 a 4 d
    2 b 5 e
    3 c 6 f
    for these how to create *.ctl file*

    I wouldn't use SQL*Loader for this.
    Here's an example based on your simplified example, but it should get you going.
    I used an external table, so you can load both files at the same time, by adding the filenames to the location.
    By using the PIVOT technique, you can insert the data in the destination table as desired:
    By the way: I needed some help for that last query:http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4937250900346222596 ;)
    SQL> drop table destination purge;
    Table dropped.
    SQL> drop table test purge;
    Table dropped.
    -- Create our desination table:
    SQL> create table destination
      2  ( col1 varchar2(1)
      3  , col2 varchar2(1)
      4  , col3 varchar2(1)
      5  , col4 varchar2(1)
      6  );
    Table created.
    -- Instead of using SQL*Loader, we use an external table to query text1.txt and text2.txt at the same time:
    SQL> create table test
      2  ( col1 varchar2(1)
      3  , col2 varchar2(1)
      4  )
      5  organization external
      6  ( type oracle_loader
      7    default directory DATA_PUMP_DIR
      8    access parameters ( records delimited by newline
      9                        fields terminated by ' '
    10                        lrtrim
    11                        missing field values are null
    12                        ( col1 char(1)
    13                        , col2 char(1)
    14                        )
    15                      )
    16      location ('text1.txt'
    17               ,'text2.txt'
    18               )
    19  );
    Table created.
    -- The data belonging to both files:
    SQL> select * from test;
    C C
    1 a
    2 b
    3 c
    4 d
    5 e
    6 f
    6 rows selected.
    -- Now just pivot as desired and insert with a single SQL statement:
    SQL> insert into destination(col1, col2, col3, col4)
      2  select max(c1_1)
      3  ,      max(c2_1)
      4  ,      max(c1_2)
      5  ,      max(c2_2)
      6  from ( select decode( nt, 1, col1 ) c1_1
      7         ,      decode( nt, 1, col2 ) c2_1
      8         ,      decode( nt, 2, col1 ) c1_2
      9         ,      decode( nt, 2, col2 ) c2_2
    10         ,      row_number() over (partition by nt order by col1) rn
    11         from ( select col1
    12                ,      col2
    13                ,      ntile(2) over (order by col1) nt
    14                from t
    15              )
    16       )
    17  group by rn
    18  order by rn;
    3 rows created.
    -- Look ma, we're already done!
    SQL> select * from destination;
    C C C C
    1 a 4 d
    2 b 5 e
    3 c 6 f

  • Inserting data into a column from 2 different tables

    Hi,
    I need to insert data into a table using 2 other tables. The tables that contain data have identical column names.
    Is using a UNION statement the only option?
    Also, if I need to insert data into columns from only one of the either tables, how do i do it?
    Thanks.

    For future reference, "doesn't seem to work" is a rather generic description... Posting the particular error message will be quite helpful, though I'm reasonably confident that I know the particular problem here.
    First, if only for sanity, you probably want to explicitly list the columns of the destination table in your INSERT statement.
    Second, it doesn't make sense to have DISTINCT clauses in queries that are UNION-ed together. A UNION has to do a sort to remove duplicates already.
    Third, the two queries you are UNIONing together have to return the same number of columns, with the same names, in the same order.
    You probably want something like
    INSERT INTO new_table( col1, col2, col3, col4, col5 )
      SELECT 'ABC'  col1,
             a.colA col2,
             a.colB col3,
             a.colC col4
             a.colD col5
        FROM table1 a
      UNION
      SELECT 'ABC'  col1,
             b.colA col2,
             b.colB col3,
             b.colC col4
             NULL   col5
        FROM table2 bJustin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Why dose Numbers 3.0 while opening csv-Files converts Dates into Integers?

    I want to open a csv-file with a date.
    The Date is in german notation.
    28.10.2013 the value in the cell is 40113.
    This problem occures only in Numbers 3.0
    if I open the same file with Numbers 2.3 it is ok.
    How can I change it.
    The Systempreferences of the date and time handling is ok.

    2. Even though I have set the data type to text within EPMA, once I deploy the application and check it with the EAS console, the data type is NUMERIC - NOT TEXT anymore. This blows my mind. I don't know why this happens.
    Its common ...As enter a text wavlue which has been entered in planning as text in number...Their are certain table's in planning which play role while fetching such values....
    Cheers!
    Sh!va

Maybe you are looking for

  • Urgent - Error while executing the UCM component service

    Hi, I am working on Oracle UCM 11g and created a component service by extending RevisionImplementor class. The service is created using the Component Wizard. I need to execute business logic and update the revision lable while submiiting the Check In

  • Drag-drop video into iphone not working

    All my music and video all of a sudden disappeared off my iphone (the video podcast still were there though). I was updating and poking around, but I really don't think I delete them accidentally. I've always just dragged and dropped videos from the

  • Icloud stationed in Korea ?

    My question is does I cloud and photo stream work here? It does not appear that it does. My photos are not streaming nor do my notes or anything else I have set up in Icloud

  • Not getting ADF Desktop Integration option in Jdeveloper 11.1.1.3

    Hi, I am following this link:- http://www.oracle.com/webfolder/technetwork/tutorials/obe/jdev/obe11jdev/ps3/tutorial_adfdi/adfdinewtutorial/jdtut_11r1_59_2.html for ADF Desktop Integration. When I am opening my Jdeveloper after installing *.NET Progr

  • Safari 3.0.4 address & search dead

    I have uninstalled all the 3rd party plug-ins that were causing problems (and boy do I miss the functionality provided by Safari Enhancer and Acid Search!) but the address bar and search bar still do not work at all. When I enter text there & hit ret