Analyze a clob column XML.
Dear SirI've been suffreing a problem about xml.
I have a table with two columns, one is given bfile another type is clob data type. A xml data is stored in the two plate
as clob, and bfile. My xml data format is correct.
When I took the xml data for the bfile column, dbms_xmlparser.parseClob properly analyze my xml data.
Code below:
=======================================
DBMS_LOB.CREATETEMPORARY (l_clob, cache = > FALSE);
DBMS_LOB.loadFromFile (dest_lob = > l_clob,)
src_lob = > l_bfile,
amount = > dbms_lob.getLength (l_bfile));
l_parser: = dbms_xmlparser.newParser;
dbms_xmlparser.parseClob (l_parser, l_clob); ========================================
But when I got the xml data are clob column directly, then dbms_xmlparser.parseClob analysis failed and go to the exception.
Code below:
====================================================================
DBMS_LOB.CREATETEMPORARY (l_clob, cache = > FALSE);
Select xml_cfile, xml_bfile
in l_clob, l_bfile
of xml_load_in
l_parser: = dbms_xmlparser.newParser;
dbms_xmlparser.parseClob (l_parser, l_clob); -has no analysis
====================================================================
declare
l_bfile BFILE.
l_clob CLOB.
l_parser dbms_xmlparser. Analyzer;
l_doc dbms_xmldom. DOMDocument;
Start
DBMS_LOB.CREATETEMPORARY (l_clob, cache = > FALSE);
Select xml_cfile, xml_bfile
in l_clob, l_bfile
of xml_load_in
l_parser: = dbms_xmlparser.newParser;
dbms_xmlparser.parseClob (l_parser, l_clob);
l_doc: = dbms_xmlparser.getDocument (l_parser);
DBMS_LOB.freeTemporary (l_clob);
dbms_xmlparser.freeParser (l_parser);
exception
DBMS_LOB.freeTemporary (l_clob);
dbms_xmlparser.freeParser (l_parser);
dbms_xmldom.freeDocument (l_doc);
End;
Example:
= - File_name: = Outward.xml;
CREATE OR REPLACE DIRECTORY
MY_INWARD AS
'D:\PBM\Inward\ ';
CREATE TABLE XML_LOAD_IN
(XML_CFILE, CLOB,
BFILE XML_BFILE
);
INSERT INTO XML_LOAD_IN (XML_CFILE, XML_BFILE)
VALUES)
' <? XML version = "1.0" encoding = "UTF-8"? >
< BACPSInterface >
< OCE >
< EHR >
< StandardLevel > 03 < / StandardLevel >
< TestFiledIndicator > T < / TestFiledIndicator >
< ImmediateDestRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ImmediateDestRoutingNumber >
< ImmediateOriginRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ImmediateOriginRoutingNumber >
< FileCreationDate > 20090714 < / FileCreationDate >
< > 1047 FileCreationTime < / FileCreationTime >
< ResendIndicator > N < / ResendIndicator >
< ECESettlementDate > 20090714 < / ECESettlementDate >
< ECESessionTime > 1047 < / ECESessionTime >
< ECESettlementTime > 1047 < / ECESettlementTime >
< ECEtype > 01 < / ECEtype >
< CountryCode > BD < / CountryCode >
< / EHR >
< collection >
< CHR >
< CashLetterBusinessDate > 20090714 < / CashLetterBusinessDate >
< CashLetterCreationDate > 20090714 < / CashLetterCreationDate >
< CashLetterCreationTime > 1047 < / CashLetterCreationTime >
< CashLetterRecordTypeInd > I < / CashLetterRecordTypeInd >
< CashLetterDocTypeIndicator > G < / CashLetterDocTypeIndicator >
< CashLetterID > 1 < / CashLetterID >
Bank of Asia < OriginatorContactName > < / OriginatorContactName >
< OriginatorContactPhoneNumber > XXX < / OriginatorContactPhoneNumber >
< / CHR >
< ForwardBundle >
< BHR >
< CollectionTypeIndicator > I < / CollectionTypeIndicator >
< DestRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / DestRoutingNumber >
< ECEInstitutionRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ECEInstitutionRoutingNumber >
< BundleBusinessDate > 20090714 < / BundleBusinessDate >
< BundleCreationDate > 20090714 < / BundleCreationDate >
< BundleID > 1 < / BundleID >
< ReturnLocationRoutingNumber > 070127538 < / ReturnLocationRoutingNumber >
< / BHR >
< CDR >
< CDR num = "1" >
< ECESettlementDate > 20090714 < / ECESettlementDate >
< ECESessionTime > 1047 < / ECESessionTime >
< ECESettlementTime > 1047 < / ECESettlementTime >
< ECEItemType > N < / ECEItemType >
< IssuingBranchRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / IssuingBranchRoutingNumber >
< AccountNumber > 0000334008221 < / account number >
< ChequeSequenceNumber > 1601735 < / ChequeSequenceNumber >
< ItemAmount > 500 < / ItemAmount >
< ECEInstitutionItemSequencNum > 0701275380000001 < / ECEInstitutionItemSequencNum >
< DocumentationTypeIndicator > I < / DocumentationTypeIndicator >
< ReturnAcceptanceIndicator > 6 < / ReturnAcceptanceIndicator >
< MICRValidIndicator > 1 < / MICRValidIndicator >
< BOFDIndicator > Y < / BOFDIndicator >
< ChequeDetailRecAddendumCount > 0 < / ChequeDetailRecAddendumCount >
< CorrectionIndicator > 0 < / CorrectionIndicator >
< RepresentmentIndicator > 0 < / RepresentmentIndicator >
< ArchiveTypeIndicator > F < / ArchiveTypeIndicator >
< / CDR >
< CDR num = "2" >
< ECESettlementDate > 20090714 < / ECESettlementDate >
< ECESessionTime > 1047 < / ECESessionTime >
< ECESettlementTime > 1047 < / ECESettlementTime >
< ECEItemType > N < / ECEItemType >
< IssuingBranchRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / IssuingBranchRoutingNumber >
< AccountNumber > 0000345682256 < / account number >
< ChequeSequenceNumber > 1234567 < / ChequeSequenceNumber >
< ItemAmount > 1000 < / ItemAmount >
< ECEInstitutionItemSequencNum > 0701275380000002 < / ECEInstitutionItemSequencNum >
< DocumentationTypeIndicator > I < / DocumentationTypeIndicator >
< ReturnAcceptanceIndicator > 6 < / ReturnAcceptanceIndicator >
< MICRValidIndicator > 1 < / MICRValidIndicator >
< BOFDIndicator > Y < / BOFDIndicator >
< ChequeDetailRecAddendumCount > 0 < / ChequeDetailRecAddendumCount >
< CorrectionIndicator > 0 < / CorrectionIndicator >
< RepresentmentIndicator > 0 < / RepresentmentIndicator >
< ArchiveTypeIndicator > F < / ArchiveTypeIndicator >
< / CDR >
< / CDR >
ADC <>
< CDA num = "1" >
< AddendumRecordNumber > 1 < / AddendumRecordNumber >
< BOFDRoutingNumber >
< code > 070 < / code >
< DistrictCode > 75 < / DistrictCode >
< > 12 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / BOFDRoutingNumber >
< BOFDBusinessEndorsementDate > 20090714 < / BOFDBusinessEndorsementDate >
< BOFDDepositAccountNumber > 0000334008221 < / BOFDDepositAccountNumber >
< BOFDDepositBranch > 753 < / BOFDDepositBranch >
< PayeeName > XXX < / PayeeName >
< TruncationIndicator > Y < / TruncationIndicator >
< BOFDConversionIndicator > 2 < / BOFDConversionIndicator >
< BOFDCorrectionIndicator > 0 < / BOFDCorrectionIndicator >
< / CDA >
< CDA num = "2" >
< AddendumRecordNumber > 1 < / AddendumRecordNumber >
< BOFDRoutingNumber >
< code > 070 < / code >
< DistrictCode > 75 < / DistrictCode >
< > 12 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / BOFDRoutingNumber >
< BOFDBusinessEndorsementDate > 20090714 < / BOFDBusinessEndorsementDate >
< BOFDDepositAccountNumber > 0000345682256 < / BOFDDepositAccountNumber >
< BOFDDepositBranch > 753 < / BOFDDepositBranch >
< PayeeName > XXX < / PayeeName >
< TruncationIndicator > Y < / TruncationIndicator >
< BOFDConversionIndicator > 2 < / BOFDConversionIndicator >
< BOFDCorrectionIndicator > 0 < / BOFDCorrectionIndicator >
< / CDA >
< / CDA >
< CDC >
< CDC num = "1" >
< AddendumCRecordNumber > 1 < / AddendumCRecordNumber >
< EndorsingBankRountingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / EndorsingBankRountingNumber >
< EndorsingBankEndorsementDate > 20090714 < / EndorsingBankEndorsementDate >
< EndorsingBankEndorsementDate > 20090714 < / EndorsingBankEndorsementDate >
< EndorsingBankItemSequenceNum > 0701275380000001 < / EndorsingBankItemSequenceNum >
< TruncationIndicator > Y < / TruncationIndicator >
< EndorsingBankConversionInd > 2 < / EndorsingBankConversionInd >
< EndorsingBankCorrectionInd > 0 < / EndorsingBankCorrectionInd >
< / CDC >
< CDC num = "2" >
< AddendumCRecordNumber > 1 < / AddendumCRecordNumber >
< EndorsingBankRountingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / EndorsingBankRountingNumber >
< EndorsingBankEndorsementDate > 20090714 < / EndorsingBankEndorsementDate >
< EndorsingBankEndorsementDate > 20090714 < / EndorsingBankEndorsementDate >
< EndorsingBankItemSequenceNum > 0701275380000002 < / EndorsingBankItemSequenceNum >
< TruncationIndicator > Y < / TruncationIndicator >
< EndorsingBankConversionInd > 2 < / EndorsingBankConversionInd >
< EndorsingBankCorrectionInd > 0 < / EndorsingBankCorrectionInd >
< / CDC >
< / CDC >
< DIV >
< DIV num = "1" >
< ImageIndicator > 1 < / ImageIndicator >
< ImageCreatorRountingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ImageCreatorRountingNumber >
< ImageCreatorDate > 20090714 < / ImageCreatorDate >
< ImageViewFormatIndicator > 0 < / ImageViewFormatIndicator >
< ImageViewCompressionAlg > 0 < / ImageViewCompressionAlg >
< ViewSideIndicator > 0 < / ViewSideIndicator >
< ViewDescriptor > 0 < / ViewDescriptor >
< DigitalSignatureIndicator > 1 < / DigitalSignatureIndicator >
< DigitalSignatureMethod > 0 < / DigitalSignatureMethod >
< SecurityKeySize > 12235 < / SecurityKeySize >
< ImageRecreateIndicator > 0 < / ImageRecreateIndicator >
< / DIV >
< DIV num = "2" >
< ImageIndicator > 1 < / ImageIndicator >
< ImageCreatorRountingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ImageCreatorRountingNumber >
< ImageCreatorDate > 20090714 < / ImageCreatorDate >
< ImageViewFormatIndicator > 0 < / ImageViewFormatIndicator >
< ImageViewCompressionAlg > 0 < / ImageViewCompressionAlg >
< ViewSideIndicator > 0 < / ViewSideIndicator >
< ViewDescriptor > 0 < / ViewDescriptor >
< DigitalSignatureIndicator > 1 < / DigitalSignatureIndicator >
< DigitalSignatureMethod > 0 < / DigitalSignatureMethod >
< SecurityKeySize > 12235 < / SecurityKeySize >
< ImageRecreateIndicator > 0 < / ImageRecreateIndicator >
< / DIV >
< / DIV >
< IVT >
< IVT num = "1" >
< ECEInstitutionRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ECEInstitutionRoutingNumber >
< BundleBusinessDate > 20090714 < / BundleBusinessDate >
< Cyclenumber(1,3) > 0 < / Cyclenumber(1,3) >
< ECEInstitutionItemSeqNumber > 0701275380000001 < / ECEInstitutionItemSeqNumber >
< ClippingOrigin >
< source > 0 < / original >
< CoordinateH1 > 0000 < / CoordinateH1 >
< CoordinateH2 > 0000 < / CoordinateH2 >
< CoordinateV1 > 0000 < / CoordinateV1 >
< CoordinateV2 > 0000 < / CoordinateV2 >
< / ClippingOrigin >
< LengthofImageReferenceKey > 0 < / LengthofImageReferenceKey >
< LengthofDigitalSignature > 0 < / LengthofDigitalSignature >
< LengthofImageData > 1 < / LengthofImageData >
< OffsetToImageData > 01001000 < / OffsetToImageData >
< / IVT >
< IVT num = "2" >
< ECEInstitutionRoutingNumber >
< code > 070 < / code >
< DistrictCode > 12 < / DistrictCode >
< > 75 BranchCode < / BranchCode >
< > 8 CheckDigit < / CheckDigit >
< / ECEInstitutionRoutingNumber >
< BundleBusinessDate > 20090714 < / BundleBusinessDate >
< Cyclenumber(1,3) > 0 < / Cyclenumber(1,3) >
< ECEInstitutionItemSeqNumber > 0701275380000002 < / ECEInstitutionItemSeqNumber >
< ClippingOrigin >
< source > 0 < / original >
< CoordinateH1 > 0000 < / CoordinateH1 >
< CoordinateH2 > 0000 < / CoordinateH2 >
< CoordinateV1 > 0000 < / CoordinateV1 >
< CoordinateV2 > 0000 < / CoordinateV2 >
< / ClippingOrigin >
< LengthofImageReferenceKey > 0 < / LengthofImageReferenceKey >
< LengthofDigitalSignature > 0 < / LengthofDigitalSignature >
< LengthofImageData > 1 < / LengthofImageData >
< OffsetToImageData > 01001000 < / OffsetToImageData >
< / IVT >
< / IVT >
< IVA >
< IVA num = "1" >
< GlobalImageQuality > 0 < / GlobalImageQuality >
< GlobalImageUsability > 1 < / GlobalImageUsability >
< ImagingBankSpecificTest > 1 < / ImagingBankSpecificTest >
< / IVA >
< IVA num = "2" >
< GlobalImageQuality > 0 < / GlobalImageQuality >
< GlobalImageUsability > 1 < / GlobalImageUsability >
< ImagingBankSpecificTest > 1 < / ImagingBankSpecificTest >
< / IVA >
< / IVA >
< BCR >
< ItemsWithinBundleCount > 2 < / ItemsWithinBundleCount >
< BundleTotalAmount > 1500 < / BundleTotalAmount >
< MICRValidTotalAmount > 1500 < / MICRValidTotalAmount >
< / BCR >
< / ForwardBundle >
< COST >
< BundleCount > 1 < / BundleCount >
< ItemWithinCashLetterCount > 2 < / ItemWithinCashLetterCount >
< CashLetterTotalAmount > 1500 < / CashLetterTotalAmount >
< ImagesWithinCashLetterCount > 2 < / ImagesWithinCashLetterCount >
Bank of Asia < ECEInstitutionName > < / ECEInstitutionName >
< SettlementDate > 20090714 < / SettlementDate >
< / CCR >
< / collection >
< REC >
< CashLetterCount > 1 < / CashLetterCount >
< TotalRecordCount > 2 < / TotalRecordCount >
< TotalItemCount > 2 < / TotalItemCount >
< FileTotalAmount > 1500 < / FileTotalAmount >
Bank of Asia < ImmediateOriginContactName > < / ImmediateOriginContactName >
< ImmediateOriginContactNumber > XXX < / ImmediateOriginContactNumber >
< / REC >
< / OCE >
< / BACPSInterface > '
BFILENAME ('MY_INWARD', 'Outward.xml'));
COMMIT;
What version of Oracle (4 digits) and what is the error?
It runs without error on 10.2.0.4 (although you can go directly from a CLOB to a DOMDocument via dbms_xmldom)
-- Created on 9/14/2009 by JH20567
declare
-- Local variables here
l_clob CLOB;
l_parser dbms_xmlparser.Parser;
l_doc dbms_xmldom.DOMDocument;
begin
-- Test statements here
l_clob := '
03
T
070
12
75
8
070
12
75
8
20090714
1047
N
20090714
1047
1047
01
BD
20090714
20090714
1047
I
G
1
Bank Asia
XXX
I
070
12
75
8
070
12
75
8
20090714
20090714
1
070127538
20090714
1047
1047
N
070
12
75
8
0000334008221
1601735
500
0701275380000001
I
6
1
Y
0
0
0
F
20090714
1047
1047
N
070
12
75
8
0000345682256
1234567
1000
0701275380000002
I
6
1
Y
0
0
0
F
1
070
75
12
8
20090714
0000334008221
753
XXX
Y
2
0
1
070
75
12
8
20090714
0000345682256
753
XXX
Y
2
0
1
070
12
75
8
20090714
20090714
0701275380000001
Y
2
0
1
070
12
75
8
20090714
20090714
0701275380000002
Y
2
0
1
070
12
75
8
20090714
0
0
0
0
1
0
12235
0
1
070
12
75
8
20090714
0
0
0
0
1
0
12235
0
070
12
75
8
20090714
0
0701275380000001
0
0000
0000
0000
0000
0
0
1
01001000
070
12
75
8
20090714
0
0701275380000002
0
0000
0000
0000
0000
0
0
1
01001000
0
1
1
0
1
1
2
1500
1500
1
2
1500
2
Bank Asia
20090714
1
2
2
1500
Bank Asia
XXX
';
l_parser := dbms_xmlparser.newParser;
dbms_xmlparser.parseClob(l_parser, l_clob);
l_doc := dbms_xmlparser.getDocument(l_parser);
dbms_lob.freetemporary(l_clob);
dbms_xmlparser.freeParser(l_parser);
dbms_xmldom.freeDocument(l_doc);
end;
Tags: Oracle Development
Similar Questions
-
Ask the CLOB column (with XML content)
1. how to extract a particular xml tag value for a column with the CLOB data type.
Example:
< REQUEST_DETAIL >
PR < GROUP_TYPE > < / GROUP_TYPE >
< GroupName > ASSET MANAGEMENT TECHNICAL DATA < / GroupName >
< BUS_UNIT_ACRN > SCS-FCAT < / BUS_UNIT_ACRN >
< PROJ_MGR_ID > < / PROJ_MGR_ID >
< PROJ_MGR_NAME > Roland Roy < / PROJ_MGR_NAME >
< / REQUEST_DETAIL >
Select
XmlType (provable). Extract('/REQUEST_DETAIL/GROUP_TYPE/text()').getStringVal)
e t
/
example above works.
If I do not know the order of xml tag to ask how can I get the value.
(/ * * / / * * / REQUEST_DETAIL/GROUP_TYPE / * / *)
2 using the DBMS_LOB. SUBSTR takes longer to run and it never returns results and session will wait status for access to LOB_INDEX content (at the same time the CLOB column is used by the application).
Y at - it another option for faster results.
SELECT DBMS_LOB. SUBSTR (xml_blob, 4, DBMS_LOB.) INSTR (xml_blob, "< name >", 1, 1) + 6) name.
status,
CNT to COUNT (*)
OF LOG_TBL
WHEN TRUNC (IO_DATE) = TRUNC (SYSDATE)
GROUP OF DBMS_LOB. SUBSTR (xml_blob, 4, DBMS_LOB.) INSTR (xml_blob, "< name >", 1, 1) + 6),
status
Kind regards
Veera
Adiitional your reuirement to omit the public areas
2729533 wrote:
Your 1 returln sql any domain name (p099 and public - seems to search all nodes in an xml file). I only need 1 domain name (and omit the public areas)
- SELECT X.*
- T
- , xmltable ('(//*[DomainName!="PUBLIC"]/DomainName) [1] ')
- PASSAGE xmlparse (document t.XML_BLOB)
- THE DOMAIN VARCHAR2 COLUMNS (15) PATH '.'
- ) X
- where t.no = 317663815
-
Query to read the XML of the CLOB column
Hello
I want a SQL to get the following information extracted a CLOB column.
MasterReport/sg:RptDef/sg:RptCell@RealDesc MasterReport/sg:RptDef/sg:RptCell@RealNum
100 credits
flow rates from 100
Example of XML data in the column of table is:
<? XML version = "1.0" encoding = "UTF-8"? >
< MasterReport xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:sg = "http://www.oracle.com/fsg/2002-03-20/" xsi: schemaLocation = "http://www.oracle.com/2002-03-20/fsg.xsd" >
Vision Portugal < sg:LDGName > < / sg:LDGName >
Vision Portugal < sg:SOBName > < / sg:SOBName >
Vision Portugal < sg:DataAccessSetName > < / sg:DataAccessSetName >
Model report 30 < sg:InternalReportName > < / sg:InternalReportName >
< sg:CustomParam10 / >
< sg:RowContext RowId = "r100001" >
< sg:RowName / >
disputes credits - Total amount previous period < sg:RowLineItem > < / sg:RowLineItem >
< sg:RowDispUnit > 1 < / sg:RowDispUnit >
< sg:RowDispFormat / >
< sg:RowUnitOfMeasure > EUR < / sg:RowUnitOfMeasure >
< sg:RowLedgerCurrency > ALL < / sg:RowLedgerCurrency >
< sg:RowCurrencyType > T < / sg:RowCurrencyType >
< sg:RowChangeSign > 0 < / sg:RowChangeSign >
< sg:RowSeq > 1.0000000000000 < / sg:RowSeq >
< / sg:RowContext >
< sg:RowContext RowId = "r100002" >
< sg:RowName / >
< sg:RowLineItem > Litigation credits-taxed amounts of Column2 for the previous period < / sg:RowLineItem >
< sg:RowDispUnit > 1 < / sg:RowDispUnit >
< sg:RowDispFormat / >
< sg:RowUnitOfMeasure > EUR < / sg:RowUnitOfMeasure >
< sg:RowLedgerCurrency > ALL < / sg:RowLedgerCurrency >
< sg:RowCurrencyType > T < / sg:RowCurrencyType >
< sg:RowChangeSign > 0 < / sg:RowChangeSign >
< sg:RowSeq > 2.0000000000000 < / sg:RowSeq >
< / sg:RowContext >
< sg:ColContext ColId = "c1000" >
< sg:ColAmountType / >
< sg:ColPeriod / >
< sg:ColPerOffset / >
< sg:ColChangeSign / >
< sg:ColPosition / >
< sg:ColSeq / >
< sg:ColWidth > 100 < / sg:ColWidth >
< / sg:ColContext >
< sg:ColContext ColId = "c1001" >
Total of < sg:ColName > < / sg:ColName >
< sg:ColDescr / >
< sg:ColDispUnit > 1 < / sg:ColDispUnit >
< sg:ColUnitOfMeasure > EUR < / sg:ColUnitOfMeasure >
< sg:ColLedgerCurrency > ALL < / sg:ColLedgerCurrency >
< sg:ColCurrencyType > T < / sg:ColCurrencyType >
< sg:ColDispFormat > 999999999.99 < / sg:ColDispFormat >
CDA-real < sg:ColAmountType > < / sg:ColAmountType >
< sg:ColPerOffset > 0 < / sg:ColPerOffset >
< sg:ColAmntId > 14 < / sg:ColAmntId >
< sg:ColParamId >-1 < / sg:ColParamId >
A < sg:ColType > < / sg:ColType >
< sg:ColStyle > B < / sg:ColStyle >
< sg:ColPeriod > 10 / 08 < / sg:ColPeriod >
< sg:ColPeriodYear > 2008 < / sg:ColPeriodYear >
< sg:ColPeriodNum > 11 < / sg:ColPeriodNum >
< sg:ColPeriodStart > 2008 - 10-01 T 00: 00:00 < / sg:ColPeriodStart >
< sg:ColPeriodEnd > 2008-10-31 T 00: 00:00 < / sg:ColPeriodEnd >
< sg:ColChangeSign > 0 < / sg:ColChangeSign >
the totals of < sg:ColHeadLine1 > < / sg:ColHeadLine1 >
< sg:ColHeadLine2 / >
< sg:ColHeadLine3 / >
< sg:ColHeadLine4 / >
< sg:ColHeadLine5 / >
< sg:ColHeadLine6 / >
< sg:ColHeadLine7 / >
< sg:ColHeadLine8 / >
< sg:ColHeadLine9 / >
< sg:ColPosition > 99 < / sg:ColPosition >
< sg:ColSeq > 1.0000000000000 < / sg:ColSeq >
< sg:ColWidth > 14 < / sg:ColWidth >
< / sg:ColContext >
"< sg:RptDef RptId = 'p1001" RptDetName = "book = PT Vision (Vision Portugal)" RptPESegm = "" RptPEVal = "" RptTabLabel = "Exit 1 (Vision PT)" > "
< sg:RptLine RptCnt = 'p1001"RowCnt ="r100001"LineRowSeq ="1.0000000000000"LinCnt ="l100001">
< sg:RptCell ColCnt RealDesc "c1000" = "flows" = > flow < / sg:RptCell >
< sg:RptCell ColCnt "c1001' RealNum = '100.000000' = > 100,00 < / sg:RptCell >
< / sg:RptLine >
< sg:RptLine RptCnt = 'p1001"RowCnt ="r100002"LineRowSeq ="2.0000000000000"LinCnt ="l100002">
< sg:RptCell ColCnt = "c1000" RealDesc = "creditsd" > credits < / sg:RptCell >
< sg:RptCell ColCnt "c1001' RealNum = '100.000000' = > 100,00 < / sg:RptCell >
< / sg:RptLine >
< / sg:RptDef >
< sg:TabCount > 1 < / sg:TabCount >
< / MasterReport >
Please help me.
Concerning
Goussard
Published by: user576087 on March 18, 2012 23:54I don't know if you want that the values of the attribute or the element, but it should give you a good start:
SQL> alter session set nls_numeric_characters = ".,"; Session altered SQL> SQL> select x.* 2 from my_table t 3 , xmltable( 4 xmlnamespaces('http://www.oracle.com/fsg/2002-03-20/' as "sg") 5 , '/MasterReport/sg:RptDef/sg:RptLine' 6 passing xmltype(t.xmldoc) 7 columns type varchar2(30) path 'sg:RptCell[1]' 8 , amount number path 'sg:RptCell[2]' 9 ) x 10 ; TYPE AMOUNT ------------------------------ ---------- debits 100 credits 100
-
Insert the string xml in a clob column. ??
https://drive.Google.com/file/d/0BwAVQqYmX0-zMHZiS1F0SVdOMmc/view?USP=sharing
DECLARE v_clob CLOB := to_clob('xml string from local file'); --pls. download xml file from above url; stmt NVARCHAR2(500) := 'INSERT INTO TEST(XMLDATA) VALUES(:x)'; BEGIN EXECUTE IMMEDIATE stmt USING v_clob; END;
If I use xmltype so I can use XMLType (bfilename ('test_dir', '"Data.xml" '), nls_charset_id ('AL32UTF8'))
but I have to use clob for storing the xml string. because oracle xmltype cannot correctly parse these xml data. ;
Google search for 'oracle insert clob from the file' would you find this answer fairly quickly.
You don't need to use dynamic sql statements.
-
CLOB in XML a better approach normal table?
Hello
Requirements:
(1) I have a table that has records of 15 m and each record have a XML stored in a CLOB format (each xml is AVG 25 KB).
(2) information in this table should be used for reporting the end (currently no OLAP structure).
3) there are many areas in XML that is not necessary to run queries.
(4) we intend to extract necessary fields from XML and then store them in the normal table format to make quick and simple queries (should store us as XML).
(5) how should I proceed with this. I've not used XML in the past.
Currently, we give xml data to the Java application as a batch and then Java application is extract necessary fields and then store them in the final table. What is the best with regard to the performance of the migration also? Should I convert CLOB in XML and stored in the staging of the table and then select the required fields of staging table using XML DB and then load in the final table?
The main purpose is quick retrivel of the final table.
Thank you.
Published by: dbdan on Sep 2, 2011 07:23
Published by: dbdan on Sep 4, 2011 23:11
Typos correctedHello
I would say that approach 2, with a table binary XMLType.
For example, suppose that the source table is TEMP_XML_CLOB and contains this structure XML documents in the donnees_xml (CLOB) column:
1 TEST 1 A1234-B 2 Z5554-E 7 B1234-A 1 (1) first create the table XMLType:
create table temp_xml_binary of xmltype xmltype store as securefile binary xml ;
(2) the source table bulk insert:
insert into temp_xml_binary (object_value) select /*+ append */ xmltype(xml_data) from temp_xml_clob ; commit;
(3) question the XML as relational data:
SQL> select x1.id 2 , x1.description 3 , x2.item_id 4 , x2.item_type 5 , x2.quantity 6 from temp_xml_binary t 7 , xmltable( 8 xmlnamespaces(default 'example.oracle.com') 9 , '/root' 10 passing t.object_value 11 columns id number path 'header/id' 12 , description varchar2(80) path 'header/des' 13 , items xmltype path 'items' 14 ) x1 15 , xmltable( 16 xmlnamespaces(default 'example.oracle.com') 17 , '/items/item' 18 passing x1.items 19 columns item_id varchar2(30) path 'id' 20 , item_type varchar2(2) path '@type' 21 , quantity number path 'quantity' 22 ) x2 23 ; ID DESCRIPTION ITEM_ID ITEM_TYPE QUANTITY ---------- --------------------- ------------------------------ --------- ---------- 1 TEST 1 A1234-B A1 2 1 TEST 1 Z5554-E B1 7 1 TEST 1 B1234-A A1 1
If you encounter some performance issues with this method, you can also try to create an additional index of XML structured:
http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e16659/xdb_indexing.htm#BCGHGIGCPublished by: odie_63 on 5 September. 2011 12:38
-
Insertion XMLAgg large output in a table with a CLOB column
Hello
I need to fill a CLOB column in a table with the output of a query select using XMLAgg which returns a string length exceeds the maximum length of the SQL 32767octets.
The table I ask has 300,000 lines I need to create an XML file. When I apply the query below (without XMLAgg) I get 300 000 lines that each of the 134 characters each. However, when I add the XMLAgg I can't select the results as XMLAgg concatenates my 300,000 lines in a single line, where a length of string is too long for SQL.
SELECT (XMLElement ("line", XMLELEMENT ('cell', XMLATTRIBUTES ('XML_TAG_1' "colName"), attribute1)
XMLELEMENT ('cell', XMLATTRIBUTES ('XML_TAG_2' "colName"), attribut2)
XMLELEMENT ('cell', XMLATTRIBUTES ('XML_TAG_3' "colName"), attribut3))
)
of XML_TAGS_TABLE
-Produces 300,000 lines like below
< row > < cell colName = "XML_TAG_1" > 12345 < / cell > < cell colName = "XML_TAG_2" > abcdef < / cell > < cell colName = "XML_TAG_3" > 123xyz < / cell > < / row >
With this in mind, I created a temporary table (TEMP_TAB_TEST) with a column called XML_ROW that is a CLOB. Applying XMLAgg in the above query, I would get 300,000 lines concatenated into a string. I need to get the single string output in the XML_ROW (CLOB) column XMLAgg while I can then convert them to the XML file.
I don't see how I can use XMLAgg due to the length of the output it produces? Is there a way I can fill the column clob using the XMLAgg is the result of a PL/SQL package / block Anon?
Thank you very much
Simon.It works for me:
CREATE TABLE TESTCLOB (ID NUMBER, DATA CLOB); insert into testclob ( id, data ) values ( 1, (SELECT XMLTYPE.getClobVal(XMLAGG( XMLElement("row", XMLELEMENT("cell", XMLATTRIBUTES('XML_TAG_1' COL1),attribute1) ,XMLELEMENT("cell", XMLATTRIBUTES('XML_TAG_2' COL2) ,attribute2) ,XMLELEMENT("cell", XMLATTRIBUTES('XML_TAG_3' COL3),attribute3)) ) ) from (SELECT 'XXXXX' attribute1, 'xxxxxx' attribute2, 'yyyyyyy' attribute3 from dual connect by level<1000000) ) ); SELECT ID, DBMS_LOB.GETLENGTH(DATA) FROM TEXTCLOB; ID DBMS_LOB.GETLENGTH(DATA) ---------------------- ------------------------ 1 118999881
-
Not able to load csv file CLOB columns in table
Hello
I'm trying to load a table with the Source file CLOB columns which is in .csv format. I get the following messages
"SQL * Loader-292: setting LINES ignored when an XML, VARRAY or LOB column is loaded.
Can anyone help me on how to proceed with my load of data.
Thank you!!!Hello
Ignore "SQL * Loader-292: setting LINES ignored when loading an XML, VARRAY or LOB column" error
After you import your csv file just change the length CHAR (100000).
ex: your column col1 CHAR (1000) to change CHAR (100000).
and deploy your mapping and execution
Kind regards
Vincent -
How can I make sure that a CLOB column is unique
I have a table with a CLOB column I want to ensure is unique. If the column is VARCHAR2 I could use a unique index.
Plan B is a TRIGGER (BEFORE INSERT OR UPDATE ON < table > FOR EACH ROW) with WHERE the dbms_lob.compare (en.text,: NEW.text) = 0; But that transforms
Oracle 12 c Standard Edition
Don't use ORA_HASH, use DBMS_CRYPTO. HASH...
SQL > CREATE TABLE test_table
() 2
3 data_clob CLOB,
4 num NUMBER,
5 hash_val GENERATED ALWAYS AS (sys. DBMS_CRYPTO. HASH(data_clob, 3 /* HASH_SH1 */))
6 );Table created.
SQL > CREATE A UNIQUE TEST_IDX INDEX
2. WE test_table (hash_val);The index is created.
SQL > INSERT INTO TEST_TABLE (DATA_CLOB, NUM)
2 VALUES ('TEST', 1);1 line of creation.
SQL > COMMIT;
Validation complete.
SQL > INSERT INTO TEST_TABLE (DATA_CLOB, NUM)
2 VALUES ('TEST', 1);
INSERT INTO TEST_TABLE (DATA_CLOB, NUM)
*
ERROR on line 1:
ORA-00001: unique constraint (SCOTT. TEST_IDX) violated -
Hi all
DB version: Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production (PL/SQL Release 11.2.0.4.0 - Production)
Brief Description: column CLOB audit until anonymous PLSQL block but does not update an external application (such as a web application).
More in detail, we have a base with a CLOB column table and an audit table that captures any change on the base table using a trigger of DB.
Table audit this as below:
ID NOT NULL NUMBER (38) COMPONENT_KEY THE NUMBER OF NON-NULL CHANGEDCOLUMNNAME VARCHAR2 (30) CHANGEDBY VARCHAR2 (20) CHANGEDDATE DATE BEFORECHANGE CLOB EVENT CLO We observe that the audit works perfectly fine if we update the prompt SQL CLOB column. But when the column is updated. a web UI - the trigger retrieves the value of
:OLD.CLOB_COLUMN
and reads an empty clob
:NEW.CLOB_COLUMN
.
Possible explanation: read in-depth, including that CLOB actuallly stores the reference to memory location & database manages insertions/changes effectively CLOB columns by first introducing an EMPTY_CLOB and then subsequently using DBMS_LOB. Write() for transmitting the content of CLOB to the location of the DB. DB trigger seems to be pulled between the insert EMPTY_CLOB & the DBMS_LOB. Write() and accordingly, we find that: NEW. CLOB_COLUMN to be EMPTY_CLOB.
The above explanation makes sense? If so, why does it work correctly from the SQL prompt? Can we not check a DB trigger CLOB columns at all?
Thank you
Srini
On additional debugging, it seems not to be a problem with the database. She seems to be the implementation of JDBC for CLOB data types - where it is a 2-step process
STEP 1 - Insert EMPTY_CLOB
STEP 2 - lock the line & enter the stream to broadcast content to CLOB CLOB.
Given that triggers executed immediately after STEP 1 - the NEW value is EMPTY. Here, the concepts of database are intact. In this case, the check must arrive at the JDBC layer.
-
The number of characters in the CLOB column is supported by the report of the APEX
Hello
Actually, I have a report of the Apex based on CLOB column, which includes data whose length exceeds 10,000 characters.
up to 10,000 characters, it works fine, but once it get records with characters more than 10 + lift
ORA-06502: PL/SQL: digital or value error: character string buffer too small
Thank you and best regards,
Ashish
2902196 wrote:
Please update your forum profile with a recognizable username instead of "2902196": Video tutorial how to change username available
Always include the information referred to in these guidelines when you post a question: How to get the answers from the forum
Actually, I have a report of the Apex based on CLOB column, which includes data whose length exceeds 10,000 characters.
up to 10,000 characters, it works fine, but once it get records with characters more than 10 + lift
ORA-06502: PL/SQL: digital or value error: character string buffer too small
The maximum size of a column report CLOB value is 32 KB. However, the maximum size for the content of the line of the full report is also 32 KB (including the HTML markup), so you can be hitting this limit because of the size of your 10 K CLOB data + the rest of the line.
According to the database character set and the characters which that contains data, the character encoding may use more than one byte to represent a character.
-
Download file in/from DB Oracle Clob column
Hello
12.1.3 Jdev
I have a database table that has a Clob column to store the file and a varchar2 column to store the file name.
I want to have a screensaver to download files in this table.
Would like to know the best way to achieve this functionality.
See you soon
AJ
The files are usually stored in BLOB column (and not on the CLOB type)
Here is an example that you can follow: https://tompeez.wordpress.com/2011/11/26/jdev11-1-2-1-0-handling-imagesfiles-in-adf-part-2/
Dario
-
contains the clause in the search for interactive report of a clob column
Hello
I use the Version APEX 4.2.4.00.08
How to use an interactive report contains the when searching a clob column so that it uses the CONTEXT index?
Thank you
Chandra.
I wrote it in the SQL used for IR
I created an APEX application that stores all our it's the HOWTO documents. (word, excel, pdf)
ctx_doc.snippet creates the HTML code.
select D.doc_id ,D.doc_filename ,dbms_lob.getLength( D.doc_blob ) as download ,decode( :P12_SEARCH, null, '-- nothing --', ctx_doc.snippet( 'IT_DATA.DOC_CTX_IX' -- my Oracle Text index name , D.doc_id, :P12_SEARCH ) ) as snippet from it_data.documents D where :P12_SEARCH is null or contains( D.doc_blob, :P12_SEARCH ) > 0
MK
-
Getting string of a CLOB column
Hi team,
I have a problem. as if I had the table that contains a CLOB column. Since I need to extract exactly a word string. I'll give an example on how it will be below.
Let T_OBJ of Table has a WORK_LOG column that is a CLOB.
The CLOB data is huge, but since I need to extract a string, containing the name that falls exactly after a WORD
Create table T_OBJ (SNO number, WORK_LOG clob);
Insert into T_OBJ values (1, '1263636000 AR_ESCALATOR. amended by XXXXXXXXX XXXX ("This is Auto Closed.Change was closed")
How is the sample data. But what I found most is there are the delimiters in the text. A delimiter is exactly after name i.e. XXXXXXXX XXXX (delimiter)
My output should be one name i.e. XXXXXXXX XXXX, which falls immediately after the text "modified by".
I tried like this
Select dbms_lob.substr (WORK_LOG, 50, dbms_lob.instr (WORK_LOG, "modified by"))
of T_OBJ;
Can someone help me please. I'm using ORACLE 11 g.
Hello
Check if the query below matches your needs.
SELECT dbms_lob.substr(WORK_LOG ,((dbms_lob.instr(WORK_LOG,'.',dbms_lob.instr(WORK_LOG,'Modified By ')))- --- get position of DELIMITER AFTER MODIFIED BY (dbms_lob.instr(WORK_LOG,'Modified By ')+length('Modified By '))) --- get position of MODIFIED BY ,dbms_lob.instr(WORK_LOG,'Modified By ')+length('Modified By ')) --- get position of MODIFIED BY FROM t_obj;
-
Read CLOB column - by bursting
I have two tables File_Master and File_Detail
Primary key File_Master FILE_ID
Primary key File_Detail FILE_ID, LINE_ID
I have a CLOB FILE_CONTENT column table File_Master.
For each record FILE_ID in File_Master, hundreds of lines are stored in the CLOB column.
I want to read this 'File_Content' CLOB column and and break each line (1000 characters)
by pieces to fill the columns in File_Detail.
Since there will be thousands of lines in the process, what would be the best approach when writing PL/SQL code for better performance?
Thanks in advance.Do you want real lines (completed by a Unix or DOS line break) of the CLOB?
I use the following function to process the lines of CLOB (then tokenising and analysis of each line):
create or replace type TStrings is table of varchar2(4000); / create or replace function ClobToLines( c clob, lineTerminator varchar2 default null ) return TStrings pipelined is -- function: CLOB TO LINES -- descr: reads lines from a clob and returns each line as a separate row pos integer; line varchar2(4000); offset integer := 1; charSep varchar2(10); amount integer := 1; begin -- if no CRLF specified, detect whether DOS or Unix linefeeds are used if lineTerminator is null then pos := DBMS_LOB.InStr( c, chr(10), offset, 1 ); if pos = 0 then raise_application_error( -20001, 'The CLOB does not contain char #10 (used by both DOS and Unix linefeeds) and failed to parse.' ); end if; if pos > 1 then DBMS_LOB.Read( lob_loc => c, amount => amount, offset => pos-1, buffer => charSep ); end if; if charSep = chr(13) then charSep := chr(13)||chr(10); else charSep := chr(10); end if; else charSep := lineTerminator; end if; while (offset < DBMS_LOB.GetLength(c) ) loop pos := DBMS_LOB.InStr( c, charSep, offset, 1 ); if pos > 0 then line := DBMS_LOB.SubStr( c, pos-offset, offset ); offset := pos + length(charSep); else offset := DBMS_LOB.GetLength( c ) + 1; line := null; end if; pipe row( line ); end loop; return; end; /
-
How to view the report on one Clob column online?
Hello
In a set of columns in the report created with the wizard to create a Page, a Clob column is made that resembles a dozen lines high. The other elements are the high standard of a line. How can I load Apex to restore the Clob, the same height as the other columns (on one line)? Left like that, I'll only be able to see 2 or 3 lines at once, even if there is very little data in Clob columns.
I would have attached a screenshot, but I do not see this feature on the forum site.
BTW, I guess this is a common newbie question. I don't see an answer in the Forum or in the documentation. Your response is appreciated.
Thank you
KimKim2012 wrote:
Unfortunately, at this stage of my Apex maturity, it would be very difficult for me to reproduce the problem on apex.oracle.com (don't laugh, Jedi are not built in a day).It's very simple.
1. sign up for an account on apex.oracle.com.
2. in your local installation of the APEX, go to SQL Workshop > utilities > generate DDL. Click create a Script and use the wizard to generate a DDL script that contains the objects of database required by your application. (You can find out what they use Application Builder > Application > utilities > database object dependencies.)
3. your local installation of APEX export demand.
4. download and run the DDL file on apex.oracle.com using SQL Workshop > Scripts SQL.
5 import the request to apex.oracle.com.So I resort to ad a page to SkyDrive. When you see the picture, the question will be very clear and I guess that there is a way to dusty solution tucked away in the vault. Note: I would like to limit the height of the text element, not the width of it. Here's the URL for the screenshot.
Go to the Notes column attributes. Define the number of rows to 1 and the attributes of the element to
style="height: 1.3em;"
You may need to adjust the height to match other items. (Or according to browser [s], may not need any: in Firefox on Windows 7 14 "number of lines: 1" seems to mean "number of rows: 2". ") (Go figure.)
Maybe you are looking for
-
What App do I need open .ods files? I used to get the files Excel from a friend, but now they use a program that writes the file in .ods format and I can not open them.
-
Satellite P300D - 12 c - need drivers Vista 64 bit
Hello I need drivers for vista 64-bit, anyone know is that I can find them?I'm looking on the official website of toshiba, but there only for 32 bit... Also, anyone know if I can put a second hdd? Thanks in advance
-
Simple by typing in an e-mail and internet access, office, and all access to windows is fuzzy, impossible to return to the normal resolution. Windows Vista not Windows 7
-
Hello, I would like to create a decent size on my hard drive partition. Disk Manager pays 75% of free space on the OS (C :). But when I start the process of "shrink volume" (to create open space for my new partition), the dialog box shows ONLY 238
-
Surface RT pdf reader does not.
I have a RT of Surface. Got a PDF attachment in Adobe. When I click on it a mostly blank page comes up with a few paragraphs that tell me to go to www.adobe.com/go/pdf_for_configure. I go there, don't click on Chrome and then download and the surf