Extract data from complex XML of XMLType with nodes parents containing several internal nodes
Hello
I use Google geocoding XML Web Service to try to enrich some geo data in the database. I've kept all the Google result in an XMLType column, the result is something like this:
<? XML version = "1.0" encoding = "UTF-8"? >
< GeocodeResponse >
< status > OK < / status >
< result >
Zip_code < type > < / type >
< formatted_address > 76279, Saudi Arabia < / formatted_address >
< address_component >
< > 76279 long_name < / long_name >
< > 76279 short_name < / short_name >
Zip_code < type > < / type >
< / address_component >
< address_component >
< long_name > Northern Frontier Province < / long_name >
< short_name > Northern Frontier Province < / short_name >
administrative_area_level_1 < type > < / type >
< Type > policy < / type >
< / address_component >
< address_component >
< long_name > Saudi Arabia < / long_name >
< short_name > SA < / short_name >
country of < type > < / type >
< Type > policy < / type >
< / address_component >
< geometry >
< location >
< lat > 29.1214197 < / lat >
< LNG > 44.3945656 < / LNG >
< / location >
< location_type > APPROX. < / location_type >
< window >
< Southwest >
< lat > 29.1016132 < / lat >
< LNG > 44.3654665 < / LNG >
< / Southwest >
< Northeast >
< lat > 29.1400926 < / lat >
< LNG > 44.4116001 < / LNG >
< / Northeast >
< / window >
< limits >
< Southwest >
< lat > 29.1016132 < / lat >
< LNG > 44.3654665 < / LNG >
< / Southwest >
< Northeast >
< lat > 29.1400926 < / lat >
< LNG > 44.4116001 < / LNG >
< / Northeast >
< / delimits >
< / geometry >
< place_id > ChIJcy767DIAYxURohAm-DLSunw < / place_id >
< / result >
< result >
locality < type > < / type >
< Type > policy < / type >
Foucart, France < formatted_address > < / formatted_address >
< address_component >
< long_name > Foucart < / long_name >
< short_name > Foucart < / short_name >
locality < type > < / type >
< Type > policy < / type >
< / address_component >
< address_component >
< long_name > Seine-Maritime < / long_name >
< > 76 short_name < / short_name >
administrative_area_level_2 < type > < / type >
< Type > policy < / type >
< / address_component >
< address_component >
< long_name > upper Normandy < / long_name >
< short_name > upper Normandy < / short_name >
administrative_area_level_1 < type > < / type >
< Type > policy < / type >
< / address_component >
< address_component >
< long_name > France < / long_name >
< short_name > EN < / short_name >
country of < type > < / type >
< Type > policy < / type >
< / address_component >
< geometry >
< location >
< lat > 49.6131170 < / lat >
< LNG > 0.5951040 < / LNG >
< / location >
< location_type > APPROX. < / location_type >
< window >
< Southwest >
< lat > 49.6019770 < / lat >
< LNG > 0.5731880 < / LNG >
< / Southwest >
< Northeast >
< lat > 49.6329760 < / lat >
< LNG > 0.6081609 < / LNG >
< / Northeast >
< / window >
< limits >
< Southwest >
< lat > 49.6019770 < / lat >
< LNG > 0.5731880 < / LNG >
< / Southwest >
< Northeast >
< lat > 49.6329760 < / lat >
< LNG > 0.6081609 < / LNG >
< / Northeast >
< / delimits >
< / geometry >
< place_id > ChIJQdTiHHJc4EcRUIO2T0gUDAQ < / place_id >
< / result >
< / GeocodeResponse >
Here are practically two entries from geo (the /result of xml nodes), and each entry has multiple secondary entries of type address_component and a secondary entrance to the geometry of type.
I can get the entries in the result of this query:
SELECT xt.*
OF zip_tree_sort_xml x,.
XMLTABLE ("' / GeocodeResponse/result")
PASSAGE x.google_geodata_xml
COLUMNS
Path of 'FORMATTED_ADDRESS' VARCHAR2 (200) "formatted_address".
) xt;
The subnodes XML type address_component and type geometry of teas and those below:
SELECT xt.*
OF zip_tree_sort_xml x,.
XMLTABLE ('/ GeocodeResponse/result/address_component ')
PASSAGE x.google_geodata_xml
COLUMNS
Path of "LONG_NAME' VARCHAR2 (200)"long_name. "
'SHORT_NAME' VARCHAR2 (500) PATH 'short_name ',.
Path ACCESS VARCHAR2 (200) from 'TYPE_1' 'type [1]. "
Path ACCESS VARCHAR2 (200) to 'TYPE_2' 'type [2].
) xt;
SELECT xt.*
OF zip_tree_sort_xml x,.
XMLTABLE ("/ GeocodeResponse/result/geometry/location")
PASSAGE x.google_geodata_xml
COLUMNS
"latitude" NUMBER PATH 'lat ',.
"longitude" NUMBER PATH 'LNG '.
) xt;
But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?
Best regards
Rodriguez
But y at - it anyway to join the two subnodes XML below with the parent that above? So I can only get correct result attributes?
You can do chaining XMLTABLE another that will handle the address_component expandable nodes.
Data from the geometry node can be extracted at the same level as a result.
SQL> select x1.formatted_address 2 , x2.long_name 3 , x2.short_name 4 , x2.type_1 5 , x2.type_2 6 , x1.latitude 7 , x1.longitude 8 from zip_tree_sort_xml t 9 , xmltable('/GeocodeResponse/result' 10 passing t.google_geodata_xml 11 columns 12 formatted_address varchar2(200) path 'formatted_address' 13 , address_components xmltype path 'address_component' 14 , latitude number path 'geometry/location/lat' 15 , longitude number path 'geometry/location/lng' 16 ) x1 17 , xmltable('/address_component' 18 passing x1.address_components 19 columns 20 long_name varchar2(200) path 'long_name' 21 , short_name varchar2(500) path 'short_name' 22 , type_1 varchar2(200) path 'type[1]' 23 , type_2 varchar2(200) path 'type[2]' 24 ) x2 ; FORMATTED_ADDRESS LONG_NAME SHORT_NAME TYPE_1 TYPE_2 LATITUDE LONGITUDE ----------------------- --------------------------- ---------------------------- ------------------------------ ---------- ---------- ---------- 76279, Saudi Arabia 76279 76279 postal_code 29,1214197 44,3945656 76279, Saudi Arabia Northern Borders Province Northern Borders Province administrative_area_level_1 political 29,1214197 44,3945656 76279, Saudi Arabia Saudi Arabia SA country political 29,1214197 44,3945656 Foucart, France Foucart Foucart locality political 49,613117 0,595104 Foucart, France Seine-Maritime 76 administrative_area_level_2 political 49,613117 0,595104 Foucart, France Upper Normandy Upper Normandy administrative_area_level_1 political 49,613117 0,595104 Foucart, France France FR country political 49,613117 0,595104 7 rows selected.
Tags: Database
Similar Questions
-
Extract data from an xml file takes almost an hour to 2.5 M data.
Hello
Any help would be much appreciated. Extract data from an xml file takes almost an hour to 2.5 M. data is there a solution to this.
WITH t AS
(SELECT XMLTYPE (response) pass FROM dual
)
SELECT
b.entity_id,
c.INSTANCE_ID,
d.attribute_id,
d.DATA_TYPE,
d.ATTRIBUTE_VALUE,
d.outcome_style
T,.
XMLTABLE (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, ' SOAP - ENV:Envelope / SOAP - ENV:Body / typ: assess-response/typ: global instance / typ:entity'
PASSAGE t.col
Path of COLUMNS entity_id VARCHAR2 (256) "@id".
path XMLTYPE res_tmp2 'typ:instance') b
xmltable (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, "typ:instance".
PASSAGE b.res_tmp2
Path of COLUMNS instance_id VARCHAR2 (256) "@id".
path XMLTYPE res_tmp3 'typ:attribute') c
xmltable (XMLNamespaces ("http://schemas.xmlsoap.org/soap/envelope/" AS "SOAP-ENV"
'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS 'type')
, "typ:attribute".
PASSAGE c.res_tmp3
Path of VARCHAR2 (256) COLUMNS attribute_id '@id '.
, data_type VARCHAR2 (256) path '@type '.
, attribute_value VARCHAR2 (256) path '.'
path VARCHAR2 (256) outcome_style '@inferred') d;
Thank you
MhandOK, in this case the best option is to store the answer in a binary table of XMLType (may be a temporary table if you want to) and run the query from there:
CREATE TABLE tmp_xml OF XMLType XMLType STORE AS SECUREFILE BINARY XML -- default storage in your version ;
INSERT INTO tmp_xml VALUES(XMLType(response));
SELECT b.entity_id, c.instance_id, d.attribute_id, d.data_type, d.attribute_value, d.outcome_style FROM tmp_xml t, XMLTABLE( XMLNamespaces('http://schemas.xmlsoap.org/soap/envelope/' AS "SOAP-ENV" , 'http://oracle.com/determinations/server/10.3/rulebase/assess/types' AS "typ") , 'SOAP-ENV:Envelope/SOAP-ENV:Body/typ:assess-response/typ:global-instance/typ:entity' PASSING t.object_value COLUMNS ...
-
Extract data from xml file item
I inserted all data from an xml file into an xml table in the database (after creating the directory and getclobdocument function)
with
INSERT INTO TEST_XML
SELECT (XMLTYPE (getCLOBDocument ('MXMLF.xml'))) FROM DUAL;
Now how to extract the individual item in the relational table my data in the xml table is something like the following.
rowset <>
< TransmissionHeader >
< TransmissionDateTime > 2008 - 12 - 04T 09: 30:47 - 05:00 < / TransmissionDateTime >
IATA:ISXMLInvoiceV3.1 < version > < / Version >
< IssuingOrganizationID > 111 < / IssuingOrganizationID >
< BillingCategory > various < / BillingCategory >
< / TransmissionHeader >
< invoice >
< InvoiceHeader >
< InvoiceNumber > 182792000 < / InvoiceNumber >
< invoiceDate > 2007 - 12 - 19 < / InvoiceDate >
Bill < InvoiceType > < / InvoiceType >
< LocationCode > EWR < / LocationCode >
Engineering of < ChargeCategory > < / ChargeCategory >
< SellerOrganization >
< > 111 OrganizationID < / OrganizationID >
< OrganizationDesignator > ZZ < / OrganizationDesignator >
Zed airlines < Nomorganisation1 > < / Nomorganisation1 >
< TaxRegistrationID > 111ABC111 < / TaxRegistrationID >
< CompanyRegistrationID > ABC111ABC < / CompanyRegistrationID >
Patrick < ContactName > < / ContactName >
< address >
< > 111, Zed AddressLine1 headquarters < / AddressLine1 >
Montreal < CityName > < / Nom_ville >
< CountryCode > CA < / CountryCode >
Canada < CountryName > < / CountryName >
< code postal > 110011 < / code >
< / address >
< / SellerOrganization >
< BuyerOrganization >
< > 222 OrganizationID < / OrganizationID >
< OrganizationDesignator > GG < / OrganizationDesignator >
< Nomorganisation1 > Globe Airlines < / Nomorganisation1 >
< TaxRegistrationID > GB22200222 < / TaxRegistrationID >
< CompanyRegistrationID > Go 222 222 < / CompanyRegistrationID >
George < ContactName > < / ContactName >
< address >
< AddressLine1 > 222, Globe headquarters < / AddressLine1 >
London < CityName > < / Nom_ville >
< CountryCode > GB < / CountryCode >
England < CountryName > < / CountryName >
< code postal > 220022 < / code >
< / address >
< / BuyerOrganization >
< ConditionsPaiement >
< CurrencyCode > $ < / CurrencyCode >
< SettlementMonthPeriod > 071203 < / SettlementMonthPeriod >
< SettlementMethod > I < / SettlementMethod >
< / ConditionsPaiement >
< ISDetails >
< DigitalSignatureFlag > N < / DigitalSignatureFlag >
< / ISDetails >
< setting >
< AttachmentIndicatorOriginal > Y < / AttachmentIndicatorOriginal >
< / fixing >
< / InvoiceHeader >
< LineItem >
< LineItemNumber > 1 < / LineItemNumber >
< ChargeCode > MRO repairs and review < / ChargeCode >
< description > package for unique maintenance work. Water VAVLE drain compl. P/N 9350022 < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice SF = "1" > 300,0000 < / UnitPrice >
< ChargeAmount > 300,00 < / ChargeAmount >
< TotalNetAmount > 300,00 < / TotalNetAmount >
< / LineItem >
< LineItem >
< LineItemNumber > 2 < / LineItemNumber >
< ChargeCode > MRO repairs and review < / ChargeCode >
< description > material consumption for the single interview. Water VAVLE drain compl. P/N 9350022, S/N FRTR013AW < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice SF = "1" > 900.0000 < / UnitPrice >
< ChargeAmount > 900.00 < / ChargeAmount >
< TotalAddOnChargeAmount > 180.00 < / TotalAddOnChargeAmount >
< TotalNetAmount > 1080.00 < / TotalNetAmount >
< / LineItem >
< LineItemDetail >
< DetailNumber > 1 < / DetailNumber >
< LineItemNumber > 1 < / LineItemNumber >
< description > package for unique maintenance work. Water VAVLE drain compl. P/N 9350022 < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice > 300,0000 < / UnitPrice >
< ChargeAmount > 300,00 < / ChargeAmount >
< TotalNetAmount > 300,00 < / TotalNetAmount >
< AircraftDetails >
< AircraftRegistrationNo > DAIGS < / AircraftRegistrationNo >
< PartNo > 9350022 < / PartNo >
< / AircraftDetails >
< / LineItemDetail >
< LineItemDetail >
< DetailNumber > 1 < / DetailNumber >
< LineItemNumber > 2 < / LineItemNumber >
< description > material consumption diaphragm < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice > 200.0000 < / UnitPrice >
< ChargeAmount > 200.00 < / ChargeAmount >
< AddOnCharges >
Handling of < AddOnChargeName > < / AddOnChargeName >
< AddOnChargePercentage > 20.00 < / AddOnChargePercentage >
< AddOnChargeableAmount > 200.00 < / AddOnChargeableAmount >
< AddOnChargeAmount > 40.00 < / AddOnChargeAmount >
< / AddOnCharges >
< TotalNetAmount > 240.00 < / TotalNetAmount >
< AircraftDetails >
< AircraftRegistrationNo > DAIGS < / AircraftRegistrationNo >
< PartNo > 9350584 < / PartNo >
< / AircraftDetails >
< / LineItemDetail >
< LineItemDetail >
< DetailNumber > 2 < / DetailNumber >
< LineItemNumber > 2 < / LineItemNumber >
< description > material consumption coverage < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice > 177.5000 < / UnitPrice >
< ChargeAmount > 177,50 < / ChargeAmount >
< AddOnCharges >
Handling of < AddOnChargeName > < / AddOnChargeName >
< AddOnChargePercentage > 20.00 < / AddOnChargePercentage >
< AddOnChargeableAmount > 177,50 < / AddOnChargeableAmount >
< AddOnChargeAmount > 35.50 < / AddOnChargeAmount >
< / AddOnCharges >
< TotalNetAmount > 213,00 < / TotalNetAmount >
< AircraftDetails >
< AircraftRegistrationNo > DAIGS < / AircraftRegistrationNo >
< PartNo > 9350595 < / PartNo >
< / AircraftDetails >
< / LineItemDetail >
< LineItemDetail >
< DetailNumber > 3 < / DetailNumber >
< LineItemNumber > 2 < / LineItemNumber >
Assembly of material consumption - Base < description > < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice > 520.0000 < / UnitPrice >
< ChargeAmount > 520.00 < / ChargeAmount >
< AddOnCharges >
Handling of < AddOnChargeName > < / AddOnChargeName >
< AddOnChargePercentage > 20.00 < / AddOnChargePercentage >
< AddOnChargeableAmount > 520.00 < / AddOnChargeableAmount >
< AddOnChargeAmount > 104.00 < / AddOnChargeAmount >
< / AddOnCharges >
< TotalNetAmount > 624,00 < / TotalNetAmount >
< AircraftDetails >
< AircraftRegistrationNo > DAIGS < / AircraftRegistrationNo >
< PartNo > 9350598 < / PartNo >
< / AircraftDetails >
< / LineItemDetail >
< LineItemDetail >
< DetailNumber > 4 < / DetailNumber >
< LineItemNumber > 2 < / LineItemNumber >
Packaging material consumption < description > < / Description >
< EndDate > 2007 - 12 - 10 < / EndDate >
< UOMCode quantity = "EA" > 1.0000 < / quantity >
< UnitPrice > 0.0800 < / UnitPrice >
< ChargeAmount > 0.08 < / ChargeAmount >
< AddOnCharges >
Handling of < AddOnChargeName > < / AddOnChargeName >
< AddOnChargePercentage > 20.00 < / AddOnChargePercentage >
< AddOnChargeableAmount > 0.08 < / AddOnChargeableAmount >
< AddOnChargeAmount > 0.02 < / AddOnChargeAmount >
< / AddOnCharges >
< TotalNetAmount > 0.10 < / TotalNetAmount >
< AircraftDetails >
< AircraftRegistrationNo > DAIGS < / AircraftRegistrationNo >
< PartNo > AS3209-009 < / PartNo >
< / AircraftDetails >
< / LineItemDetail >
How now?
Please a little helpI tried to
instead of but of no use The new element in the root is 'InvoiceTransmission', so replace 'Lines' with it.
In addition, there is now a default namespace, you must declare it as well:SELECT x1.InvoiceNumber , x1.InvoiceDate , x1.InvoiceType , x1.LocationCode , x2.* , x3.* FROM test_xml t , XMLTable( XMLNamespaces(default 'http://www.IATA.com/IATAAviationInvoiceStandard') , '/InvoiceTransmission/Invoice' passing t.object_value columns InvoiceNumber number path 'InvoiceHeader/InvoiceNumber' , InvoiceDate date path 'InvoiceHeader/InvoiceDate' , InvoiceType varchar2(30) path 'InvoiceHeader/InvoiceType' , LocationCode varchar2(3) path 'InvoiceHeader/LocationCode' , LineItems xmltype path 'LineItem' , LineItemDetails xmltype path 'LineItemDetail' ) x1 , XMLTable( XMLNamespaces(default 'http://www.IATA.com/IATAAviationInvoiceStandard') , '/LineItem' passing x1.LineItems columns LineItemNumber number path 'LineItemNumber' , ChargeCode varchar2(80) path 'ChargeCode' , Description varchar2(200) path 'Description' , EndDate date path 'EndDate' , Quantity number(8,4) path 'Quantity' , Quantity_UOM varchar2(3) path 'Quantity/@UOMCode' , UnitPrice number(8,4) path 'UnitPrice' , UnitPrice_SF varchar2(3) path 'UnitPrice/@SF' , ChargeAmount number(6,2) path 'ChargeAmount' , TotalAddOnChargeAmount number(6,2) path 'TotalAddOnChargeAmount' , TotalNetAmount number(6,2) path 'TotalNetAmount' ) x2 , XMLTable( XMLNamespaces(default 'http://www.IATA.com/IATAAviationInvoiceStandard') , '$d/LineItemDetail[LineItemNumber=$lin]' passing x1.LineItemDetails as "d" , x2.LineItemNumber as "lin" columns AircraftRegistrationNo varchar2(30) path 'AircraftDetails/AircraftRegistrationNo' , PartNo varchar2(30) path 'AircraftDetails/PartNo' ) x3 ;
-
extract data from XMLType using vbscript on OleDB?
Hello.
We have a problem where the XMLType column data to get in 11.2.0.1 on Windows x 64 worked very well, but we have moved to 11.2.0.3 Patch 21 and the column type changed to binary storage default, and we started to do read errors when the data was greater than 32 k (or so it seems).
I opened a SR, and Oracle support sent me a VB script to test playback of the table on OleDB. However, their script doesn't seem to work as announced, so after a lot of gooling, came to us with the following to read a column of xmltype - not the same table, just to test that the vbscript works:
REM need to re-register the dll OLEDB as there is a problem with the oracle client and the dll registration
REM start following an administrator command prompt
REM regsvr32.exe c:\Users\finite9\oracle\product\11.2.0\client_2\bin\oraoledb11.dll
the con value = createobject ("adodb.connection")
con. Open "provider = oraoledb.oracle; user id = finite9; password = password1; data source = TSTDB ".
Set rs = createobject ("adodb.recordset")
RS. Open 'select SW_REPLY changedate', con
While not on the place. EXPRESSIONS OF FOLKLORE
MsgBox rs. Fields ("ChangeDate"). Value
RS. MoveNext
Wend
RS. Close
Set rs = nothing
con. Close
the value con = nothing
This works perfectly and displays 12 rows in this column in a vbscript dialog box, but I am not able to do to extract the XMLType column clob data. I try with for example. RS. Open 'select REPLYDATA.getclobval () from SW_REPLY', stupid but just get errors.
Is it possible to extract data from XMLType on OleDB with vbscript? It cannot be OleDB itself which poses problem, because it has worked in our application and 11.2.0.1 although with < 32 k of data. But it would be nice to have a working test case while we were able to test out our app. If it is with vbscript or c# is irrelevant.
ignore the message, it is possible. Support of Oracle gave me this:
the con value = createobject ("adodb.connection")
con. Open "provider = oraoledb.oracle; user id = finite9; password = password1; data source = DEVTST ".
Set rs = createobject ("adodb.recordset")
RS. Open "select t.REPLYDATA.getclobval () as xmltestdata OF SW_REPLY t", con
While not on the place. EXPRESSIONS OF FOLKLORE
MsgBox rs. Fields ("xmltestdata"). Value
RS. MoveNext
Wend
RS. Close
Set rs = nothing
con. Close
the value con = nothing
but there is a problem when xmldata exceeds a certain size. small starters work well if.
-
Extract data from xml zipped files.
Hello
I have a table with a blob field and because of space constraints, I save my huge xml file in the format compressed in this blob field.
Is it possible to extract data from the blob field xml?
Thank you
Vincent pekYes.
Have a look here: http://technology.amis.nl/blog/8090/parsing-a-microsoft-word-docx-and-unzip-zipfiles-with-plsql (be aware, "docx" is also a zip file)
-
Extract data from Oracle into excel file
Hello
I have a requirement where in I need to extract data from Oracle into excel file and the worksheet excel name should be 'given '.
for example. Excel 'AR Data_DDMMYY' file name and the name of the "Data" sheet excel
I used the UTL_FILE API to extract the data delimited by tabs that you can open in excel, but it's not exactly an excel file as the name of the worksheet is the same as the name of the file.
I tried to use utl_file.fcopy and frename.
Is it possible to do it using PLSQL?
Select * from version of v$.
Example Code:Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi PL/SQL Release 10.2.0.5.0 - Production "CORE 10.2.0.5.0 Production" TNS for HPUX: Version 10.2.0.5.0 - Production NLSRTL Version 10.2.0.5.0 - Production
Thank youdeclare cursor c is select * from scott.emp; v varchar2(100); f utl_file.file_type; file_name varchar2(100) := 'AR Data.xls'; dir varchar2(50) := 'CESDIR191710'; --select * from dba_directories begin f := utl_file.fopen(dir, file_name, 'W'); v := 'EMPNO'||chr(9)||'ENAME'||chr(9)||'JOB'||chr(9)||'SAL'||chr(9)||'HIREDATE'||chr(9)||'DEPTNO'; utl_file.put_line(f, v); for i in c loop v := i.empno||chr(9)||i.ename||chr(9)||i.job||chr(9)||i.sal||chr(9)||i.hiredate||chr(9)||i.deptno; utl_file.put_line(f, v); end loop; utl_file.fclose(f); --utl_file.frename(dir, file_name, dir, replace(file_name, '.xls', '_')||to_char(sysdate, 'MMDDYY')||'.xls', false); utl_file.fcopy(dir, file_name, dir, replace(file_name, '.xls', '_')||to_char(sysdate, 'MMDDYY')||'.xls'); end;
ImranHello
I tried to change the .xlsx to .xls and it gives a note at the opening of the file "the file you are trying to open, abc.xls, is in a different format that it is specified by the file extension. Check that the file is not corrupted and precedes from a trusted source before you open the file. Do you want to open it now? »
When you rename the file does not solve your problem.
Anton Scheffer package generates a file in format xlsx Office 2010. When rename you it with the .xls extension, then Office 2010 will give you the warning that the file format does not match the extension.but the requirement has to generate excel 2003 file.
The xml_spreadsheet package writes a format that was introduced with Office 2003, but you must use .xml as extension in other Office 2010 will give you the same caveat.
To write the real xls version (binary), you can use Apache POI. You will need to import Java classes in your db and write a PL/SQL wrapper. Or you can use one of the options above, writing the output to a windows server and then use Excel to open and save in the required format.You must decide whether it is easier to write the binary xls format or to convince the customer to accept other formats that can be opened with Excel.
Concerning
Marcus -
1074118649 error occurred at niUSRP extract data from Rx (2D CBD) .vi
Hello
When I was trying the example of the USRP OR which is "niUSRP EX Rx synchronized to multiple entries (MIMO Expansion)", a mistake is released which is
1074118649 error occurred at niUSRP extract data from Rx (2D CBD) .vi
A workflow command has been issued in the past.
can anyboay help me solve the problem?
Thank you very much
Andy
Hi andy,.
what you need to do is reversing the Oder river where the screw niUSRP the value Time.vi and niUSRP Trigger.vi configure a1.1ppear. Time of first setting then set up trigger. The example works correctly with version 1.1, since you are using version 1.2, that changes must be made.
In the example, you can set the clock to standard time (start time = 0) even if you had already triggered the reception. Thus, samples received will be acquired with time stamp later where the error.
Best regards
-
Extract data from form DPS 2015?
I have a registration form with some fields such as name, email etc. identification and a "submit" button.
Here are a few questions about this:
1. can I create a form with fields (name, e-mail id) in 2015 DPS.
2. If so, how can retrieve us the data from the form after submission. Is there an API to extract data from form of DPS 2015?
3. where we store the data? Can it be stored in the AEM or DPS?
Appreciate your suggestions and help.
Hi Kalyan,
It's nothing built in DPS to do this, however you can use the HTML articles for this feature. You will need to write JavaScript code to handle the #2 and #3 elements. It is up to you to decide where you want to store the information collected. Usually you get shipped back through a Web service to a site or a database, you manage.
Neil
-
Extract data from error HFM, float to Numeric?
Hi all
We extract data from HFM,.
HFM-> SQL-> FILE staging
Our mapping, flow, everything seems fine. When we run this out on the third market errors while extracting data with the following:
com.hyperion.odi.common.ODIHAppException: arithmetic overflow error conversion float type numeric data.
We researched and found to increase the logical length should solve this problem.
Our Source has a length of 16...
We have increased the logical length of target from 16 to 30, and he rest-error. We even tried 50, 100 for the logical length.
We are at Version 10.1.3.6.0.
Any suggestions on how to fix this?
Thank you!
Published by: user10678366 on May 22, 2013 13:28Have you tried changing the scale of all the columns float, right?
It can be a ridiculously large number coming from HFM. So, go to store for your data source in ODI and manually change the data type of column type VARCHAR of size like 100 or more. That would force the ODI to create the staging table with columns of characters for the field. Data will be retrieved anyway. Given that you write it in file, type of character should not matter. In addition, if writing to the file fails for any reason, you can do a max on the staging table and find the value problem in the table (while in HFM, you may not be able to do).
-
Extract data from the table on hourly basis
Hello
I have a table that has two columns date all the hours of the base and the response time. I want to extract data from the date corresponding previous hourly basis with the response time. The data will be loaded into the table every midnight.
for example: today date 23/10/2012
I want to extract data from 22/10/12 00 to the 22/10/12 23
The sub query pulls the date as demanded, but I'm not able to take the time to answer.
with one also
(select min (trunc (lhour)) as mindate, max (trunc (lhour)) as AVG_HR maxdate)
SELECT to_char (maxdate + (level/25), "dd/mm/yyyy hh24") as a LEVEL CONNECTION dates < = * (1) 24;
Please help me on this.Try this
SELECT * FROM table_nm WHERE to_char(hour,'DD') = to_char(SYSDATE-1,'DD')
-
extract data from a table to a text file
I need to extract data from a table to a text file, I twist my output is the following...
bash-3. $00 vi tap3roamercosts_20110915144318.txt
lines of 'tap3roamercosts_20110915144318.txt' 393948, 23464348 characters
^ LAFGTD | N | 2011090203000001 | 13242514000064 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
755. 64. 70. 0093794428588 | 0093796234547 | 0 | S2 | E | 412200306902634 | 8. 1. 61500 | 16081 |
| HW | Call to the Roamer. 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | LKA | N_I_Independent
the time of day. Rate of Roamer SMST systems | AFGTD20110902030000010001013242514000064 |
|||||||||||||||||||||
AFGTD | N | 2011090203000001 | 13242612000044 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 44. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000044 |
||||||||
AFGTD | N | 2011090203000001 | 13242612000047 | 1. 0 | 20. 41220 | 02-SEVEN.-11. 01-SEPT.-11. 0 | 13244
853. 47. 70. 234. 0093793252818 | 0 | S2 | E | 412200303198150 | 8. 1. 61000 | 12403 | HW | -Ro
bitter call | 0 | I have | Roaming billing Inroamer Plan | 1_0_1 | N_I_Independent time of Da
There | Rate of Roamer SMST systems | AFGTD20110902030000010001013242612000047 |
||||||||
.
.
.
.
.
Please help me how to format my output each record in simple lines in oracle sqlplus. Here are the settings I used...
TERMOUT OFF SET;
SET ECHO OFF;
SET LINESIZE 100000;
THE VALUE OF NEWPAGE 0;
SET SPACE 0;
SET PAGESIZE 50000;
SET FEEDBACK OFF;
SET THE OFF POSITION;
SET TRIMSPOOL
SET THE TABAnd what was wrong with the answers that you have on your previous thread?
How to extract data in a text file
Please do not ask the same question again. If there is a problem with the answers provided, then continue on the same thread that tell people what is the problem.
Saying that, this is another possibility for you...
As user sys:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles' / GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser /
As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2 ,p_dir IN VARCHAR2 ,p_header_file IN VARCHAR2 ,p_data_file IN VARCHAR2 := NULL) IS v_finaltxt VARCHAR2(4000); v_v_val VARCHAR2(4000); v_n_val NUMBER; v_d_val DATE; v_ret NUMBER; c NUMBER; d NUMBER; col_cnt INTEGER; f BOOLEAN; rec_tab DBMS_SQL.DESC_TAB; col_num NUMBER; v_fh UTL_FILE.FILE_TYPE; v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file); BEGIN c := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE); d := DBMS_SQL.EXECUTE(c); DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab); FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); ELSE DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); END CASE; END LOOP; -- This part outputs the HEADER v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767); FOR j in 1..col_cnt LOOP v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),','); END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); IF NOT v_samefile THEN UTL_FILE.FCLOSE(v_fh); END IF; -- -- This part outputs the DATA IF NOT v_samefile THEN v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767); END IF; LOOP v_ret := DBMS_SQL.FETCH_ROWS(c); EXIT WHEN v_ret = 0; v_finaltxt := NULL; FOR j in 1..col_cnt LOOP CASE rec_tab(j).col_type WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val); v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val); v_finaltxt := ltrim(v_finaltxt||','||v_n_val,','); WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val); v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),','); ELSE v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',','); END CASE; END LOOP; -- DBMS_OUTPUT.PUT_LINE(v_finaltxt); UTL_FILE.PUT_LINE(v_fh, v_finaltxt); END LOOP; UTL_FILE.FCLOSE(v_fh); DBMS_SQL.CLOSE_CURSOR(c); END;
This allows the header line and the data to write into files separate if necessary.
for example
SQL> exec run_query('select * from emp','TEST_DIR','output.txt'); PL/SQL procedure successfully completed.
Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno 7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20 7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30 7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30 7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20 7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30 7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30 7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10 7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20 7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10 7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30 7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20 7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30 7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20 7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.
Adapt to the exit of styles and different types of data are needed.
-
Extract data from Hyperion Planning
Hello Experts,
I have a question that is asked repeatedly. Question is, how to extract data from planning with ODI?
I saw most of the answers saying we need to extract the data of Essbase (as Essbase stores planning data). But what happens if I want to retrieve data that is stored in the relational repository with its data into Essbase? As list of smart, the textual data in the case of system 9?
Thank you
SIDDIt is possible to extract the essbase data and then link to the planning of the relational tables to transform the digital value of essbase in text planning.
See you soon
John
http://John-Goodwin.blogspot.com/ -
Extract data from database using php script and entry for datagrid.
Hi all
I intend to use the php script below to extract data from a database.
I want to then display it in a datagrid control, the datagrid control has Ref columns job, the company and the position.
The php script I have is
<? PHP
$hostname_conn = "localhost";
$username_conn = "";
$password_conn = "";
$conn = mysql_connect ($hostname_conn, $username_conn, $password_conn);
@mysql_select_db ("videochat");
$query = "SELECT * FROM work."
$result = mysql_query ($query);
$row = mysql_fetch_array ($result);
$ref = $row ["jobref"];
$company = $row ['company'];
$position = $row ["position"];
echo "< Ref > $ref < / Ref >";
echo "< company > $company < / company > ';
echo "< location > $position < / location >."
? >Could someone show me how I chuck this data in a grid?
Thank you
Hello
You should start using the authority, either zendamf which is used by the data wizards in flashbuilder 4 or with amfphp which is probably better than zend but has not all nicities such as the creation of objects of value.
This project uses amfphp, basically, it uses remoteobjects so returned php is in a ready to put directly into a grid or a datagroup arraycollection collection.
If you need help with this sort of thing PM me and I can do a login session...
the PHP services for calls used in the application
<>
class pets
{
var $db_host = "localhost";
var $db_name = "flashhub_pets";
var $db_user = "flashhub_david";
var $db_pwd = "david";
function pets()
{
Define the methodTable for this class in the constructor
$this-> methodTable = array)
"getPets"-online (table)
'description' => 'Pets, database',
'access' => 'remote '.
)
);
}
function getAllPets()
{
$mysql = mysql_connect ($this-> $this-> db_user, db_host), $this-> db_pwd;
@mysql_select_db ($this-> db_name);
$Query = "SELECT * from pet;
$Result = mysql_query ($Query);
return ($Result);
}
function getTypeOfPets ($category)
{
$mysql = mysql_connect ($this-> $this-> db_user, db_host), $this-> db_pwd;
@mysql_select_db ($this-> db_name);
$Query = "SELECT * from pet where CATEGORY = $category;
$Result = mysql_query ($Query);
return ($Result);
}
function getCategories()
{
$mysql = mysql_connect ($this-> $this-> db_user, db_host), $this-> db_pwd;
@mysql_select_db ($this-> db_name);
$Query = "SELECT * from category";
$Result = mysql_query ($Query);
return ($Result);
}
}
?>
David
-
I want to extract data from a PDF using Java
I would prefer to extract data from a PDF file and convert them to XML. Is there an API that allows to convert a PDF to an Adobe XML format? Ideally, I would like to add a few JAR files to my classpath, similar to PDFBox. I don't want to install a bunch of components side server or something like that.
Thank you!
Then Adobe does not offer a solution that meets your needs - sorry.
Our solution on the server side is our LiveCycle product family which, however, includes a collection of Java APIs.
-
Query to extract data from source DB driver using process mapping pre...
Hi all
I have a source for the query to retrieve the data from the source database. Looking for suggestion what could be the best approach to extract data from the source database.using owb 11 GR 1 material.
I'm in printing, create the process of mapping driver prerequisite for aid to perform immediate with Create table T1 as a sql query. Petition to the sides of the Insert into T1 Select * from Source_Table in the different database.
Certainly, need to create Db users in the Source database, to get privileges to read the data of source_database.
Is - this good aproach to or of any other alternative to achieve this.
Means, create the table in the transit area (desired area, where I am) and using driver mapping process before you run the select query to retrieve data from a data source.
Would apreciate your previous answer.
Thank you
MAKYou can mark Correct or useful if it solves your purpose.
Maybe you are looking for
-
Satellite U200: sound strange game Spider Solitaire
I just bought a U200-161. Fab small notebook sub BUT... If play you Spider Solitaire on it the sound does not work, instead of cards with a "rat-tat-tat-tat", etc. they are all face and you hear just a 'splat' on the end. I took it back to PC world t
-
format specifier syntax - several commands syntax
Hey guys,. I know there must have been a post to it, but I can't seem to find it. I have several slna (11) that need to be formatted differently (some are dates MMDDYY, some of the values 0,5555) and then written to a file. I'm using and that's why I
-
HP Pavilion TouchSmart 15-n029: HDMI output not working not not on HP Pavilion 15
Hi guys, I'm new here on the HP Forum. My problems started when I got my new laptop and I HATED windows 8. If one of my friends had a drive with Windows 7 above. After installation nothing worked, no WiFi, USB, HDMI and so on. I have serched the days
-
How to copy my photos on a Flash drive
I just bought a new laptop so want to copy my photos from my old laptop to the new. I clicked on copy on cd, but when I inserted the cd it says had not enough space. So I bought a Flash drive, but cannot see how to copy pictures of her. There is only
-
Manufacturing of the playlist - e260
I have an E260 v.1 4 GB with a 2GB minisd card. It is set to MSC usb mode and I want to make the playlists using Winamp 5. It is the Winamp that works on my pc. I know to use the files on the drive, not the ones on my pc and winamp playlist must b