VARCHAR2 (4000) - absolute max?

I have the following code to create a table using sqlplus.

create table psncatsdw.acc_narrative)
accident_num varchar2 (20).
agency_code varchar2 (6).
number of accident_rec_num
VARCHAR2 (4000) narrative.
date of input_date_time
);


The size in bytes max for a varchar2 is 4000. Is it possible to increase it? The "narrative" field is a field where a user basically gives his version of an accident. Recently we had a problem with that. Has never exceeded the 4000 bytes max. Some people take longer than others :) The input tool, that users have is no limit put in place to force it to keep under 4000 (and is not really practical for me to get that changed). So, when I try to load the table with data from all users, almost all of the load will fail when it reaches a 'story' longer than 4000 bytes. When I try to change the size in bytes max on the table I get predictable one error "ORA-00910: specified length too long for its data type. Is there a way hidden for me to get around this size in bytes max?


Thank you!

Hello

Yes, there are way to increase it, use CLOB data type

create table psncatsdw.acc_narrative(
accident_num varchar2(20),
agency_code varchar2(6),
accident_rec_num number,
narrative clob default empty_clob(),
input_date_time date
);

Concerning

Tags: Database

Similar Questions

  • Problem copying 4000 characters of CLOB in VARCHAR2 (4000 TANK)

    I'm migrating data from a table where it is stored in a CLOB to another table where I said a column of VARCHAR2(4000 CHAR).

    I stated a cursor in the form:

    (a) select columna, columnb, substr(clob_column,1,4000) of...

    (b) select columna, columnb, dbms_lob.substr(clob_column,4000,1) of...

    I then loop and EXTRACT the value of substr in a variable that is declared as VARCHAR2 (4000 TANK)

    With the cursor version 'a', using the regular subtr function, I get: ORA-01461: can bind to a LONG value only for insert into a LONG column

    With the slider 'b' version, by using the dbms_lob.substr function, I get: ORA-06502: PL/SQL: digital or value error: character string buffer too small

    I use Oracle 10.2.0.4.0

    I don't know yet what to watch next?

    Machinery says:

    However, the database uses NLS_CHARACTERSET UTF8 and NLS_NCHAR_CHARACTERSET = AL16UTF16, which are multibyte so I was expecting the declared with semantic CHAR VARCHAR2 to be multibyte.

    And it is. But in Oracle SQL VARCHAR2, as I already mentioned, must not exceed 4000 bytes. So even if you have declared it as 4000 characters, you'll get an error when the total length in bytes is greater than 4000. And since, according to the character set, a character can be 1 to 4 bytes, Oracle takes the best cases and allows you to declare it as max 4000 characters. How many characters will fit in eseccion is another question.

    SY.

  • string aggregation > 4000 store in varchar2 (4000)

    Dear experts,

    I'm using Oracle 11.2.0.3. I have the table such as

    ID NAME

    1 xyz

    1 abc xyz

    1 xyz abc def

    2 abc

    2 xyz nmnx

    I want to aggregate them so that I have the aggregation of the NAME by ID

    as

    1XYZ xyz abc xyz abc def
    2ABC xyz nmnx

    I was able to do this using:

    WITH t
         AS (SELECT 1 AS id, 'xyz' AS name FROM DUAL
             UNION ALL
             SELECT 1, ' xyz abc' FROM DUAL
             UNION ALL
             SELECT 1, 'xyz abc  def' FROM DUAL
             UNION ALL
             SELECT 2, 'abc' FROM DUAL
             UNION ALL
             SELECT 2, 'xyz  nmnx' FROM DUAL)
    SELECT     id, RTRIM (XMLCAST (XMLAGG (XMLELEMENT (e, name, ' ') ORDER BY NULL) AS CLOB)) as agg_name
        FROM   t
    GROUP BY   id;
    
    

    However, if the length (agg_name) > 8 (for simplicity), then the name should be on a separate line with the same id

    1 xyz xyz

    1 abc def

    1 xyz ABC

    2 abc xyz

    2 nmnx

    token order is not important.

    Thanks for any help

    Above could be done using

    WITH t
         AS (SELECT 1 AS id, 'xyz' AS name FROM DUAL
             UNION ALL
             SELECT 1, ' xyz abc' FROM DUAL
             UNION ALL
             SELECT 1, 'xyz abc  def' FROM DUAL
             UNION ALL
             SELECT 2, 'abc' FROM DUAL
             UNION ALL
             SELECT 2, 'xyz  nmnx' FROM DUAL)
    SELECT     ID, LISTAGG (name) WITHIN GROUP (ORDER BY NULL) org_name
        FROM   (SELECT   ID,
                         name || ' ' name,
                         CEIL (SUM (len) OVER (PARTITION BY ID ORDER BY len) / 8) part,
                         len
                  FROM   (SELECT    /*distinct */  ID, x.name, LENGTH (x.name || ' ') len
                             FROM   t, XMLTABLE ('ora:tokenize(.," ")' PASSING ' ' || TRIM (name) COLUMNS name VARCHAR2 (4000) PATH '.') x
                            WHERE   x.name IS NOT NULL))
    GROUP BY   ID, part;
    
  • Parse XML stored in portions in VARCHAR2 (4000)

    Hello

    I have to query the data to a third party application, so do not blame me for the data :-) model

    The XML is stored in a column VARCHAR2 (4000) and when there is more then 4000 characters, it is divided into parts with a sequence to identify the order.

    Example:

    DROP TABLE junk_xml;
    CREATE TABLE junk_xml(
        id       INTEGER -- content id
       ,nr       INTEGER -- content sequence
       ,fragment VARCHAR2(4000)
       );
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,1,'<?xml version="1.0" encoding="UTF-8"?>
    <Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:camt.053.001.02 camt.053.001.02.xsd">
        <BkToCstmrStmt>
            <GrpHdr>
                <MsgId>27632364572</MsgId>
                <CreDtTm>2008-09-01T19:30:47.0+01:00</CreDtTm>
                <MsgRcpt>
                    <Id>
                        <OrgId>
                            <Othr>
                                <Id>BCS45678</Id>
                            </Othr>
                        </OrgId>
                    </Id>
                </MsgRcpt>
                <MsgPgntn>
                    <PgNb>1</PgNb>
                    <LastPgInd>true</LastPgInd>
                </MsgPgntn>
            </GrpHdr>
            <Stmt>
                <Id>2736482736482</Id>
                <ElctrncSeqNb>101</ElctrncSeqNb>
                <LglSeqNb>32</LglSeqNb>
                <CreDtTm>2008-09-01T17:30:47.0+01:00</CreDtTm>
                <Acct>
                    <Id>
                        <IBAN>DE62210500001234567890</IBAN>
                    </Id>
                    <Ccy>EUR</Ccy>
                    <Ownr>
                        <Nm>Name Kontoinhaber</Nm>
                    </Ownr>
                    <Svcr>
                        <FinInstnId>
                            <BIC>BANKDEFFXXX</BIC>
                            <Othr>
                                <Id>123456789</Id>
                                <Issr>UmsStId</Issr>
                            </Othr>
                        </FinInstnId>
                    </Svcr>
                </Acct>
                <Bal>
                    <Tp>
                        <CdOrPrtry>
                            <Cd>PRCD</Cd>
                        </CdOrPrtry>
                    </Tp>
                    <Amt Ccy="EUR">112.72</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Dt>
                        <Dt>2008-09-01</Dt>
                    </Dt>
                </Bal>
                <Bal>
                    <Tp>
                        <CdOrPrtry>
                            <Cd>CLBD</Cd>
                        </CdOrPrtry>
                    </Tp>
                    <Amt Ccy="EUR">158780.32</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Dt>
                        <Dt>2008-09-01</Dt>
                    </Dt>
                </Bal>
                <!-- Beispiel 1: SEPA-Zahlungen (Ueberweisung, Lastschrift, R-Nachricht -->
                <!--Gutschrift aufgrund eines SEPA-Ueberweisungseinganges-->
                <Ntry>
                    <Amt Ccy="EUR">100.00</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-01</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-01</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <Refs>
                                <EndToEndId>');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,2,'Ende-zu-Ende-Id des Ueberweisenden</EndToEndId>
                            </Refs>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+166</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>Herr Ueberweisender</Nm>
                                </Dbtr>
                                <DbtrAcct>
                                    <Id>
                                        <IBAN>DE21500500001234567897</IBAN>
                                    </Id>
                                </DbtrAcct>
                                <UltmtDbtr>
                                    <Nm>Herr Debtor Reference Party</Nm>
                                </UltmtDbtr>
                                <Cdtr>
                                    <Nm>Herr Kontoinhaber</Nm>
                                </Cdtr>
                                <UltmtCdtr>
                                    <Nm>Herr Creditor Reference Party</Nm>
                                </UltmtCdtr>
                            </RltdPties>
                            <Purp>
                                <Cd>GDDS</Cd>
                            </Purp>
                            <RmtInf>
                                <Ustrd>Rechnungsnr. 4711 vom 20.08.2008</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>SEPA GUTSCHRIFT</AddtlNtryInf>
                </Ntry>
                <!--Gutschrift aufgrund einer zurueckgekommenen SEPA-Ueberweisung-->
                <Ntry>
                    <Amt Ccy="EUR">200.00</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-01</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-01</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <Refs>
                                <EndToEndId>Urspr. E2E-Id der Hintransaktion</EndToEndId>
                            </Refs>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+159++901</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RmtInf>
                                <Ustrd>Angabe des urspruenglichen Verwendungszweckes</Ustrd>
                            </RmtInf>
                            <RtrInf>
                                <OrgnlBkTxCd>
                                    <Prtry>
                                        <Cd>NTRF+116</Cd>
                                        <Issr>ZKA</Issr>
                                    </Prtry>
                                </OrgnlBkTxCd>
                                <Orgtr>
                                    <Id>
                                        <OrgId>
                                            <BICOrBEI>BANKDEHH</BICOrBEI>
                                        </OrgId>
                                    </Id>
                                </Orgtr>
                                <Rsn>
                                    <Cd>AC01</Cd>
                                </Rsn>
                                <AddtlInf>IBAN FEHLERHAFT</AddtlInf>
                            </RtrInf>
                        </TxDtls>');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,3,'
                    </NtryDtls>
                    <AddtlNtryInf>SEPA RUECKBUCHUNG</AddtlNtryInf>
                </Ntry>
                <!--Belastung aufgrund einer SEPA-Lastschrift-->
                <Ntry>
                    <Amt Ccy="EUR">50.00</Amt>
                    <CdtDbtInd>DBIT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-01</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-01</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <Refs>
                                <EndToEndId>E2E-Id vergeben vom Glaeubiger</EndToEndId>
                                <MndtId>Ref. des SEPA-Lastschriftmandats</MndtId>
                            </Refs>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NDDT+105</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>Herr Zahlungspflichtiger</Nm>
                                </Dbtr>
                                <UltmtDbtr>
                                    <Nm>Herr Debtor Reference Party</Nm>
                                </UltmtDbtr>
                                <Cdtr>
                                    <Nm>Glaeubigerfirma</Nm>
                                    <Id>
                                        <PrvtId>
                                            <Othr>
                                                <Id>Cdtr-Id des Glaeubigers</Id>
                                            </Othr>
                                        </PrvtId>
                                    </Id>
                                </Cdtr>
                            </RltdPties>
                            <Purp>
                                <Cd>PHON</Cd>
                            </Purp>
                            <RmtInf>
                                <Ustrd>Telefonrechnung August 2009, Vertragsnummer 3536456345</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>SEPA LASTSCHRIFT</AddtlNtryInf>
                </Ntry>
                <!-- Beispiel 2: DTAUS-Zahlungen (Ueberweisung, Lastschrift, Rueckgabe) -->
                <!--Gutschrift aufgrund eines DTA-Überweisungseinganges-->
                <Ntry>
                    <Amt Ccy="EUR">100.00</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-02</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-02</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz aus DTA C-Satz Feld 6</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+051++000</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,4,'
                                    <Nm>Herr Überweisender</Nm>
                                </Dbtr>
                                <DbtrAcct>
                                    <Id>
                                        <Othr>
                                            <Id>1234567890</Id>
                                        </Othr>
                                    </Id>
                                </DbtrAcct>
                            </RltdPties>
                            <RmtInf>
                                <Ustrd>Rechnungsnr 4711 - Warenlieferung vom 20.08.2008</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>ÜBERWEISUNGSGUTSCHRIFT</AddtlNtryInf>
                </Ntry>
                <!--Gutschrift aufgrund einer zurückgekommenen DTA-Überweisung-->
                <Ntry>
                    <Amt Ccy="EUR">200.00</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-02</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-02</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz aus DTA C-Satz Feld 6</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+059++511</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RmtInf>
                                <Ustrd>Angabe des ursprünglichen Verwendungszweckes</Ustrd>
                            </RmtInf>
                            <RtrInf>
                                <OrgnlBkTxCd>
                                    <Prtry>
                                        <Cd>NTRF+051++000</Cd>
                                        <Issr>ZKA</Issr>
                                    </Prtry>
                                </OrgnlBkTxCd>
                                <Orgtr>
                                    <Nm>Herr Überweisungsempfänger</Nm>
                                </Orgtr>
                                <Rsn>
                                    <Prtry>512</Prtry>
                                </Rsn>
                                <AddtlInf>BLZ 25069674 EXISTIERT NICHT</AddtlInf>
                            </RtrInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>RÜCKÜBERWEISUNG</AddtlNtryInf>
                </Ntry>
                <!--Belastung aufgrund einer DTA-Lastschrift-->
                <Ntry>
                    <Amt Ccy="EUR">50</Amt>
                    <CdtDbtInd>DBIT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-02</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-02</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz aus DTA C-Satz Feld 6</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+005++000</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            ');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,5,'<RltdPties>
                                <Cdtr>
                                    <Nm>Telefongesellschaft ABC</Nm>
                                </Cdtr>
                            </RltdPties>
                            <RmtInf>
                                <Ustrd>Telefonrechnung August 2009, Vertragsnummer 3536456345</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>LASTSCHRIFT</AddtlNtryInf>
                </Ntry>
                <!-- Beispiel 3a: Sammlerdarstellung mit Aufloesung innerhalb der Nachricht -->
                <!--Belastung aufgrund von SEPA-Lastschriftrueckgaben (Sammelbuchung) mit Sammleraufloesung unter Transaction Details-->
                <Ntry>
                    <Amt Ccy="EUR">276</Amt>
                    <CdtDbtInd>DBIT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-03</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-03</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <!-- BkTxCd ist Pflichtfeld gemaess ISO, wird jedoch ausschliesslich auf Tx-Ebene verwendet -->
                    <NtryDtls>
                        <Btch>
                            <NbOfTxs>3</NbOfTxs>
                        </Btch>
                        <TxDtls>
                            <!-- Ab hier Aufloesung des Sammlers bestehend aus 3 Einzelumsaetzen -->
                            <Refs>
                                <EndToEndId>79892</EndToEndId>
                                <MndtId>10001</MndtId>
                            </Refs>
                            <AmtDtls>
                                <TxAmt>
                                    <Amt Ccy="EUR">76</Amt>
                                </TxAmt>
                            </AmtDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+109++901</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>Herr Zahlungspflichtiger 1</Nm>
                                </Dbtr>
                                <Cdtr>
                                    <Nm>Telefongesellschaft ABC</Nm>
                                    <Id>
                                        <PrvtId>
                                            <Othr>
                                                <Id>CdtrId des SEPA-Lastschrifteinr.</Id>
                                            </Othr>
                                        </PrvtId>
                                    </Id>
                                </Cdtr>
                            </RltdPties>
                            <Purp>
                                <Cd>PHON</Cd>
                            </Purp>
                            <RmtInf>
                                <Ustrd>Telefonrechnung August 2009, Vertragsnummer 3536456345</Ustrd>
                            </RmtInf>
                        </TxDtls>
                        <TxDtls>
                            <Refs>
                                <EndToEndId>768768</EndToEndId>
                                <MndtId>10002');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,6,'</MndtId>
                            </Refs>
                            <AmtDtls>
                                <TxAmt>
                                    <Amt Ccy="EUR">80</Amt>
                                </TxAmt>
                            </AmtDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+109++901</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>Herr Zahlungspflichtiger 2</Nm>
                                </Dbtr>
                                <Cdtr>
                                    <Nm>Telefongesellschaft ABC</Nm>
                                    <Id>
                                        <PrvtId>
                                            <Othr>
                                                <Id>CdtrId des SEPA-Lastschrifteinr.</Id>
                                            </Othr>
                                        </PrvtId>
                                    </Id>
                                </Cdtr>
                            </RltdPties>
                            <Purp>
                                <Cd>PHON</Cd>
                            </Purp>
                            <RmtInf>
                                <Ustrd>Telefonrechnung August 2009, Vertragsnummer 3536456888</Ustrd>
                            </RmtInf>
                        </TxDtls>
                        <TxDtls>
                            <Refs>
                                <EndToEndId>45456465</EndToEndId>
                                <MndtId>10003</MndtId>
                            </Refs>
                            <AmtDtls>
                                <TxAmt>
                                    <Amt Ccy="EUR">120</Amt>
                                </TxAmt>
                            </AmtDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+109++901</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>Herr Zahlungspflichtiger 3</Nm>
                                </Dbtr>
                                <Cdtr>
                                    <Nm>Telefongesellschaft ABC</Nm>
                                    <Id>
                                        <PrvtId>
                                            <Othr>
                                                <Id>CdtrId des SEPA-Lastschrifteinr.</Id>
                                            </Othr>
                                        </PrvtId>
                                    </Id>
                                </Cdtr>
                            </RltdPties>
                            <Purp>
                                <Cd>PHON</Cd>
                            </Purp>
                            <RmtInf>
                                <Ustrd>Telefonrechnung August 2009, Vertragsnummer 3536456345</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>SEPA Direct Debit (Einzelbuchung-Soll, Core)</AddtlNtryInf>
                </Ntry>
                <!-- Beispiel 3b: Sammlerdarstellung mit Verweis auf pain-Nachricht und separate camt.054.001.01-Nachricht -->
                <!--Belastung aufgrund einer SEPA-Ueberweisung (Sammler) mit Verweis auf Original pain-Nachricht-->
                <Ntry>
                    <Amt Ccy="');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,7,'EUR">100876.00</Amt>
                    <CdtDbtInd>DBIT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-03</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-03</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <Btch>
                            <MsgId>MsgId der pain-Nachricht</MsgId>
                            <PmtInfId>Sammler-Id dieser pain-Nachricht</PmtInfId>
                        </Btch>
                        <TxDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+191</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>SEPA Credit Transfer (Sammler-Soll)</AddtlNtryInf>
                </Ntry>
                <!--Belastung aufgrund von SEPA-Lastschriftrueckgaben (Sammelbuchung) mit Verweis auf separate camt.054.001.01-Nachricht-->
                <Ntry>
                    <Amt Ccy="EUR">276.00</Amt>
                    <CdtDbtInd>DBIT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-03</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-03</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <AddtlInfInd>
                        <MsgNmId>camt.054.001.01</MsgNmId>
                        <MsgId>054-20090903-00034</MsgId>
                        <!-- siehe Bsp. camt54 Bsp 3b -->
                    </AddtlInfInd>
                    <NtryDtls>
                        <TxDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+109++901</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>SEPA Direct Debit (Einzelbuchung-Soll, Core)</AddtlNtryInf>
                </Ntry>
                <!-- Beispiel 4: USD-Zahlung mit Gutschrift auf einem EUR-Konto -->
                <!-- USD-Zahlung mit Gutschrift auf einem EUR-Konto -->
                <Ntry>
                    <Amt Ccy="EUR">259595.60</Amt>
                    <CdtDbtInd>CRDT</CdtDbtInd>
                    <Sts>BOOK</Sts>
                    <BookgDt>
                        <Dt>2008-09-04</Dt>
                    </BookgDt>
                    <ValDt>
                        <Dt>2008-09-04</Dt>
                    </ValDt>
                    <AcctSvcrRef>Bankreferenz</AcctSvcrRef>
                    <BkTxCd/>
                    <NtryDtls>
                        <TxDtls>
                            <AmtDtls>
                                <InstdAmt>
                                    <Amt Ccy="USD">360873.97</Amt>
                                ');
    INSERT INTO junk_xml (id,nr,fragment)
    VALUES (0,8,'</InstdAmt>
                                <TxAmt>
                                    <Amt Ccy="EUR">259595.60</Amt>
                                </TxAmt>
                                <CntrValAmt>
                                    <Amt Ccy="EUR">259621.56</Amt>
                                    <CcyXchg>
                                        <SrcCcy>USD</SrcCcy>
                                        <TrgtCcy>EUR</TrgtCcy>
                                        <XchgRate>1.39</XchgRate>
                                    </CcyXchg>
                                </CntrValAmt>
                            </AmtDtls>
                            <BkTxCd>
                                <Prtry>
                                    <Cd>NTRF+202</Cd>
                                    <Issr>ZKA</Issr>
                                </Prtry>
                            </BkTxCd>
                            <Chrgs>
                                <Amt Ccy="EUR">25.96</Amt>
                            </Chrgs>
                            <RltdPties>
                                <Dbtr>
                                    <Nm>West Coast Ltd.</Nm>
                                    <PstlAdr>
                                        <Ctry>US</Ctry>
                                        <AdrLine>52, Main Street</AdrLine>
                                        <AdrLine>3733 San Francisco</AdrLine>
                                    </PstlAdr>
                                </Dbtr>
                                <DbtrAcct>
                                    <Id>
                                        <Othr>
                                            <Id>546237687</Id>
                                        </Othr>
                                    </Id>
                                </DbtrAcct>
                            </RltdPties>
                            <RltdAgts>
                                <DbtrAgt>
                                    <FinInstnId>
                                        <BIC>BANKUSNY</BIC>
                                    </FinInstnId>
                                </DbtrAgt>
                            </RltdAgts>
                            <RmtInf>
                                <Ustrd>Invoice No. 4545</Ustrd>
                            </RmtInf>
                        </TxDtls>
                    </NtryDtls>
                    <AddtlNtryInf>AZV-UEBERWEISUNGSGUTSCHRIFT</AddtlNtryInf>
                </Ntry>
            </Stmt>
        </BkToCstmrStmt>
    </Document>');
    
    COMMIT;
    

    My first idea was to use LISTAGG to splice the pieces, but I get an ORA-01489: result of concatenating string is too long

    SELECT  XMLTYPE(
                LISTAGG(fragment,'')
                WITHIN GROUP(ORDER BY nr))
    FROM    junk_xml
    WHERE   id = 0
    GROUP BY id;
    

    I considered also to export the data in another table using perhaps dbms_lob to concatenate the strings, but I'm not allowed to create another table.

    No idea how I can access the data hidden in this application?

    Concerning

    Marcus

    P.S.: The application is not on the treatment of the SEPA, but I don't want to show the actual data.

    Hi Marcus,

    This should work well:

    Select xmlparse (document

    (xmlcast)

    XMLAGG (XMLFOREST (fragment) nr order)

    as clob

    )

    ) as complete_doc

    of junk_xml

    where id = 0;

  • VARCHAR2 (4000 tank) in AL32UTF8

    Hello

    I have an instance using AL32UTF8. There is a column in a table is defined as VARCHAR2 (4000 tank). I can fill a string with 4,000 characters (multi-byte language) to this column?

    Thank you

    >
    that means that the length of VARCHAR maxiumn is 4000 BYTES, regardless of the configuration?
    >
    Yes - the maximum length of VARCHAR2 is 4000 bytes.

    Oracle allows to specify VARCHAR2 (4000 TANK) for a base of multibyte character set, since it is legal to insert 4000 single-byte characters. But it is to make sure that you don't try to integrate more than 4000 bytes.

  • New HP Pavilion DM1 4000 series max memory card

    Hello

    I am looking to buy a new ultraportable laptop and like the look of the new series DM1-4000. However, it seems that there are two versions available in the United Kingdom - the 4004SA DM1 and DM1-4027SA. The data sheet pdf, the noticeable difference only seems to be the maximum amount of memory installed (4 GB in the 4004, 6 GB in the 4027). I don't understand not why HP would impose this limit as both have 2 user accessible so-DIMM slots - my preference would be to upgrade the memory 8 GB by replacing both of the 2 GB so - DIMMS with 4 GB (after installing W7 64-bit rather than the stock windows W7 32 bit, it comes with).

    My question is this - is correct these limits of 4 GB or 6 GB or is it just a marketing thing?

    Interesting, the Maintenance and Service Guide (PDF) DM1-4000 series indicates the memory installable max is 8 GB.

    Thanks in advance. Any ideas much appreciated.

    Edit: Also noted there is a model 4020SA and 4020EA... both specify also 4 GB memory Max.

    There is not much sense, it?

    The maintenance manual makes it clear that portable computers running AMD processor have 2 slots of memory each hold 4 GB of memory.  See Chapter 1, page 2.

    Now, the Intel PC base seems to indicate that they cannot contain only 4 GB maximum memory - affordable housing from a single client.

    http://h10032.www1.HP.com/CTG/manual/c03084091.PDF

    Paul

  • I have the blob column in a table. I want to break up the value of the column in characters varchar2 (4000) (block).

    Example of

    create table test (id primary number, data key blob);

    I want to display like

    Select code, data of the test;

    ID data

    1 character 4000

    1 character 4000

    1 character 4000

    .

    .

    and soon.

    Please help me on this

    BLOB stores binary data. What is the point of converted them to a varchar2? If the LOB will store the character data, then the appropriate data type would be CLOB. Said that, assuming that you will use CLOB here is the answer to your question.

    drop table temp purge;

    create table temp

    (

    integer ID

    clob c_lob

    );

    declare

    CLOB var;

    Start

    DBMS_LOB.CREATETEMPORARY (var, true);

    because me in 1.32 loop

    DBMS_LOB. WriteAppend (var, 1000, rpad ('x', 1000, 'x'));

    end loop;

    insert into temp (id, c_lob) values (1, var);

    insert into temp (id, c_lob) values (2, var);

    commit;

    end;

    /

    Select id

    rno

    , length (dbms_lob.substr (c_lob, 4000, offset)) c_lob_var_len

    , dbms_lob.substr (c_lob, 4000, offset) c_lob_var

    de)

    Select id

    , ((level-1) * 4000) + 1 offset

    c_lob

    level NWR

    temp

    connect

    by level<=>

    and prior id = id

    and dbms_random.value (prior) is not null

    );

  • using line as column names

    All,

    I have two tables like questions_tbl table and response_tbl table I want to use queries the table in question (q1, q2, g3 etc.) as title/names of columns and the corresponding answers in the table response_tbl for this question as column values

    questions_tbl (id, question_code, q1, q2, q3)

    responses_tbl (id, question_code, resp1, resp2, resp3)

    logged in as questions_tbl.question_code = responses_tbl.question_code IE 1-to-many

    example of report,

    What is your favorite car?                 What is xxxxxx?                     What is your best pet?

    ========================   ======================  ========================

    ford                                             laptop                                     dog

    Chevy                                         cellphone                                dove

    vw                                              ipod                                        dolphin

    How can I write this in sql/plsql to achieve this result?

    Oracle 11g 2

    Thank you.

    create the table questions_tbl as

    Select 1 id, 'T1' question_code, "what is your favorite car?" question of all the double union

    Select 2, 'q2', "what is your favorite device?" of all the double union

    Select 3, "q3", 'what is your favorite animal?' in union double all the

    Select 4, 'T4', "what is your favorite plant?" of all the double union

    Select 5, 'q5', "what is your favorite hamburger?" of the double

    create the table responses_tbl as

    Select 1 id, 'T1' question_code, 'Ford' Union response double all the

    Select 2, 'T1', 'Chevy' from dual union all

    Select 3, 'T1', 'VW' from dual union all

    Select option 4, "T2", "notebook" of the dual union all

    Select 5, 'T2', 'cell phone' from dual union all

    Select 6, 'T2', 'i - pod' from dual union all

    Select 7, "T2", "i - pad' from dual union all

    Select 8, "T2", "toothbrush" dual Union all

    Select 9, "q3", "dog" of all the double union

    10. Select, "q3", "plunged" the dual union all

    Select 11, "q3", "Dolphin" dual union all

    Order 12, "q3", "cat" dual union all

    Select 13, 'q5', 'Ham' from dual union all

    Select 14, 'q5', 'cheese' from dual union all

    Select 15, 'q5', 'fish' of all the double union

    Select 16, 'q5', 'chicken' of the double

    create or replace function report_query (no_of_columns in number) return varchar2 is

    sql_result varchar2 (4000): = q'[select id,

    0 rn,

    Upper (question) text

    of questions_tbl

    Union of all the

    Select q.id,

    ROW_NUMBER() over (partition by order q.question_code by r.id) rn,

    r.Response text

    of questions_tbl q,.

    responses_tbl r

    where q.question_code = r.question_code

    order by id, rn

    ]';

    sql_x varchar2 (4000): = ";

    sql_y varchar2 (4000): = ";

    sql_1 varchar2 (4000): = q'[select row_is,

    RN,

    ]';

    sql_2 varchar2 (4000): = q'[max (c1) c1,

    ]';

    sql_3 varchar2 (4000): = q'[from (select ceil (id /: columns) row_is,)]

    RN,

    ]';

    sql_4 varchar2 (4000): = q'[case when mod(id,:columns) = 1 then c1, end of text,

    ]';

    sql_5 varchar2 (4000): = q'[Correction (select id,

    0 rn,

    Upper (question) text

    of questions_tbl

    Union of all the

    Select q.id,

    ROW_NUMBER() over (partition by order q.question_code by r.id) rn,

    r.Response text

    of questions_tbl q,.

    responses_tbl r

    where q.question_code = r.question_code

    )

    )

    Group of row_is, rn

    order of row_is, rn

    ]';

    Start

    If no_of_columns > 1 then

    because me in 1... no_of_columns

    loop

    sql_x: = sql_x | Replace (sql_2, '1', to_char (i));

    sql_y: = sql_y | Replace (sql_4, '1', to_char (i));

    end loop;

    sql_x: = replace (sql_x, to_char (no_of_columns): ',', to_char (no_of_columns));

    sql_y: = replace (sql_y, to_char (no_of_columns): ',', to_char (no_of_columns));

    sql_y: = replace (sql_y, '=' | to_char (no_of_columns), '= 0');

    sql_result: = replace(sql_1|| sql_x || sql_3 || sql_y || sql_5,':columns',to_char(no_of_columns));)

    end if;

    Return sql_result;

    end;

    Select report_query (3) double T3

    Q3
    Select rn, max c1, c2 max (c2), row_is, max (c3) c3 (c1) from (select ceil(id / 3) row_is, rn, case when mod(id,3) = 1 then text end c1, case when mod(id,3) = 2 then text end c2, case when mod(id,3) = 0 then the text end c3 from (select id, 0 rn) ((, text of upper (question) of questions_tbl union q.id select all the row_number() over (partition by order q.question_code by r.id) rn, text of r.response of q, r responses_tbl questions_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    Select rn, max c1, c2 max (c2), row_is, max (c3) c3 (c1) from (select ceil(id / 3) row_is, rn, case when mod(id,3) = 1 then text end c1, case when mod(id,3) = 2 then text end c2, case when mod(id,3) = 0 then the text end c3 from (select id, 0 rn) ((, text of upper (question) of questions_tbl union q.id select all the row_number() over (partition by order q.question_code by r.id) rn, text of r.response of q, r responses_tbl questions_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    ROW_IS RN C1 C2 C3
    1 0 WHAT'S YOUR CAR FAVORITE? WHAT IS YOUR FAVORITE? WHAT IS YOUR ANIMAL FAVORITE?
    1 1 Ford laptop dog
    1 2 Chevy cell phone Dove
    1 3 VW i pod Dolphin
    1 4 - i pad CAT
    1 5 - toothbrush -
    2 0 WHAT IS YOUR FAVORITE? WHAT IS YOUR BURGER FAVORITE? -
    2 1 - Ham -
    2 2 - cheese -
    2 3 - fish -
    2 4 - chicken -

    Select report_query (2) double T2

    Q2
    Select row_is, rn, max (c1) c1, c2 from max (c2) (select ceil(id / 2) row_is, rn, case when mod(id,2) = 1 then text end c1, case when mod(id,2) = 0 then text end c2 from (select id, 0 rn, upper (question) of questions_tbl union q.id text select all, row_number() on rn (partition by order q.question_code by r.id) questions_tbl r.response text q) ((, r responses_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    Select row_is, rn, max (c1) c1, c2 from max (c2) (select ceil(id / 2) row_is, rn, case when mod(id,2) = 1 then text end c1, case when mod(id,2) = 0 then text end c2 from (select id, 0 rn, upper (question) of questions_tbl union q.id text select all, row_number() on rn (partition by order q.question_code by r.id) questions_tbl r.response text q) ((, r responses_tbl where q.question_code = r.question_code)) Group of row_is, sort row_is, rn rn

    ROW_IS RN C1 C2
    1 0 WHAT'S YOUR CAR FAVORITE? WHAT IS YOUR FAVORITE?
    1 1 Ford laptop
    1 2 Chevy cell phone
    1 3 VW i pod
    1 4 - i pad
    1 5 - toothbrush
    2 0 WHAT IS YOUR ANIMAL FAVORITE? WHAT IS YOUR FAVORITE?
    2 1 dog -
    2 2 Dove -
    2 3 Dolphin -
    2 4 CAT -
    3 0 WHAT IS YOUR BURGER FAVORITE? -
    3 1 Ham -
    3 2 cheese -
    3 3 fish -
    3 4 chicken -

    You said that it is a report

    Concerning

    Etbin

  • field of varchar2 external table storing only 255 bytes (4000 bytes)

    Hi all

    I was wondering if someone can tell me what im missing here.
    I have an external table with one column defined as varchar2 (4000 byte). the file contains a line with 255 characters (all the number 2 for simplicity). When I query the table, everything is fine. If I add 1 plus 2 chain (256 characters) it fails. im sure its something stupidly simple, but what am I missing? If he doesn't have to question fine up to 4000 characters?

    Thank you
    Dave

    I ran your testcase, thanks for that.
    Make sure you read the SQL and PL/SQL FAQ as well (the first thread sticky on this forum), he explains how to post the code formatted and many other things.

    In any case, the .log file gave me:

    LOG file opened at 07/18/11 20:05:33
    
    Field Definitions for table DAVEP2
      Record format DELIMITED, delimited by 0A
      Data in file has same endianness as the platform
      Rows with all null fields are accepted
    
      Fields in Data Source: 
    
        MY_STRING                       CHAR (255)
          Terminated by ","
          Enclosed by """ and """
          Trim whitespace same as SQL Loader
    

    So, what happens if you create the table as follows:

     CREATE TABLE davep2 (
       my_string         VARCHAR2(4000 BYTE)         NULL
     )
     ORGANIZATION EXTERNAL
       (  TYPE ORACLE_LOADER
          DEFAULT DIRECTORY FILE_TEST
          ACCESS PARAMETERS
            ( RECORDS DELIMITED BY  0x'0A'  BADFILE FILE_TEST:'davep2.bad'
      LOGFILE FILE_TEST:'davep2.log'
      FIELDS TERMINATED BY ',' optionally enclosed by '"' and '"'
      missing field values are null
       (
               my_string char(4000)
               ) )
          LOCATION (FILE_TEST:'DaveP.csv')) REJECT LIMIT 0 NOPARALLEL
    
  • Need for clarification to varchar2 column

    I get xml that will be inserted in the local table messages
    It is, I don't really know the size of the incoming xml message data.
    Design of the structure of the table is now difficult.
    If I design the column in the table for column varchar2 with VARCHAR2 (4000) and if the message contains the value
    as 'SAM', 'GEORGE' (no more than 10 characters) then it does not seem good for the VARCHAR2 COLUMN (4000)
    Oracle does not create the table with VARCHAR2 (without specifying the size)

    Any suggestions?

    S

    There's no real difference if you use varchar2 (4000) or varchar2 (100). Apart from the obvious that you can store up to 4000 bytes, against only 100/characters multibyte.

    However, there are a few minor side effects. Few of them and a comparison of the performance is described here: http://arjudba.blogspot.de/2009/08/does-oversize-of-datatype-varchar2.html

    (1) the varchar2 column indexing 4000 could be a problem (the ora-01450 exceeded max key length).

    (2) the size of the table could be actually smaller for tables with many sparesly populated varchar2 4000 columns. I can't find the source for that at the moment, but it had to do with the way oracle reserves future space required for the column.

    (3) migration of rank is more likely to happen if the great texts are added (= update) later.

    (4) If you define a variable with % rowtype in the table, it will use more expensive space PGA

    (5) some tools like TOAD could get questions or need of more resources to operate on 4 k columns.

  • How to get the Max of elements of type datetime value

    Hi all
    I wanted to get the last value timestamp (DateTime data type) of the node list. I have the following xml. In this xml file, I want to get the modifydate element that has the last time stamp via xquery/xpath, it should return me following result 2011-09-29 T 17: 21:17 + 10:00

    < CustomerList >
    < CustomerDetails >
    < Name > Test 1 < / name >
    assets of < status > < / status >
    < modifyDate > 2011-08-20T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >

    < CustomerDetails >
    < Name > Test 2 < / name >
    Cancel < status > < / status >
    < modifyDate > 2011-08-29T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >

    < CustomerDetails >
    < Name > Test 3 < / name >
    assets of < status > < / status >
    < modifyDate > 2011-09-29T 17: 21:17 + 10:00 < / modifyDate >
    < / CustomerDetails >
    < / CustomerList >


    I tried to use the
    CustomerList/CustomerDetails/modifyDate [not (. < =... / the above - sibling:CustomerList/CustomerDetails modifyDate) and not (. < =... / following - sibling:CustomerList/CustomerDetails modifyDate)]
    But it does not work on the datetime data type.
    Any help in this regard is highly appreciated.

    Concerning

    Published by: user6736659 on Sep 5, 2011 06:15

    Hello

    The following XQuery query should give you what you want:

    max(
     for $i in /CustomerList/CustomerDetails/modifyDate
     return xs:dateTime($i)
    )
    

    For example, by using Oracle SQL:

    SQL> var xmldoc varchar2(4000)
    SQL> begin
      2   :xmldoc := '
      3  
      4   Test 1
      5  active
      6  2011-08-20T17:21:17+10:00
      7  
      8
      9  
     10   Test 2
     11  cancel
     12  2011-08-29T17:21:17+10:00
     13  
     14
     15  
     16   Test 3
     17  active
     18  2011-09-29T17:21:17+10:00
     19  
     20  ';
     21  end;
     22  /
    
    PL/SQL procedure successfully completed
    
    SQL> select xmlquery('max(
      2   for $i in /CustomerList/CustomerDetails/modifyDate
      3   return xs:dateTime($i)
      4  )'
      5  passing xmltype(:xmldoc)
      6  returning content
      7  )
      8  from dual
      9  ;
    
    XMLQUERY('MAX(FOR$IIN/CUSTOMER
    --------------------------------------------------------------------------------
     2011-09-29T17:21:17.000000+10:00
     
    
  • Sort numerically a varchar2 container field '-' and tanks

    I have a Field1 varchar2 (20) that contains values such as
    2-14', 3-9', '1-1-2 T'

    They should be sorted in the order

    ' 1 1-2 T '
    2-14'
    3-9'

    I tried to use lpad (field1, 22, '0') but he left buffers at a given fixed length for the whole area and it does not work.

    There is no fixed grammar for this field and it is possible that in the future some unexpected tank can appear in the field. For example, "[1-2]" "

    But the query needs to work even if the sort is not correct.

    select field1,field2,field3...from table tab1, tab2...where ...
              order by field1;
    Can someone please help?

    Thank you.

    Hello

    Sorry, I don't understand the sorting rules.
    It looks like
    (a) the string is divided into a number of secondary channels by hyphens.
    (b) sorting through secondary channels in the order, i.e. the substring n matter only if there is equality of strings 1 through n - 1.
    (c) strings composed entirely of numbers preceded by secondary channels who have other characters
    (d) secondary digital channels are classified as numbers, that is, '1' and '01' are the same, but comes from '1' before ' 03 "
    (e) other substrings are classified as strings

    Under these rules, the two identical channels ' 1 - 1 - R 'would come after the strings that start with 1-01 - 1-'.
    Other than that, the following query is what you asked:

    WITH  cntr     AS
    (
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY  LEVEL <= 1 + ( SELECT  MAX ( LENGTH (txt)
                                                  - LENGTH ( REPLACE ( txt
                                                        , '-'
                                              )
                                       )
                                  )
                           FROM    table_x
                         )
    )
    ,       got_sub_txt  AS
    (
         SELECT  id
         ,     txt
         ,     n
         ,     REGEXP_SUBSTR ( txt
                         , '[^-]+'
                         , 1
                         , n
                         )          AS sub_txt
         FROM    table_x
         JOIN     cntr     ON  n <= 1 + LENGTH (txt) - LENGTH (REPLACE (txt, '-'))
    )
    ,     got_sort_key     AS
    (
         SELECT     got_sub_txt.*
         ,     SYS_CONNECT_BY_PATH ( CASE
                               WHEN  REGEXP_LIKE ( sub_txt
                                                   , '[^0-9]'
                                             )
                               THEN  '2' || RPAD (sub_txt, 10)     -- Magic Number
                               ELSE  '1' || LPAD (sub_txt, 10, '0')     -- Magic Number
                              END
                            , '-'
                            )     AS sort_key
         FROM     got_sub_txt
         WHERE   CONNECT_BY_ISLEAF = 1
         START WITH  n     = 1
         CONNECT BY  n     = PRIOR n + 1
         AND         id     = PRIOR id
    )
    SELECT    id
    ,       txt
    FROM       got_sort_key
    ORDER BY  sort_key;
    

    This requires that each substring will be (at most) 10 characters long. That's what the 'magic number' 10 in got_sort_key of the subquery. You can change this to whole m that you like.
    The only limit is the number of subkeys is that they must all fit in a VARCHAR2 4000 characters, so the limit is 4000 / (m + 2) (e.g., 333 when m = 10).

    For this solution, you need a unique identifier (id in the example above) for each line. You don't need to display this identifier in the SELECT clause.
    If txt itself is unique, it can be used as the identifier.

  • Portege 4000 memory upgrade

    I bought memory to upgrade my Portege 4000 (128 MB SDRAM SODIMM 144 pin) when I installed in the empty slot and turned on the laptop the green light at the top came on, power led but nothing started and no noise to suggest whatever it is started either!

    I took this new module and leave the original in there and it starts perfectly. Does anyone know what is the problem?

    Help, please!
    Thanks in advance!

    It s a clear man thing memory module is faulty, or you use only is not supported and not supported one!
    The Portege 4000 supports max 1024MB (2x512MB) memory.
    I think you should try the Toshiba recommended memory SDRAM like these modules:
    PC133 512 MB (PA3108U - 1 M 51)
    PC133 256 MB (PA3086U - 1 M 25)
    PC133 128 MB (PA3085U - 1 M 12)

    Good luck

  • Insert in varchar2 select xmltype column: extremely slow

    I use oracle10gR2 10.2.0.4 and solaris10 64bits

    I need to select the data to an xml value in a table of column xmltype (word.testmeta)

    and insert into another table (word.testwordyy)

    desc word.testmeta;
    Name                 Null?    Type
    --------------------------------------
    FILENAME             CHAR(2000)
    XMLDATA              XMLTYPE
    
    
    desc word.testwordyy;
    Name                 Null?    Type
    ---------------------------------------
    ID                   VARCHAR2(255)
    KEYWORD              VARCHAR2(4000)
    

    and I use xmltable

    insert /*+append */ into word.testwordyy(KEYWORD)
    select /*+ gather_plan_statistics */ dbms_lob.substr(xmltype.getclobval(b.KEWOR),254)
    from word.testmeta , xmltable
    (
    '$B/mets/KEWOR'
    passing
    word.testmeta.XMLDATA as B
    columns
    KEWOR xmltype path '/KEWOR/text()'
    )
    b
    

    > select * from table(dbms_xplan.display_cursor(null,null,'iostats last')); 
    
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------------------------------------------
    SQL_ID  37ua3npnxx8su, child number 0
    -------------------------------------
    insert /*+append */ into word.testwordyy(KEYWORD) select /*+ gather_plan_statistics */
    dbms_lob.substr(xmltype.getclobval(b.KEWOR),254) from word.testmeta , xmltable ( '$B/mets/KEWOR' passing word.testmeta.XMLDATA as
    B columns KEWOR xmltype path '/KEWOR/text()' ) b
    
    
    Plan hash value: 875848213
    
    
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------------------------------------------
    | Id  | Operation                           | Name                   | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  | Writes |
    
    
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    |   1 |  LOAD AS SELECT                     |                        |      1 |        |      1 |00:10:32.72 |   16832 |      7 |   90 |
    
    
    |   2 |   NESTED LOOPS                      |                        |      1 |     29M|  34688 |00:00:25.95 |   12639 |      5 |    0 |
    
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------------------------------------------
    |   3 |    TABLE ACCESS FULL                | TESTMETA               |      1 |   3638 |   3999 |00:00:00.08 |     909 |      0 |    0 |
    
    
    |   4 |    COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |   3999 |        |  34688 |00:00:24.50 |   11730 |      5 |    0 |
    
    
    -----------------------------------------------------------------------------------------------------------------------------------
    
    
    PLAN_TABLE_OUTPUT
    -----------------------------------------------------------------------------------------------------------------------------------
    Note
    -----
       - dynamic sampling used for this statement
    
    
    
    
    21 rows selected.
    

    and the more the number of rows in the word.testmeta table, the more time spent by rank

    I have a small simple XML but I need to process a large amount of them (5000000) as well as the treatment is very very slow when the lines of more than 8000

    Is there an optimization or the fastest?

    Why? Because you do a manipulation of LOB lob.

    Your XMLType is the kind of CLOB storage

    Your chain of subtr quantities are manipulationg LOB

    Altogether, the XML must be done in memory (XMLSEQUENCEFROMXMLTYPE), the manipulation of strings (CLOB) become bigger and bigger and bigger and will eat all your memory and CPU resources.

    How to solve it?

    Upgrade to a supported database version (11.2.0.3 and upwards)

    Store XML documents in a binary XML format of XMLType Securefile

    Use simple methods like XMLCAST to make the string conversion and manipulation

    Or...

    .. m:System.NET.HttpListener.start reading by doing the hard (and today with a version of database not supported), 10.2 through storage XMLType object / relational and convert you CLOB, XMLType storage for storing XMLType object / relational. Use the functions and operators that are created to make the manipulation of strings instead of DBMS_LOB Package (which is not free memory automatically)

  • External table - load a log file with more than 4000 bytes per column

    Hello
    I'm trying to import a log file into a database table that has a single column: txt_line
    In this column, I'm trying to fill out a log by record type entry. Each log entry is normally more than 4000 bytes in the outer table, it should be a clob.
    Below is a table of external work that works, but cut all entries after 4000 bytes. How is it is possible to directly load the data into a clob column? All I've found are descriptions where I have a clob-file by file.
    Any help is appreciated
    Thank you



    Source file
    .. more than 4000 bytes...]] .. .more Quen 4000 bytes...]] .. more than 4000 bytes.

    ]] ist the record delimiter

    External table:
    create the table TST_TABLE
    (
    txt_line varchar2 (4000)
    )
    external organization
    (type
    ORACLE_LOADER
    the default directory tmp_ext_tables
    (settings) access
    records delimited by a "]]"
    fields (txt_line char (4000))
    )
    location ("test5.log")
    )
    reject the limit 0
    ;

    user12068228 wrote:

    I'm trying to import a log file into a database table that has a single column: txt_line
    In this column, I'm trying to fill out a log by record type entry. Each log entry is normally more than 4000 bytes in the outer table, it should be a clob.
    Below is a table of external work that works, but cut all entries after 4000 bytes. How is it is possible to directly load the data into a clob column? All I've found are descriptions where I have a clob-file by file.
    Any help is appreciated
    . . . E t c...

    And what did you expect if you define the field source and target column as 4000 characters?

    Try this:

    CREATE TABLE tst_table
     (
       txt_line CLOB
     )
     ORGANIZATION EXTERNAL
     (TYPE oracle_loader
        DEFAULT DIRECTORY tmp_ext_tables
        ACCESS PARAMETERS (
           RECORDS DELIMITED BY ']]'
           FIELDS (txt_line CHAR(32000))
        )
      LOCATION ('test5.log')
     )
    REJECT LIMIT 0
    ;
    

    8 2

Maybe you are looking for

  • HP Media Drive hd5000s unrecognized.

    I have a HP Media 500 GB (hd5000s) which is no longer recognized by the computer in the Bay or as an external drive. I tried it on two computers with the same results. The fan works and the power light is on, but there is no light data. The drive is

  • Street and trips 2010 bugs are not able to search through the universal search bar?

    When I type the location of the Pushpins on the universal search bar, that it flashes and no results. BUT if I do a ctrl + f and select tab "place / data", and then type the location of bug it appears. I'm willing to type in the universal search bar

  • Vista administrator privileges is FUBAR, can help you with suggestions.

    OK, so here is the story. I have a homemade PC for my teenagers. It became slow and bogged downdown (they really loaded it with garbage)... then I copied offimportant documents and did a clean install with Windows Vista Edition basic family. I create

  • HP 2000-bf60CA - WIN 8 - System Service exception - tcpip.sys

    Hello my HP 2000-bf60CA started crashing about 5 minutes after it loads and I connect. He allways get the BSOD with the following error. tcpip.sys system_service_exception What are the steps I need to fill. I did a system restore to a point of restor

  • Local access only

    Recently, a friend of mine, using Windows Vista, configure their internet in their new home. Everyone, save itself, is able to connect to the network, including myself. We all, however, to use various versions of Win 7. I was not able to confirm if s