Clob or XML
Hello,
I need to store product specifications and definitions to display on the internet. These definitions are very long and detailed. Moreover, they include imagery. I need to develop queries on these products, too.
Should I store all the descriptions as CLOB type or use standard XML file for them? When I display the page, I can get the key information from ORACLE tables, and the descriptions from XML files. Will this work fast? Or CLOB will be fast enough to display long text on the internet?
Thanks,
Gabriel
The definitions are not just couples of words or
sentences. They are at least half a page long
detailed descriptions, and there are at least 10
different variables like this. If I don't use CLOB,
how else can I store them?
Thanks,The approach is to model the information contained in the description, rather than just poke it into the database as big aptly named clob of text.
Similar Messages
-
SQL> desc testload
Name Type Nullable Default Comments
TEST_XML CLOB Y
VERSION
11.2.0.1.0
SQL> SELECT
2 xmlcast(
3 xmlquery('/osd/customerNumber' passing XMLTYPE(test_xml) as "d" returning content)
4 as NUMBER
5 )
6 from Testload
7 ;
SELECT
xmlcast(
xmlquery('/osd/customerNumber' passing XMLTYPE(test_xml) as "d" returning content)
as NUMBER
from Testload
ORA-19228: XPST0008 - undeclared identifier: prefix '.' local-name ''the xml is below.
i am using a blob because i am having issues loading this into a xmltype the error i get is string litteral too long.
<osd><customer operation=UPD><commonDetails><customerNumber>42961</customerNumber><masterIndicator>Y</masterIndicator>
<cifID>100080022</cifID><cifPreviousCustomerNumber/><customerShortName>United Nations Childrens Fd</customerShortName><murexUniqueShortName/>
<cifCustomerLongName>United Nations Childrens Fund</cifCustomerLongName><cifFormerlyKnownAs/><cifCustomerStatus>A</cifCustomerStatus>
<cifClosedReason><cifClosedReasonCode/><cifClosedReasonDescription/></cifClosedReason><clientAlias/><wholesaleRetailIndicator>W</wholesaleRetailIndicator>
<customerType>E</customerType><language><languageCode>E</languageCode><languageDescription>ENGLISH</languageDescription></language>
<openedDate>2006-05-13</openedDate><effectiveDate>2006-05-13</effectiveDate><dateClosed/><scmbStatus>A</scmbStatus><internalIndicator>N</internalIndicator>
<nonResidentIndicator>N</nonResidentIndicator><groupCode/><countryOfResidence><countryOfResidenceCode>US</countryOfResidenceCode>
<countryOfResidenceName>UNITED STATES</countryOfResidenceName></countryOfResidence><countryOfOperation><countryOfOperationCode>US</countryOfOperationCode>
<countryOfOperationName>UNITED STATES</countryOfOperationName></countryOfOperation><tradingSector/><vatNumber/><taxNumber/><icmUserIndicator>N</icmUserIndicator>
<importerIndicator>N</importerIndicator><exporterIndicator>N</exporterIndicator><addresses><registeredAddress><line1>UNICEF House</line1>
<line2>3 United Nations Plaza</line2><line3/><line4/><postalCode>10017</postalCode><countryCodeOfRegistration>US</countryCodeOfRegistration>
<countryNameOfRegistration>UNITED STATES</countryNameOfRegistration><region>New York</region><city>New York</city></registeredAddress>
<residentialAddress><line1>3 United Nations Plaza</line1><line2>UNICEF House</line2><line3/><line4/><postalCode/><yearsAtAddress/></residentialAddress>
<postalAddress><line1/><line2/><line3/><line4/><postalCode/></postalAddress></addresses><form50><form50Code/><form50Description/></form50>
<mainMarketSegmentType><mainMarketSegmentTypeCode/><mainMarketSegmentTypeDescription/></mainMarketSegmentType><marketSubSegmentType><marketSubSegmentTypeCode/>
<marketSubSegmentTypeDescription/></marketSubSegmentType><creditRatingAgency/><creditRating><creditRatingCode/><creditRatingDescription/></creditRating>
<nonSBSADetails><nonSBSACustomerIndicator>N</nonSBSACustomerIndicator><nonSBSABankCode/><nonSBSABranchNumber/><nonSBSABranchName/><nonSBSAAccountNumber/>
</nonSBSADetails><accountingStaticData><sapDetails><sapCounterpartyEntityCode/><resBankCode/><resBankDescription/><sapPartnerProfitCentre/>
<sapPartnerProfitCentreName/><sihSectorAccountGroup>O</sihSectorAccountGroup><sarbSapSectorCode/><industrialCode>00842</industrialCode>
<industrialDescription>PROVISION OF SERVICES TO THE COMMUNITY</industrialDescription><boeIndustryCode>1401</boeIndustryCode><boeIndustryName>Personal & Community Services</boeIndustryName></sapDetails>
<globusDetails><globusFinancialInstitutionType/><r105AuthorisedIndicator>N</r105AuthorisedIndicator><marginCustomerIndicator/>
<tfaCustomerIndicator>N</tfaCustomerIndicator><tafCounterpartyIndicator/><jfbMidasNumber/><fsaClassIndicator/><globusMnemonic>UNEF</globusMnemonic>
<pepIndicator>N</pepIndicator><fxNettIndicator>N</fxNettIndicator><hongkongCustomerIndicator>N</hongkongCustomerIndicator>
<taipeiCustomerIndicator>N</taipeiCustomerIndicator><brazilCustomerIndicator>N</brazilCustomerIndicator><sihGroupCode>01</sihGroupCode>
<sihGroupDesc>THIRD PARTY</sihGroupDesc><taiwanTaxExemptIndicator>N</taiwanTaxExemptIndicator><taiwanLocalIndustry>US</taiwanLocalIndustry><roleCode/>
<roleDesc/><spectrumLocation>USA</spectrumLocation><r105Date/><departmentCode>17</departmentCode><departmentDesc>TREASURY/BUSINESS DEVELOPMENT</departmentDesc>
<custodyCounterpartyMarker>N</custodyCounterpartyMarker><globusLongName/><globusAddressLine1>THREE UNITED NATIONS PLAZA</globusAddressLine1>
<globusAddressLine2>NEW YORK NY 10017</globusAddressLine2><globusAddressLine2b/><globusAddressLine3>USA</globusAddressLine3><globusAddressLine3b/>
<departmentEntityCode>SBL</departmentEntityCode><departmentEntityDescription>Standard Bank Plc</departmentEntityDescription>
<taiwanLocalIndustryDescription>UNITED STATES</taiwanLocalIndustryDescription><safeCustody>N</safeCustody><tafEligible>N</tafEligible></globusDetails>
</accountingStaticData><externalFeedMapping><externalFeedMappingCode>WWW</externalFeedMappingCode><externalFeedMappingDescription>Web Site</externalFeedMappingDescription><externalFeedMappingClientReference>CRIDOC</externalFeedMappingClientReference>
</externalFeedMapping><externalFeedMapping><externalFeedMappingCode>WWW</externalFeedMappingCode><externalFeedMappingDescription>Web Site</externalFeedMappingDescription><externalFeedMappingClientReference>UNESCO.ORG</externalFeedMappingClientReference></externalFeedMapping><externalFeedMapping>
<externalFeedMappingCode>WWW</externalFeedMappingCode><externalFeedMappingDescription>Web Site</externalFeedMappingDescription><externalFeedMappingClientReference>UNICEF.ORG</externalFeedMappingClientReference></externalFeedMapping><globalEntityCode>SBSA</globalEntityCode><icmaMember>N</icmaMember>
<fsaReportable>Y</fsaReportable><icmaCode/><sibCode/></commonDetails><enterpriseDetails><registeredName>United Nations Childrens Fund</registeredName>
<masterCustomerNumber/><cifTopParentID>100080022</cifTopParentID><cifLegalEntityParentID/><cifHierarchyLevel>TP</cifHierarchyLevel><cifTopParentOnlyIndicator>N</cifTopParentOnlyIndicator><cifAdditionalInfo/><standardBankEntityIndicator>N</standardBankEntityIndicator><cifBICCode/><cifFormattedRegisteredName/>
<cifTradingName>UNICEF</cifTradingName><bankIndicator>N</bankIndicator><enterpriseType><enterpriseTypeCode>099</enterpriseTypeCode><enterpriseTypeDescription>ENTERPRISE TYPE UNKNOWN</enterpriseTypeDescription></enterpriseType><registrationNumber/><cifRegistrationState/><registrationDate>1946-12-11</registrationDate>
<authorisedDealer><authorisedDealerCode/><authorisedDealerDescription/></authorisedDealer><primarySIC><primarySICCode/><primarySICDescription/></primarySIC><secondarySIC><secondarySICCode/><secondarySICDescription/></secondarySIC><tertiarySIC><tertiarySICCode/><tertiarySICDescription/></tertiarySIC><taxYearEnd/>
<mainBanker/><secondaryBanker/><npsParticipantIndicator>N</npsParticipantIndicator><primarySwiftAddress/><isdaDetails><isdaIndicator>N</isdaIndicator><isdaEffectiveDate/><isdaLastUpdated/></isdaDetails><clsDetails><clsMemberIndicator>N</clsMemberIndicator><clsType><clsTypeCode/><clsTypeDescription/></clsType>
</clsDetails><directors/><mandates/><shareholders/><topParentName>United Nations Childrens Fd</topParentName><FundAdministrator/><FundAdminDescription/><LegalFormType>Fund</LegalFormType></enterpriseDetails><communicationDetails><communicationDetailsForInstrument><instrument>10</instrument>
<instrumentDescription>FX INTERBANK</instrumentDescription><communicationType>ADDR</communicationType><communicationTypeDescription>POSTAL ADDRESS</communicationTypeDescription><kycLocationCode/><countryDialingCode/><areaDialingCode/><communicationNumber>ADDR</communicationNumber><primaryIndicator>N</primaryIndicator>
<contactName/><confirmationIndicator>N</confirmationIndicator><communicationSequence>1</communicationSequence><primaryForTypeIndicator>Y</primaryForTypeIndicator><entityCode>SBL</entityCode><processingOrgOsdId/><addressLine1>UNICEF UNITED NATIONS CHILDREN FUND</addressLine1>||
<addressLine2>THREE UNITED NATIONS PLAZA</addressLine2><addressLine3/><addressLine4/><postalCode/><countrySwiftCode>US</countrySwiftCode><cityCode>NEW YORK</cityCode><adminAreaCode>NEW YORK</adminAreaCode><countryDescription>UNITED STATES</countryDescription><suppressConfirmation>N</suppressConfirmation>
<holdConfirmation/></communicationDetailsForInstrument><communicationDetailsForInstrument><instrument>11</instrument><instrumentDescription>FX DERIVATIVES</instrumentDescription><communicationType>FAX</communicationType><communicationTypeDescription>FACSIMILE</communicationTypeDescription><kycLocationCode/>
<countryDialingCode>001</countryDialingCode><areaDialingCode>21</areaDialingCode><communicationNumber>23267425</communicationNumber><primaryIndicator>N</primaryIndicator><contactName/><confirmationIndicator>N</confirmationIndicator><communicationSequence>1</communicationSequence>
<primaryForTypeIndicator>Y</primaryForTypeIndicator><entityCode>SBL</entityCode><processingOrgOsdId/><addressLine1/><addressLine2/><addressLine3/><addressLine4/><postalCode/><countrySwiftCode/><cityCode/><adminAreaCode/><countryDescription/><suppressConfirmation>N</suppressConfirmation><holdConfirmation/>
</communicationDetailsForInstrument><communicationDetailsForInstrument><instrument>50</instrument><instrumentDescription>SBL ALL</instrumentDescription><communicationType>FAX</communicationType><communicationTypeDescription>FACSIMILE</communicationTypeDescription><kycLocationCode/>
<countryDialingCode>001</countryDialingCode><areaDialingCode>212</areaDialingCode><communicationNumber>3267425</communicationNumber><primaryIndicator>N</primaryIndicator><contactName>NA</contactName><confirmationIndicator>Y</confirmationIndicator><communicationSequence>1</communicationSequence>
<primaryForTypeIndicator>Y</primaryForTypeIndicator><entityCode>SBL</entityCode><processingOrgOsdId/><addressLine1/><addressLine2/><addressLine3/><addressLine4/><postalCode/><countrySwiftCode/><cityCode/><adminAreaCode/><countryDescription/><suppressConfirmation>N</suppressConfirmation><holdConfirmation/>
</communicationDetailsForInstrument><communicationDetailsForInstrument><instrument>10</instrument><instrumentDescription>FX INTERBANK</instrumentDescription><communicationType>REUTR</communicationType><communicationTypeDescription>REUTERS</communicationTypeDescription><kycLocationCode/>
<countryDialingCode>0</countryDialingCode><areaDialingCode>0</areaDialingCode><communicationNumber>UNEF</communicationNumber><primaryIndicator>N</primaryIndicator><contactName/><confirmationIndicator>N</confirmationIndicator><communicationSequence>1</communicationSequence><primaryForTypeIndicator>Y</primaryForTypeIndicator>
<entityCode>SBL</entityCode><processingOrgOsdId/><addressLine1/><addressLine2/><addressLine3/><addressLine4/><postalCode/><countrySwiftCode/><cityCode/><adminAreaCode/><countryDescription/><suppressConfirmation>N</suppressConfirmation><holdConfirmation/></communicationDetailsForInstrument></communicationDetails>
<ssiDetails><normal><ssiForInstrument><instrument>10</instrument><instrumentDescription>FX INTERBANK</instrumentDescription><currencyCode>BDT</currencyCode><primaryIndicator>Y</primaryIndicator><bankAccountNumber>42961</bankAccountNumber><effectiveDate>2007-07-14</effectiveDate><lastUpdated>2007-07-14</lastUpdated>
<loadSSIFor>C</loadSSIFor><status>A</status><correspondentDetails><option>A</option><bankAccountNumber>0850032</bankAccountNumber><customerNo>53023</customerNo><swiftAddress>SCBLBDDX</swiftAddress><shortName>Standard Chartered Bk Dhaka Br</shortName><message>N</message></correspondentDetails><intermediaryDetails>
<intermediarySSISeq>1</intermediarySSISeq></intermediaryDetails><beneficiaryDetails><ibanIndicator>N</ibanIndicator><thirdPartyIndicator>N</thirdPartyIndicator></beneficiaryDetails><customerDetails><option>D</option><narrative2>United Nations Children Fund</narrative2><narrative3>3 United Nations Plaza</narrative3>
<ibanIndicator>N</ibanIndicator><thirdPartyIndicator>N</thirdPartyIndicator></customerDetails><roleCode>CLIENT</roleCode><effectiveDateType>V</effectiveDateType><method>S</method><uniqueSysGenNum>26961</uniqueSysGenNum><entityCode>SBL</entityCode><globusBankNumberIndicator>N</globusBankNumberIndicator>
<securityFlag>CASH</securityFlag><custody>N</custody><triParty>N</triParty><additionalCurrencyDetails/></ssiForInstrument><ssiForInstrument><instrument>10</instrument><instrumentDescription>FX INTERBANK</instrumentDescription><currencyCode>CHF</currencyCode><primaryIndicator>Y</primaryIndicator><bankAccountNumber>42961</bankAccountNumber>
<effectiveDate>2008-03-27</effectiveDate><lastUpdated>2008-03-27</lastUpdated><loadSSIFor>C</loadSSIFor><status>A</status><correspondentDetails><option>A</option><bankAccountNumber>0141448</bankAccountNumber><customerNo>39537</customerNo><swiftAddress>UBSWCHZH80A</swiftAddress><shortName>UBS Ag Zurich Br</shortName><message>N</message></correspondentDetails>
<intermediaryDetails><intermediarySSISeq>1</intermediarySSISeq></intermediaryDetails><beneficiaryDetails><ibanIndicator>N</ibanIndicator><thirdPartyIndicator>N</thirdPartyIndicator></beneficiaryDetails><customerDetails><option>D</option><narrative1>240C02607340</narrative1><narrative2>UNITED NATIONS CHILDRENS FUND</narrative2><ibanIndicator>N</ibanIndicator>
</subscription></systemSubscriptionDetails>
</customer></osd> -
BUG : CLOB or XML.
Hi! I was playing with XML and CLOB and I think I found a bug with clobs. I would like a DEV to try this.
=========================================================================================================
First, you create the following function :
=========================================================================================================
function clob_bug return clob
as
sdo mdsys.sdo_geometry := mdsys.sdo_geometry(123, 123, null, mdsys.sdo_elem_info_array(1, 2, 3), null);
xml sys.xmltype;
text clob;
str varchar2(32000);
begin
xml := xmltype.createXML(sdo);
text := xml.getClobVal();
-- This doesnt work.
return text;
-- But this will work. (But the XML text cannot exceed 32000 chars, or so);
-- str := text;
-- return str;
end;
=========================================================================================================
Then try the following VB.NET code.
=========================================================================================================
'Fill in the datasource.
Dim connection As New Oracle.DataAccess.Client.OracleConnection("User Id=SCOTT;Password=TIGER")
Try
connection.Open()
Dim cmd As Oracle.DataAccess.Client.OracleCommand = connection.CreateCommand()
cmd.CommandText = "SELECT CLOB_BUG() FROM DUAL"
Dim o As Object = cmd.ExecuteScalar()
Catch e As Oracle.DataAccess.Client.OracleException
Console.WriteLine(e.Message)
End Try
=========================================================================================================
Then you should get the following error :
"ORA-00000: normal, successful completion"
With an internal error code of -3000 (dont know what it means, but you guys should!).
Mathieu Gauthier
JCMB Technology Inc.I found a much easier way to reproduce the bug. forget about the PL/SQL function.
Dim connection As New Oracle.DataAccess.Client.OracleConnection("User Id=SCOTT;Password=TIGER;")
Try
connection.Open()
Dim cmd As Oracle.DataAccess.Client.OracleCommand = connection.CreateCommand()
cmd.CommandText = "select SYS_XMLGEN(2).getclobval() from dual"
Dim o As Object = cmd.ExecuteScalar()
Catch e As Oracle.DataAccess.Client.OracleException
Console.WriteLine(e.Message)
End Try -
Error updating a CLOB XML fragment
Hi,
I have an xml schema that contains an element of type xs:anyType that has been mapped to Oracle as CLOB.
Now I have the needs to update this value but I was not able to do it.
The code that does the update is the following:
public void updateXML(String sqlCmd, String XMLString) throws Exception
DataSource ds = null;
Connection conn = null;
OraclePreparedStatement stmt = null;
oracle.sql.CLOB tempCLOB = null;
Writer tempCLOBWriter= null;
try
//Get Data Source
ds = (DataSource) new InitialContext().lookup(xmlDS);
// Get Connection
conn = ds.getConnection();
// Prepare statement with requested insert, update or delete statement
stmt = (OraclePreparedStatement) ((OracleConnection) conn).prepareStatement(sqlCmd);
// Build CLOB containing XML if required
if (XMLString != null)
tempCLOB = oracle.sql.CLOB.createTemporary
( ((WLConnection)conn).getVendorConnection(),
true,
CLOB.DURATION_SESSION);
try {
tempCLOB.open(CLOB.MODE_READWRITE);
tempCLOBWriter = tempCLOB.getCharacterOutputStream();
tempCLOBWriter.write(XMLString);
tempCLOBWriter.flush();
} finally {
if (tempCLOBWriter != null)
tempCLOBWriter.close();
//Set parameter on Prepared Statement
stmt.setCLOB(1,tempCLOB);
// Execute command
stmt.executeUpdate();
// Clean up CLOB data if required
if (XMLString != null)
tempCLOB.freeTemporary();
// Return connection to the pool
conn.close();
catch ( Exception e)
if (conn != null)
conn.close();
throw e;
IF the sqlCmd param contains:
update XML_OPERAZIONE_LOG t
set value(t) = updateXML(value(t),
'/operazione.log/Operazione',XMLTYPE(?))
where existsNode(value(t),
'/operazione.log/Journal [NumeroElettronico="99900000"]') = 1
I get the error ORA-17410 "No More Data to read from socket"
If the sqlCmd contains:
insert into XML_OPERAZIONE_LOG values( XMLType(?))
I have no problems.
Any Idea ?
Oracle 9.2.0.2.0, latest classes12.zip BEW Web Logic 8.1Upgrade to 9.2.0.5.0 since 9.2.0.2.0 is not supported for XMLType. Also try OCI rather than thin dirver.
-
How do I Load a clob from an XML field in an XMLTYPE using XMLTABLE ?
I am trying to load data into a CLOB from a XML field using XMLTABLE.
I have a SUMMARY xml field with over 100 K of data (potentialy)
and I can load all the other datatype fields to columns but can not load the xml fields over 4000 characters.
example
First I create a table of XMLTYPE. I need to sqlload new files in at regular intervals.
Create table WEB_XML of XMLTYPE;
Then I create my relational table....
create table WEB_WORKING
request_id varchar(10),
ref_number varchar(20),
summary clob
The I use the .ctl file to sqlload the xml data in
LOAD DATA
INFILE *
INTO TABLE WEB_XML
append
xmltype(XMLDATA)
ext_fname filler char(90),
XMLDATA LOBFILE(ext_fname) TERMINATED BY EOF
BEGINDATA
XMLFILE1.xml
After loading the WEB_XML table using sqlldr, I try to load my relational table using XMLTable
INSERT into WEBBAR_WORKING
request_id ,
ref_number ,
summary
SELECT X.* FROM WEB_XML P2,
XMLTable ( '//Request//REQUESTVIEW'
PASSING P2.object_value
COLUMNS
"request_id" VARCHAR(10) PATH 'REQUEST_ID',
"ref_number" VARchar(20) PATH 'REF_NUMBER',
"SUMMARY" clob PATH 'SUMMARY'
) AS X;
This gives an error saying its not expecting clob
My XML looks somthing like
-<Request>
-<REQUESTVIEW>
<REQUEST_ID>3140</REQUEST_ID>
<ref_number>2003-04-02</RECEIVED_DATE>
<SUMMARY>
OVER 100 K of data
</SUMMARY>
</REQUESTVIEW>
</Request>ok
that helped lot, im getting there however some more help please
This SQL
SELECT request_id, recieved_by, X.SUMMARY.getClobVal()
FROM WEB_XML P2,
XMLTable
'//Request//REQUESTVIEW'
PASSING P2.object_value
COLUMNS
"request_id" VARCHAR(10) PATH 'REQUEST_ID',
"received_by" VARCHAR(10) PATH 'RECEIVED_BY',
"SUMMARY" xmltype PATH 'SUMMARY'
) AS X;
SELECT request_id, recieved_by, X.SUMMARY.getClobVal()
ERROR at line 1:
ORA-00904: "RECIEVED_BY": invalid identifier
If I use the X.request_id, X.received_by ......
i get the error message
Package or function is in aan invalid state.
But this SQL was successful in getting the clob by itself but with the XML tgs around it still, how do I strip the XML tags from around this result ?
SELECT X.SUMMARY.getClobVal()
FROM WEBBAR_XML P2,
XMLTable
'//Request//REQUESTVIEW'
PASSING P2.object_value
COLUMNS
"SUMMARY" XMLTYPE PATH 'SUMMARY'
) AS X;
---------------------------------------------------------- -
How to insert more than 32k xml data into oracle clob column
how to insert more than 32k xml data into oracle clob column.
xml data is coming from java front end
if we cannot use clob than what are the different options availableAre you facing any issue with my code?
String lateral size error will come when you try to insert the full xml in string format.
public static boolean writeCLOBData(String tableName, String id, String columnName, String strContents) throws DataAccessException{
boolean isUpdated = true;
Connection connection = null;
try {
connection = ConnectionManager.getConnection ();
//connection.setAutoCommit ( false );
PreparedStatement PREPARE_STATEMENT = null;
String sqlQuery = "UPDATE " + tableName + " SET " + columnName + " = ? WHERE ID =" + id;
PREPARE_STATEMENT = connection.prepareStatement ( sqlQuery );
// converting string to reader stream
Reader reader = new StringReader ( strContents );
PREPARE_STATEMENT.setClob ( 1, reader );
// return false after updating the clob data to DB
isUpdated = PREPARE_STATEMENT.execute ();
PREPARE_STATEMENT.close ();
} catch ( SQLException e ) {
e.printStackTrace ();
finally{
return isUpdated;
Try this JAVA code. -
From XML in CLOB to relational table doubt
versions 11.2.0.2.0 / 10.2.0.4.0
It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.
It's *<IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>*
For the rest the below works in both versions but used on an xml having a 10000 <CdtTrfTxInf> on 11g it took 9 seconds and was killed because no answer was produced after 30 minutes on 10g. A colleague using java loaded the relational table in 34 seconds on 10g and produced the relational table on 11g in just 5 seconds.
The 10g version is surviving with no xmldb installed and there are rumors our thinking heads didn't succeed to deactivate it on 11g yet.
Any suggestion concerning alternate ways to produce a relational table from an xmltype located in a clob column of a relational table are welcome
(looking at CLOB in XML to Normal table Best approach? I thought too many xmltable would have to be used)
with
the_data as
(select q'~
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01">
<pacs.008.001.01>
<GrpHdr>
<MsgId>1L1U000JB4UT1FVS</MsgId>
<MsgId>9X9X999XX9XX9XXX</MsgId>
<CreDtTm>YYYY-MM-DDTHH:MI:SS</CreDtTm>
<NbOfTxs>99999</NbOfTxs>
<TtlIntrBkSttlmAmt Ccy="???">9999999</TtlIntrBkSttlmAmt>
<IntrBkSttlmDt>YYYY-MM-DD</IntrBkSttlmDt>
<SttlmInf>
<SttlmMtd>XXXX</SttlmMtd>
<ClrSys>
<ClrSysId>XXXX</ClrSysId>
</ClrSys>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>XXXXXXX999999-XX999999.XX</InstrId>
<EndToEndId>X9999999999</EndToEndId>
<TxId>X9999-9999999999</TxId>
</PmtId>
<PmtTpInf>
<SvcLvl>
<Cd>XXXX</Cd>
</SvcLvl>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="???">999999</IntrBkSttlmAmt>
<ChrgBr>XXXX</ChrgBr>
<InstgAgt>
<FinInstnId>
<BIC>XXXXXX9X</BIC>
</FinInstnId>
</InstgAgt>
<Dbtr>
<Nm>NAME</Nm>
<PstlAdr>
<AdrLine>ADDRESS</AdrLine>
<AdrLine>CITY</AdrLine>
<Ctry>XX</Ctry>
</PstlAdr>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>XX99999999999999999</IBAN>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>XXXXXX9X</BIC>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BIC>XXXXXX9X</BIC>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>NAME</Nm>
<PstlAdr>
<AdrLine>ADDRESS</AdrLine>
<AdrLine>CITY</AdrLine>
<Ctry>XX</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<IBAN>XX99999999999999999</IBAN>
</Id>
</CdtrAcct>
<RmtInf>
<Strd>
<CdtrRefInf>
<CdtrRef>X99999999-9999999999</CdtrRef>
</CdtrRefInf>
<AddtlRmtInf>ADDITIONAL INFO</AddtlRmtInf>
</Strd>
</RmtInf>
</CdtTrfTxInf>
</pacs.008.001.01>
</Document>
~' the_column
from dual
select v.instrid,v.endtoendid,v.txid,v.cd,
v.ccy, /* returned as NULL - the only attribute value */
v.intrbksttlmamt,v.chrgbr,v.bic1,v.nm1,v.adrline11,v.adrline12,v.ctry1,v.iban1,
v.bic2,v.bic3,v.nm2,v.adrline21,v.adrline22,v.ctry2,v.iban2,v.cdtrref,v.addtlrmtinf
from (select xmltype(the_column) the_column_xml
from the_data
) w,
xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
'for $r in /Document/pacs.008.001.01/CdtTrfTxInf
return <rw>
<InstrId>{$r/PmtId/InstrId}</InstrId>
<EndToEndId>{$r/PmtId/EndToEndId}</EndToEndId>
<TxId>{$r/PmtId/TxId}</TxId>
<Cd>{$r/PmtTpInf/SvcLvl/Cd}</Cd>
<Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>
<IntrBkSttlmAmt>{ora:replace($r/IntrBkSttlmAmt,"[.]",",")}</IntrBkSttlmAmt>
<ChrgBr>{$r/ChrgBr}</ChrgBr>
<BIC1>{$r/InstgAgt/FinInstnId}</BIC1>
<Nm1>{$r/Dbtr/Nm}</Nm1>
<AdrLine11>{$r/Dbtr/PstlAdr/AdrLine[1]}</AdrLine11>
<AdrLine12>{$r/Dbtr/PstlAdr/AdrLine[2]}</AdrLine12>
<Ctry1>{$r/Dbtr/PstlAdr/Ctry}</Ctry1>
<IBAN1>{$r/DbtrAcct/Id}</IBAN1>
<BIC2>{$r/DbtrAgt/FinInstnId}</BIC2>
<BIC3>{$r/CdtrAgt/FinInstnId}</BIC3>
<Nm2>{$r/Cdtr/Nm}</Nm2>
<AdrLine21>{$r/Cdtr/PstlAdr/AdrLine[1]}</AdrLine21>
<AdrLine22>{$r/Cdtr/PstlAdr/AdrLine[2]}</AdrLine22>
<Ctry2>{$r/Cdtr/PstlAdr/Ctry}</Ctry2>
<IBAN2>{$r/CdtrAcct/Id}</IBAN2>
<CdtrRef>{$r/RmtInf/Strd/CdtrRefInf/CdtrRef}</CdtrRef>
<AddtlRmtInf>{$r/RmtInf/Strd/AddtlRmtInf}</AddtlRmtInf>
</rw>'
passing w.the_column_xml
columns instrid varchar2(300) path '/rw/InstrId',
endtoendid varchar2(150) path '/rw/EndToEndId',
txid varchar2(200) path '/rw/TxId',
cd varchar2(50) path '/rw/Cd',
ccy varchar2(50) path '/rw/Ccy',
intrbksttlmamt varchar2(50) path '/rw/IntrBkSttlmAmt',
chrgbr varchar2(100) path '/rw/ChrgBr',
bic1 varchar2(100) path '/rw/BIC1',
nm1 varchar2(1000) path '/rw/Nm1',
adrline11 varchar2(1000) path '/rw/AdrLine11',
adrline12 varchar2(1000) path '/rw/AdrLine12',
ctry1 varchar2(50) path '/rw/Ctry1',
iban1 varchar2(200) path '/rw/IBAN1',
bic2 varchar2(100) path '/rw/BIC2',
bic3 varchar2(100) path '/rw/BIC3',
nm2 varchar2(1000) path '/rw/Nm2',
adrline21 varchar2(1000) path '/rw/AdrLine21',
adrline22 varchar2(1000) path '/rw/AdrLine22',
ctry2 varchar2(50) path '/rw/Ctry2',
iban2 varchar2(200) path '/rw/IBAN2',
cdtrref varchar2(1000) path '/rw/CdtrRef',
addtlrmtinf varchar2(1000) path '/rw/AddtlRmtInf'
) vRegards
EtbinHi,
It's a long time, no see since my last dealing with xml and no luck to have an attribute value returned into the relational table.When you use this :
<Ccy>{$r/IntrBkSttlmAmt/@Ccy}</Ccy>That doesn't set the value of the Ccy element with the attribute value, but actually add the attribute Ccy to the element Ccy, which results in
<Ccy Ccy="???"></Ccy>Knowing that, you have three options :
1) Leaving the XQuery as it is and using this instead in the COLUMNS clause :
ccy varchar2(50) path '/rw/Ccy/@Ccy',2) Modifying the XQuery to get the atomic value out of the attribute (using the fn:data function) :
<Ccy>{fn:data($r/IntrBkSttlmAmt/@Ccy)}</Ccy>3) Simplifying the whole thing, something like :
select v.instrid, v.endtoendid, v.txid, v.cd, v.ccy,
replace(v.intrbksttlmamt,'.',',') as intrbksttlmamt, v.chrgbr, v.bic1, v.nm1, v.adrline11, v.adrline12, v.ctry1, v.iban1,
v.bic2, v.bic3, v.nm2, v.adrline21, v.adrline22, v.ctry2, v.iban2, v.cdtrref, v.addtlrmtinf
from the_data w,
xmltable(xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:pacs.008.001.01'),
'/Document/pacs.008.001.01/CdtTrfTxInf'
passing xmltype(w.the_column)
columns instrid varchar2(300) path 'PmtId/InstrId',
endtoendid varchar2(150) path 'PmtId/EndToEndId',
txid varchar2(200) path 'PmtId/TxId',
cd varchar2(50) path 'PmtTpInf/SvcLvl/Cd',
ccy varchar2(50) path 'IntrBkSttlmAmt/@Ccy',
intrbksttlmamt varchar2(50) path 'IntrBkSttlmAmt',
chrgbr varchar2(100) path 'ChrgBr',
bic1 varchar2(100) path 'InstgAgt/FinInstnId',
nm1 varchar2(1000) path 'Dbtr/Nm',
adrline11 varchar2(1000) path 'Dbtr/PstlAdr/AdrLine[1]',
adrline12 varchar2(1000) path 'Dbtr/PstlAdr/AdrLine[2]',
ctry1 varchar2(50) path 'Dbtr/PstlAdr/Ctry',
iban1 varchar2(200) path 'DbtrAcct/Id',
bic2 varchar2(100) path 'DbtrAgt/FinInstnId',
bic3 varchar2(100) path 'CdtrAgt/FinInstnId',
nm2 varchar2(1000) path 'Cdtr/Nm',
adrline21 varchar2(1000) path 'Cdtr/PstlAdr/AdrLine[1]',
adrline22 varchar2(1000) path 'Cdtr/PstlAdr/AdrLine[2]',
ctry2 varchar2(50) path 'Cdtr/PstlAdr/Ctry',
iban2 varchar2(200) path 'CdtrAcct/Id',
cdtrref varchar2(1000) path 'RmtInf/Strd/CdtrRefInf/CdtrRef',
addtlrmtinf varchar2(1000) path 'RmtInf/Strd/AddtlRmtInf'
) vThat last option could possibly get you some performance improvement as well.
Edited by: odie_63 on 14 sept. 2011 20:57 -
Validate if XML in clob well form
Hi,
Is there any function can be used to validate if xml store in clob field well form ?
Thanks
VincentSQL> set serverout on
SQL> DECLARE
2 v_clob CLOB := '<?xml version="1.0"?>
3 <ROWSET>
4 <IBSCOLYTD>
5 <ACTNOI>28004125</ACTNOI>
6 <MEMONOI>251942</MEMONOI>
7 <MEMODTEI>05-SEP-92</MEMODTEI>
8 <AMOUNTI>400</AMOUNTI>
9 <BRCDSI>513</BRCDSI>
10 <TYPEI>1</TYPEI>
11 <TRANSMONI>0</TRANSMONI>
12 </IBSCOLYTD>
13 <IBSCOLYTD>
14 <ACTNOI>28004125</ACTNOI>
15 <MEMONOI>251943</MEMONOI>
16 <MEMODTEI>04-OCT-92</MEMODTEI>
17 <AMOUNTI>400</AMOUNTI>
18 <BRCDSI>513</BRCDSI>
19 <TYPEI>1</TYPEI>
20 <TRANSMONI>0</TRANSMONI>
21 </IBSCOLYTD>
22 ';
23 l_parser DBMS_XMLPARSER.Parser;
24 BEGIN
25 -- Create a parser.
26 l_parser := DBMS_XMLPARSER.newParser;
27 -- Parse the document
28 DBMS_XMLPARSER.parseClob(l_parser, v_clob);
29 DBMS_XMLPARSER.freeParser(l_parser);
30 DBMS_OUTPUT.put_line('Parsing Success');
31 EXCEPTION
32 WHEN OTHERS THEN
33 DBMS_OUTPUT.put_line('Parsing failed');
34 DBMS_XMLPARSER.freeParser(l_parser);
35
36 END;
37 /
Parsing failed
PL/SQL procedure successfully completed.
SQL> DECLARE
2 v_clob CLOB := '<?xml version="1.0"?>
3 <ROWSET>
4 <IBSCOLYTD>
5 <ACTNOI>28004125</ACTNOI>
6 <MEMONOI>251942</MEMONOI>
7 <MEMODTEI>05-SEP-92</MEMODTEI>
8 <AMOUNTI>400</AMOUNTI>
9 <BRCDSI>513</BRCDSI>
10 <TYPEI>1</TYPEI>
11 <TRANSMONI>0</TRANSMONI>
12 </IBSCOLYTD>
13 <IBSCOLYTD>
14 <ACTNOI>28004125</ACTNOI>
15 <MEMONOI>251943</MEMONOI>
16 <MEMODTEI>04-OCT-92</MEMODTEI>
17 <AMOUNTI>400</AMOUNTI>
18 <BRCDSI>513</BRCDSI>
19 <TYPEI>1</TYPEI>
20 <TRANSMONI>0</TRANSMONI>
21 </IBSCOLYTD>
22 </ROWSET>
23 '; --The last line added to make it ok.
24 l_parser DBMS_XMLPARSER.Parser;
25 BEGIN
26 -- Create a parser.
27 l_parser := DBMS_XMLPARSER.newParser;
28 -- Parse the document
29 DBMS_XMLPARSER.parseClob(l_parser, v_clob);
30 DBMS_XMLPARSER.freeParser(l_parser);
31 DBMS_OUTPUT.put_line('Parsing Success');
32 EXCEPTION
33 WHEN OTHERS THEN
34 DBMS_OUTPUT.put_line('Parsing failed');
35 DBMS_XMLPARSER.freeParser(l_parser);
36
37 END;
38 /
Parsing Success
PL/SQL procedure successfully completed.
SQL> -
I need to create xml files from the available data in the DB tables. I am planning to use SQL/XML functions(xmlroot,xmlelement etc) to construct a well-formed
xml and stored in CLOB data objects. I will use SPOOL command to get the clob (OUT parameter) in my client server (UNIX).
Does any temporary CLOB objects will be created and not cleared by Oracle engine in the table space? If yes,how can i use dbms_lob.freetemporary(clobvar);
to clear the CLOB object after the successful creation and spooling of the xml is done.
I need to have utf-8 character set and achieve url escaped chracters as well, please let me know if these can be done without using UTL_HTTP or any other UTL packages.DDL & DML
CREATE TABLE EMP_DETAILS (ENAME VARCHAR2(50),ID NUMBER(20),HIREDATE DATE);
INSERT INTO EMP_DETAILS (ENAME,ID,HIREDATE) VALUES ('SCOTT',1,SYSDATE-1);
INSERT INTO EMP_DETAILS (ENAME,ID,HIREDATE) VALUES ('SAM',2,SYSDATE-2);
INSERT INTO EMP_DETAILS (ENAME,ID,HIREDATE) VALUES ('JIM',3,SYSDATE-3);
PL/SQL
create or replace
PACKAGE body test_pack
IS
PROCEDURE test_proc (vxml OUT CLOB)
IS
xml CLOB;
vQuery VARCHAR2(1000);
BEGIN
select
XMLROOT(
xmlelement("root",
xmlagg(
xmlelement("emp",
xmlelement("name", ename)
, xmlelement("hiredate", hiredate)
),version '1.0" encoding="UTF-8').getClobVal()
into xml
from EMP_DETAILS;
vxml := xml;
END test_proc;
END;Does this pl/sql code block create any temp CLOB's (or) do i need clear/free xml CLOB variable used here after completion or in case of exception? -
Hi ,
I have a table which has a XML data type column, i need to select this coulumn and return it in CLOB type.
I know that I can convert CLOB to XML format using function Sys.Xmltype.Createxml, but I want the revrese.
Please help me on this.
ThanksXMLType.getClobval() perhaps?
Regards
Peter
Example from docs:
(http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb04cre.htm#g1050045)
CREATE TABLE xml_table OF XMLType;
Table created.
CREATE TABLE table_with_xml_column (filename VARCHAR2(64), xml_document XMLType);
Table created.
INSERT INTO xml_table
VALUES (XMLType(bfilename('XMLDIR', 'purchaseOrder.xml'),
nls_charset_id('AL32UTF8')));
1 row created.
INSERT INTO table_with_xml_column (filename, xml_document)
VALUES ('purchaseOrder.xml',
XMLType(bfilename('XMLDIR', 'purchaseOrder.xml'),
nls_charset_id('AL32UTF8')));
1 row created.
SELECT x.xml_document.getCLOBVal() FROM table_with_xml_column x;Edited by: Peter on Jun 23, 2009 3:11 AM -
My Task is To Parse a XML Document to Return CLOB's
Hi folks
I am writing this mail in the hope of getting a help.Please
give me a shoulder to keep me going.
The task is to parse a XML document for a specific Tag and
read the Tag content in CLOB to return CLOB.
I know that the writetoclob will do the job as
per oracle documentation.
I am giving the code where i got stuck.
Please help me complete my rest of coding.
Thanks
Input variables are
XMLin in CLOB, -- Incoming XML Document Structure
Partype in varchar2, -- Tagname
Result out CLOB -- Return Tag value CLOB data type.
My Code : -
Declare
p xmlparser.parser;
d xmldom.DOMDocument;
e xmldom.DOMElement;
nl xmldom.DOMNodeList;
n xmldom.DOMNode;
tagvalue varchar2(255);
paramsIn Clob;
result CLOB;
BEGIN
--loading SecXML
dbms_lob.createtemporary(paramsIn,true);
dbms_lob.append(paramsIn,XMLin);
--dbms_output.put_line('ParsebyTag ='||Partype);
--defining parser
p := xmlparser.newparser;
xmlparser.parseClob(p,paramsIn);
d := xmlparser.getDocument(p);
--get tagvalue
nl := xmldom.getElementsByTagName(d,partype);
n := xmldom.item(nl,0);
IF xmldom.getlength (nl) > 0
THEN
n := xmldom.item (nl, 0);
=>=>=> => xmldom.writetoclob (n, result); <=<=<=<=<=<=====
END IF;
return; -- from a procedure
The above line marked with a arrow does not work for CLOB Variables.
Please explain with a corrected code to complete this task.
Thanks for reading my request.
Please reply to this message poster as i am frequently
checking this to see a answer.
my email is [email protected]
Balaji.First, you have 2 variables with the same name,
Second, let me show you what is that you need to do:
PROCEDURE WriteDataToClob(XMLin in CLOB, Partype in varchar2, Result out CLOB) IS
Declare
p xmlparser.parser;
d xmldom.DOMDocument;
e xmldom.DOMElement;
nl xmldom.DOMNodeList;
n xmldom.DOMNode;
tagvalue varchar2(255);
TempClob Clob;
BEGIN
--Create a temporary clob
dbms_lob.createtemporary(TempClob,true);
--loading SecXML
--defining parser
p := xmlparser.newparser;
xmlparser.parseClob(p,XMLin);
d := xmlparser.getDocument(p);
--get tagvalue
nl := xmldom.getElementsByTagName(d,partype);
n := xmldom.item(nl,0);
IF xmldom.getlength (nl) > 0 THEN
n := xmldom.item (nl, 0);
xmldom.writetoclob (n, TempClob );
END IF;
Result := TempClob;
dbms_lob.FreeTemporary(TempClob);
END; -
Special characters in XML (UTF8, escapes etc)
This may seem like a simple problem, but I'm kind of a slow learner, so any help would be appreciated.
I'm generating XML output via ordinary PL/SQL procedures i.e. not using the Oracle XSQL stuff. The data is built up into a XML document, which will be parsed within the server, then passed out to a client, probably as a CLOB.
The data may contain "special" characters such as "<&>" and so on. Is there an existing function to translate these into an "XML-safe" form within the text, or do I need to trap and translate them individually?
Also, the database may contain foreign characters e.g. Thai or Chinese. Will this be handled transparently by my XML-extraction stuff - which just selects the data from the tables and writes it to a CLOB inside XML tags - or do I have to do something to make sure the XML comes out in a safe UTF format?
Thanks,
Chrisuse & instead of &
see http://www.w3.org/TR/2000/REC-xml-20001006#syntax -
Oracle Open World 2012 - XML DB Presentations and Hands-on Labs
Hereby following up on a small tradition, I think, I get going since 2006...an agenda overview of all things XMLDB you can do or see during this years Oracle Open World.
Oracle Open World is the biggest IT conference nowadays in the world with 40.000+ thousand attendees and 1600+ sessions or workshops, so an overview regarding specific topics can be handy.
If there is an update or something needs correction or added, please post it here.
Regards
Marco Gralike
HOL10055 - Oracle XML DB Hands-On Lab
========================================================================================================================
This hands-on lab provides an introduction to using Oracle XML DB and XQuery to store and manage XML content stored in Oracle Database.
It introduces the different kinds of XML storage and indexing offered by Oracle XML DB and shows how to optimize XQuery operations on XML
content by selecting the correct storage and indexing model. The lab also provides an introduction to the XML features available in the latest
version of Oracle Database, including the new XQuery Update standard. And it shows how to take full advantage of the latest XQuery standards,
such as XQuery Full-Text, to develop applications that combine the power of Full-Text and XML-based indexes
BOF9908 - Oracle XML DB BOF
========================================================================================================================
This session provides you with an opportunity to get answers to your questions about Oracle XML DB from the development team, product
management team, acknowledged independent experts, and fellow Oracle XML DB users. The goal is to have an open and frank discussion
about how to get the best out of all the features of Oracle XML DB. The session gives you a chance to establish personal contact with the
people who have firsthand experience with developing and delivering systems that make use of Oracle XML DB
CON8443 - Simple Content Management with Oracle XML DB and Database Native Web Services
========================================================================================================================
This session demonstrates the power of the Oracle XML DB repository. You will learn how to automate the processing of documents stored
in the Oracle XML DB repository, using repository events, and how to combine XML, PL/SQL, and database native Web services with Ajax and
JavaScript to create simple, effective applications that leverage the full power of Oracle XML DB and the Oracle XML DB repository. The session
focuses on a sample application, called XFiles, and shows how it was created with a combination of XML, XSL, JavaScript Ajax, and PL/SQL
CON8440 - Managing XML Content with the Latest-Generation Oracle XML DB
========================================================================================================================
This session introduces the latest generation of Oracle XML DB technology. XML standards continue to evolve, and Oracle XML DB continues
to provide the industry’s leading implementation of those standards. The latest version of Oracle XML DB provides support for two new exciting
XML standards, XQuery-Update and XQuery-Full Text. You will learn how to use XQuery, XQuery-Update, and XQuery Full-Text to develop
powerful XML-centric applications. The session also demonstrates how to optimize XQuery Full-Text operations with Oracle’s new XML full-text
index. The presentation also introduces Oracle’s new midtier XQuery engine and the XQJ API, which enables Java developers to access the full
power of Oracle’s XML technology
CON3148 - Integrating XML by Using Oracle SQL Developer 3.1 and Oracle Database 11g Release 2
========================================================================================================================
Frequently during a project lifecycle, new technology is introduced that presents first-time challenges. This session describes a project using
Oracle XML Database (Oracle XML DB) and discusses why Oracle XML DB was chosen, how it was used, and the technical issues encountered.
The presentation covers several examples using XMLTYPE, CLOBs, Oracle XML DB methods, XMLAGG, XMLELEMENT, XMLFOREST, and
dbms_xmldom. You will learn about methods, design considerations, and issues with Oracle XML DB. You will also take home working examples
that you can copy and paste into your Oracle environment. Benefit from examples that use Oracle Database 11g Release 2 and Oracle SQL
Developer 3.1.
CON8442 - Design Guidelines and Performance Tuning for Storing XML in Oracle Database
========================================================================================================================
This session examines techniques that can be used to optimize the performance of XML processing in Oracle XML DB. It looks at the different
storage and indexing options and provides guidelines on when each should be considered. After establishing a framework for deciding how to
store XML, the presentation considers the options available for indexing XML to ensure optimal performance of an XML-based application.
The session also discusses how standard techniques such as partitioning and using parallel data manipulation language (PDML) can be used to
scale XML processing on extremely large volumes of XML content and how Oracle XML DB can leverage the intelligent storage capabilities of
Oracle Exadata.
DEMOGROUNDS (Moscone South)
XML Application Development: Oracle XML DB, Oracle XML Developer Kit
========================================================================================================================
Oracle XML Database provides a high-performance, native XML storage and retrieval technology. It fully absorbs the W3C XML data model into
the Oracle Database, and provides new standard access methods for navigating and querying XML. With Oracle XML Database, you get all the
advantages of relational database technology plus the advantages of XML. Come and learn how to develop applications that take advantage
of Oracle's XML technology and the Oracle XML DB Repository.
Oracle XML Database: Structured, Semistructured, and Unstructured XML
========================================================================================================================
Oracle XML Database provides a high-performance, native XML storage and retrieval technology. It fully absorbs the W3C XML data model into
the Oracle Database, and provides new standard access methods for navigating and querying XML. With Oracle XML Database, you get all the
advantages of relational database technology plus the advantages of XML. Come and learn how to develop applications that take advantage
of Oracle's XML technology and the Oracle XML DB Repository.Oracle's OOW 2012 Content Catalog: https://oracleus.activeevents.com/connect/search.ww?event=openworld (use "XML DB" or "XMLDB" as search tag)
Edited by: user10212268 on Aug 13, 2012 5:10 AMOther resources are also on linkedin http://www.linkedin.com/groups/Oracle-XMLDB-3282943 to keep you updated.
M. -
I have created XML File from Query using below function:-
select dbms_xmlgen.getxml('
select * from tblreports where rownum<=1') from dual;
"(CLOB) <?xml version="1.0"?>
<ROWSET>
<ROW>
<REPORTID>preRES0011</REPORTID>
<ALIAS>Date wise Summary of pins Report</ALIAS>
<ACTIVE>Y</ACTIVE>
<TITLE>Date wise Summary of pins Report</TITLE>
<QUERY>select tsb.month1,
count(SIDNUMBER)GENERATED,
sum(case WHEN SERIALSTATUSID='SRS01' THEN 1 ELSE 0 END)NotAllocated,
SUM(CASE WHEN SERIALSTATUSID='SRS02' or SERIALSTATUSID='SRS03' or SERIALSTATUSID='SRS05' THEN 1 ELSE 0 END)ALLOCATED,
SUM(CASE WHEN SERIALSTATUSID='SRS02' or SERIALSTATUSID='SRS01' THEN 1 ELSE 0 END)NOTASSIGNEDTORESELLER,
SUM(CASE WHEN SERIALSTATUSID='SRS03' THEN 1 ELSE 0 END)READYTOACTIVATE,
sum(CASE WHEN SERIALSTATUSID='SRS05' THEN 1 ELSE 0 END)ACTIVATED,
sum(CASE WHEN SERIALSTATUSID='SRS06' THEN 1 ELSE 0 END)Terminated,
sum(CASE WHEN SCRAPSTATUSID='CST01' THEN 1 ELSE 0 END)scraped,
sum(CASE WHEN LOCKSTATUSID='CST01' THEN 1 ELSE 0 END)locked,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
from (SELECT TO_CHAR(CREATEDATE,'DD-MON-YYYY')MONTH1 ,PINUSAGEMODEID,SERIALBATCHID,SERIALIDCOUNT,CREATEDATE FROM TBLMSERIALBATCH )TSB,
tblmserial ts
where TSB.SERIALBATCHID=ts.SERIALBATCHID
and to_char(TSB.CREATEDATE,'MON-YYYY')='$1'
GROUP BY TSB.MONTH1
order by TO_DATE(MONTH1,'dd-mon-yyyy') DESC</QUERY>
<CONNECTIVITYID>C0001</CONNECTIVITYID>
<INPUTREQUIRED>Y</INPUTREQUIRED>
<INPUTNAME>Month</INPUTNAME>
<CREATEDATE>30-JAN-10</CREATEDATE>
<LASTMODIFIEDDATE>22-FEB-10</LASTMODIFIEDDATE>
<CREATEDBY>reportadmin</CREATEDBY>
<LASTMODIFIEDBY>reportadmin</LASTMODIFIEDBY>
<TITLEPARAM>Y</TITLEPARAM>
<SUBTITLE>Date wise Summary of pins Report For &1</SUBTITLE>
<ELEMENTTYPEID>AET002</ELEMENTTYPEID>
<REPORTTYPEID>RTP01</REPORTTYPEID>
<SORTFIELD>Disable</SORTFIELD>
</ROW>
</ROWSET>
But in that it is taking ''' for ' ' instead of '$1' it is taking '$1'
how to keep ' ' in XML file instead of &apos?You can use bcp with query out option
use your above query as the source query and use queryout option after specifying destination as your required local file path (specify extension as .xml)
see
http://visakhm.blogspot.com/2013/10/bcp-out-custom-format-data-to-flat-file.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Using CLOB in 8.1.7
Hi,
Well, everything here seems simple with the use of CLOB. But unfortunately, it springs up a surprise,to me atleast, when compiled.
l_clob clob :=
'<?xml version = "1.0"?>
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<ENAME>SEANDILLON</ENAME>
<JOB>DBDUDE</JOB>
<MGR>7902</MGR>
<HIREDATE>12/17/1980 0:0:0</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="2">
<EMPNO>7499</EMPNO>
<ENAME>TOMKYTE</ENAME>
<JOB>DBDUDE</JOB>
<MGR>7698</MGR>
<HIREDATE>2/20/1981 0:0:0</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
<ROW num="3">
<EMPNO>7521</EMPNO>
<ENAME>MICKEYMOUS</ENAME>
<JOB>RAT</JOB>
<MGR>7698</MGR>
<HIREDATE>2/22/1981 0:0:0</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
</ROWSET>';
It throws the following error
PLS-00382: expression is of wrong type. What is astonishing is even if I initialize l_clob with a simple value like 'Hello World',the error persists.Can anyone please help me.The problem is that works into a 9.2 database :
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> declare
2 l_clob clob :=
3 '<?xml version = "1.0"?>
4 <ROWSET>
5 <ROW num="1">
6 <EMPNO>7369</EMPNO>
7 <ENAME>SEANDILLON</ENAME>
8 <JOB>DBDUDE</JOB>
9 <MGR>7902</MGR>
10 <HIREDATE>12/17/1980 0:0:0</HIREDATE>
11 <SAL>800</SAL>
12 <DEPTNO>20</DEPTNO>
13 </ROW>
14 <ROW num="2">
15 <EMPNO>7499</EMPNO>
16 <ENAME>TOMKYTE</ENAME>
17 <JOB>DBDUDE</JOB>
18 <MGR>7698</MGR>
19 <HIREDATE>2/20/1981 0:0:0</HIREDATE>
20 <SAL>1600</SAL>
21 <COMM>300</COMM>
22 <DEPTNO>30</DEPTNO>
23 </ROW>
24 <ROW num="3">
25 <EMPNO>7521</EMPNO>
26 <ENAME>MICKEYMOUS</ENAME>
27 <JOB>RAT</JOB>
28 <MGR>7698</MGR>
29 <HIREDATE>2/22/1981 0:0:0</HIREDATE>
30 <SAL>1250</SAL>
31 <COMM>500</COMM>
32 <DEPTNO>30</DEPTNO>
33 </ROW>
34 </ROWSET>';
35 begin
36 null;
37 end;
38 /
PL/SQL procedure successfully completed.
SQL> And not work onto my old 8i db like for the OP.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - 64bit Production
With the Partitioning option
JServer Release 8.1.7.4.0 - 64bit Production
SQL> declare
2 l_clob clob :=
3 '<?xml version = "1.0"?>
4 <ROWSET>
5 <ROW num="1">
6 <EMPNO>7369</EMPNO>
7 <ENAME>SEANDILLON</ENAME>
8 <JOB>DBDUDE</JOB>
9 <MGR>7902</MGR>
10 <HIREDATE>12/17/1980 0:0:0</HIREDATE>
11 <SAL>800</SAL>
12 <DEPTNO>20</DEPTNO>
13 </ROW>
14 <ROW num="2">
15 <EMPNO>7499</EMPNO>
16 <ENAME>TOMKYTE</ENAME>
17 <JOB>DBDUDE</JOB>
18 <MGR>7698</MGR>
19 <HIREDATE>2/20/1981 0:0:0</HIREDATE>
20 <SAL>1600</SAL>
21 <COMM>300</COMM>
22 <DEPTNO>30</DEPTNO>
23 </ROW>
24 <ROW num="3">
25 <EMPNO>7521</EMPNO>
26 <ENAME>MICKEYMOUS</ENAME>
27 <JOB>RAT</JOB>
28 <MGR>7698</MGR>
29 <HIREDATE>2/22/1981 0:0:0</HIREDATE>
30 <SAL>1250</SAL>
31 <COMM>500</COMM>
32 <DEPTNO>30</DEPTNO>
33 </ROW>
34 </ROWSET>';
35 begin
36 null;
37 end;
38 /
'<?xml version = "1.0"?>
ERROR at line 3:
ORA-06550: line 3, column 1:
PLS-00382: expression is of wrong type
ORA-06550: line 2, column 8:
PL/SQL: Item ignoredNicolas.
Maybe you are looking for
-
Transfering image, sound and text from server to client
I implemented a client and a server and right now it is only implemented that it transfers only plain .txt documents only. Now I want to alter it to transfer everything. I was thinking about reading the data and then create a new file in the client a
-
Converting,importing,timeline......
i recently converted a uncopyrighted dvd using streamclip &mpeg-2 playback for import into fce hd.settings were apple dv dvcpro ntsc..fps 29.97...exported to quicktime..imported into fce..but when taken to timeline..yes..it says..unrendered..its on s
-
I am building an app that has hundreds of pages, is there a limit?
I am building an app that has hundreds of pages, is there a limit? I think i could have about 400-500 pages. i have heard that if it resembles a book it will get rejected, does anyone know about this? thanks
-
How to center in a Scene?
I'm liking the layouts, but I haven't figured out how to center something in a Scene. It doesn't take LayoutInfo, for example. What's a good way to center a Component (a VBox in this case) in a Scene? Thanks, Dave
-
Progress Billing Invoices in OM with Project Reference ?
Hello Guys, Can anyone help me on this Question, Version - > 11i Sales Company -> Different OU and LE. Manufacturing Plant -> Different OU and LE. Billing from OM to AR. Their will be progress billing invoices generated from manufacturing plant agani