extract data from xml file
Hi allwhat it means:
Select xxx xmltype(transaction_document).extract('//PerAllVacanciesEORow/xxx/text()').getStringVal)I think it gives only the value of the numeric type to a string format
of hr_api_transactions
where transaction_ref_table = 'PER_ALL_VACANCIES. '
and transaction_ref_id = 4608;
Please explain each step in detail
Hello
xmltype(transaction_document)
Which converts the TRANSACTION_DOCUMENT (probably from the CLOB data type) in an XMLType data type column.
.extract('//PerAllVacanciesEORow/xxx/text()')
The part retrieves all text nodes containing elements 'xxx', whose parent is an element of 'PerAllVacanciesEORow '.
Note that if the XPath "//PerAllVacanciesEORow/xxx" corresponds to multiple nodes, then text() values will be concatenated.
.getStringVal()
Converts the XMLType return VARCHAR2 data type.
If you have a problem with the result, post an example of XML, the output data wanted him.
Please also give your version of the database.
Tags: Oracle Development
Similar Questions
-
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 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)
-
Hello
Consider, having more xml file
How can I retrieve the value of the key to lonlat "36.76,3.05."
in my qml file, I had something like
... Page { id: ch_loc Container { //background: Color.White ListView { dataModel: XmlDataModel { source: "LonLat.xml" } listItemComponents: [ ListItemComponent { } ] onTriggered: { //qDebug(indexPath[3]); app.initiateRequest(dataModel.data(indexPath[0])) } } } } ...
I'm on the right track? Need help please.
Thank you, best regards.
Maddin
Hello
OK after some reading, I thought about it.
What I did:
Page { id: ch_loc Container { //background: Color.White ListView { dataModel: XmlDataModel { source: "LonLat.xml" } listItemComponents: [ ListItemComponent { } ] onTriggered: { var selectedItem = dataModel.data(indexPath); app.initiateRequest(selectedItem.value); } } } }
Please don't quite understand. IAM does not ask for help without doing anything by myself. IAM at this new and iam from difficult to understand the whole material. For now iam happy that I understood this part.
If this is done for me.
Concerning
Maddin
-
SQL error: ORA-31038: invalid number '420,05' when extracting data from XML
Hello everyone ,
J’ai créé dietingDBMS_XMLSCHEMA. REGISTERSCHEMA (SCHEMAURL = > 'OrdenDetalle.xsd', SCHEMADOC = > ' <? xml version = "1.0" encoding = "UTF?) 8 "? >
" < xs: schema xmlns: XS =" http://www.w3.org/2001/XMLSchema ">
< xs: element name = "Monsigniore" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Quantity" type = "Integer" / >
< xs: element name = "FechaCreacion" type = "xs: DateTime" / >
< xs: element name = "Version" type = "xs: String" / >
< xs: ELEMENT ref = "News" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "News" >
< xs: complexType >
< xs: Choice >
< xs: element name = "OrdenCompra" type = "T_OrdenCompra" / >
< / xs: Choice >
< / xs: complexType >
< / xs: element >
< name XS: complexType = "T_OrdenCompra" >
< xs: SEQUENCE >
< xs: element name = "Code" type = "xs: String" / >
< xs: element name = "Number" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoEstado" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoLicitacion" type = "xs: String" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Description" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoTipo" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Type" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TipoMoneda" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "State" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoEstadoProveedor" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "EstadoProveedor" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: ELEMENT ref = "Fechas" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TieneItems" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "PromedioCalificacion" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CantidadEvaluacion" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Well" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Freighters" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TotalNeto" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "PorcentajeIva" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Impuestos" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Total" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Financing" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Country" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TipoDespacho" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FormaPago" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: ELEMENT ref = "Comprador" minOccurs = "0" maxOccurs = "1" / >
< xs: ELEMENT ref = "Proveedor" minOccurs = "0" maxOccurs = "1" / >
< xs: ELEMENT ref = "Items" minOccurs = "0" maxOccurs = "1" / >
< / xs: SEQUENCE >
< / xs: complexType >
< xs: element name = "Items" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Quantity" type = "Integer" / >
< xs: element name = "News" >
< xs: complexType >
< xs: SEQUENCE >
< xs: ELEMENT ref = "Item" minOccurs = "0" maxOccurs = "unbounded" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< name XS: complexType = "OrdenCompraBusqueda" >
< xs:complexContent >
< xs:extension base = "T_OrdenCompra" >
< / xs:extension >
< / xs:complexContent >
< / xs: complexType >
< xs: element name = "Item" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Correlativo" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoCategoria" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Category" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoProducto" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Product" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "EspecificacionComprador" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "EspecificacionProveedor" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Quantity" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Moneda" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
"< xs: element name ="PrecioNeto"type ="XS: Decimal"minOccurs ="0"maxOccurs ="1"/ >
< xs: element name = "TotalCargos" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TotalDescuentos" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "TotalImpuestos" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Total" type = "xs: Decimal" minOccurs = "0" maxOccurs = "1" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "Fechas" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "FechaCreacion" type = "xs: DateTime" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FechaEnvio" type = xs: DateTime "" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FechaAceptacion" type = xs: DateTime "" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FechaCancelacion" type = xs: DateTime "" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FechaUltimaModificacion" type = xs: DateTime "" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "Comprador" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "CodigoOrganismo" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "NombreOrganismo" type = "xs: String" nillable = "true" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "RutUnidad" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoUnidad" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "NombreUnidad" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Activity" type = "xs: String" nillable = "true" / >
< xs: element name = "DireccionUnidad" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "ComunaUnidad" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "RegionUnidad" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Country" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "NombreContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CargoContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FonoContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "MailContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< xs: element name = "Proveedor" >
< xs: complexType >
< xs: SEQUENCE >
< xs: element name = "Code" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Number" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Activity" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CodigoSucursal" type = "Integer" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "NombreSucursal" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "RutSucursal" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Address" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Comuna" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Region" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "Country" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "NombreContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "CargoContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "FonoContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< xs: element name = "MailContacto" type = "xs: String" minOccurs = "0" maxOccurs = "1" / >
< / xs: SEQUENCE >
< / xs: complexType >
< / xs: element >
< / xs: Schema >
', LOCAL = > true, GENTYPES = > false, GENBEAN = > false, GENTABLES = > false,
FORCE = > false, OPTIONS = > DBMS_XMLSCHEMA. REGISTER_BINARYXML, OWNER = > USER);
I have a table with one xml domain.
CREATE TABLE XML_Orden_Detalle (Fecha_GET date default current_date not null,
Fecha_Ordenes number not null,
Correlativo_Ordenes number not null,
Codigo_Orden varchar2 (20) not not null primary key,
Cant_Item,
Date of InicioProceso,
Date of FinProceso,
Xmltype Orden_Detalle not null)
Orden_Detalle XMLTYPE COLUMN
STORE AS BINARY XML
XMLSCHEMA " " http://xmlns.Oracle.com/xdb/schemas/CCS_XML/OrdenDetalle.xsd "" "
ELEMENT "command";
I inserted data like that, without any Errors:" < Command containing = ' http://www.w3.org/2001/XMLSchema "" xmlns: xsi = " " http://www.w3.org/2001/XMLSchema-instance ">
< Number > 1 < / quantity >
< FechaCreacion > 2015-05-28T 12: 10:26.947000 < / FechaCreacion >
v1 < version > < / Version >
< Return >
< OrdenCompra xsi: type = "OrdenCompraBusqueda" >
3879-2661-SE14 < code > < / code >
< Number > PSP DAEM 2014. COFFEE BREAK PARA FRINGE OP21838 < / number >
< CodigoEstado > 6 < / CodigoEstado >
3902 5-on 14 < CodigoLicitacion > < / CodigoLicitacion >
< Description > PSP DAEM 2014. COFFEE BREAK PARA FRINGE OP21838 < / description >
< CodigoTipo > 8 < / CodigoTipo >
< Type > SE < / Type >
< TipoMoneda > CLP < / TipoMoneda >
Is < State > < / Estado >
< CodigoEstadoProveedor > 4 < / CodigoEstadoProveedor >
Is < EstadoProveedor > < / EstadoProveedor >
< Fechas >
< FechaCreacion > 2014-12-29T 17: 43:32.287000 < / FechaCreacion >
< FechaEnvio > 2014-12-31T 10: 32:35.480000 < / FechaEnvio >
< FechaAceptacion > 2015 - 01-01 T 21: 03:03.660000 < / FechaAceptacion >
< FechaCancelacion xsi: Nil = "true" / >
< FechaUltimaModificacion > 2014-12-29T 17: 51:00.000000 < / FechaUltimaModificacion >
< / Fechas >
< TieneItems > 1 < / TieneItems >
< PromedioCalificacion > 5 < / PromedioCalificacion >
< CantidadEvaluacion > 1 < / CantidadEvaluacion >
< Well > 0 < / well >
cargo <>0 < / cargo >
< TotalNeto > 53782 < / TotalNeto >
< PorcentajeIva > 19 < / PorcentajeIva >
< Impuestos > 10218 < / Impuestos >
< total > 64000 < / Total >
< Financing > 1140569 < / financing >
< Country > CL < / Pais >
< TipoDespacho > 12 < / TipoDespacho >
< FormaPago > 2 < / FormaPago >
< comprador >
< CodigoOrganismo > 118069 < / CodigoOrganismo >
< NombreOrganismo > Ilustre municipalidad of Bulnes < / NombreOrganismo >
< RutUnidad > 69.141.200 - 8 < / RutUnidad >
< CodigoUnidad > 4799 < / CodigoUnidad >
Daem < NombreUnidad > < / NombreUnidad >
< Actividad / >
< DireccionUnidad > VICTOR BIANCHI Nº415 < / DireccionUnidad >
Bulnes < ComunaUnidad > < / ComunaUnidad >
< RegionUnidad > Region del Biobio < / RegionUnidad >
< Country > CL < / Pais >
Antonella Brunetti < NombreContacto > < / NombreContacto >
Adquisiciones < CargoContacto > < / CargoContacto >
< FonoContacto > 56-42-2204053-2204054 < / FonoContacto >
< MailContacto > [email protected] < / MailContacto >
< / comprador >
< Proveedor >
< Code > 275020 < / code >
Luis < number > < / number >
< Activity > MANUFACTURING OF PAN, BLOCK PANADERIA Y PRODUCTOS < / activity >
< CodigoSucursal > 280820 < / CodigoSucursal >
Luis < NombreSucursal > < / NombreSucursal >
< RutSucursal > 5.940.940 - 9 < / RutSucursal >
< Address > Carlos Palacios 125 < / address >
Bulnes < Comuna > < / Comuna >
Region del Biobio < region > < / region >
< Country > CL < / Pais >
< NombreContacto > Luis Leonardo Valdés Landero < / NombreContacto >
Gerente < CargoContacto > < / CargoContacto >
< FonoContacto > (56) (42) 631498 < /FonoContacto >
< MailContacto > [email protected] < / MailContacto >
< / Proveedor >
elements <>
< Quantity > 7 < / quantity >
< Return >
< item >
< Correlativo > 1 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > 3 LITROS BEBIDAS < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 10 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 1550 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 15500 < / Total >
< / point >
< item >
< Correlativo > 2 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > DEEMED OF 1 1/2 LITYROS < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 10 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 1150 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 11500 < / Total >
< / point >
< item >
< Correlativo > 3 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > PACKAGES SERVILLETAS < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 8 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 170 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 1360 < / Total >
< / point >
< item >
< Correlativo > 4 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > pounds OF AZÚCAR < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 5 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 580 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 2900 < / Total >
< / point >
< item >
< Correlativo > 5 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > NESCAFE < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 2 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 3900 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 7800 < / Total >
< / point >
< item >
< Correlativo > 6 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
< EspecificacionComprador > CAJAS OF TE 20 BOWL < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 5 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto > 340 < / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 1700 < / Total >
< / point >
< item >
< Correlativo > 7 < / Correlativo >
< CodigoCategoria > 30222700 < / CodigoCategoria >
< Category > items para estructuras, obras y construcciones / permanent Construcciones / industriales Construcciones < / categories >
< CodigoProducto > 30222703 < / CodigoProducto >
< product > ALMACEN Mercancias < / product >
TRITON GALLETAS < EspecificacionComprador > < / EspecificacionComprador >
< EspecificacionProveedor / >
< Number > 31 < / quantity >
< Moneda > CLP < / Moneda >
< PrecioNeto >420,05< / PrecioNeto >
< TotalCargos > 0 < / TotalCargos >
< TotalDescuentos > 0 < / TotalDescuentos >
< TotalImpuestos > 0 < / TotalImpuestos >
< total > 13021,550000000001 < / Total >
< / point >
< / News >
< / object >
< / OrdenCompra >
< / News >
< / Monsigniore >
However when I extract data, for example:
Select *.
from xmltable (to_char (' / Monsigniore/news/OrdenCompra/Items/News/Item[1] ''))
passage (select Orden_Detalle
of xml_Orden_Detalle
where Fecha_Ordenes = 20150101 and Correlativo_ordenes = 83)
path of columns Correlativo varchar2 (15) 'Correlativo '.
, Path of varchar2 (15) CodigoCategoria 'CodigoCategoria '.
, Path Categoria Varchar2 (100 CHAR) "category.
, Path of varchar2 (15) CodigoProducto 'CodigoProducto '.
, Path of Producto Varchar2 (100 CHAR) 'product '.
, Path of the EspecificacionComprador Varchar2 (100 CHAR) "EspecificacionComprador".
, Path of the EspecificacionProveedor Varchar2 (100 CHAR) "EspecificacionProveedor".
, Amount varchar2 (15) path 'amount '.
, Path of the Moneda Varchar2 (16 CHAR) "Moneda".
, Path of varchar2 (15) PrecioNeto 'PrecioNeto '.
, Path of varchar2 (15) TotalCargos 'TotalCargos '.
, Path of varchar2 (15) TotalDescuentos 'TotalDescuentos '.
, Path of varchar2 (15) TotalImpuestos 'TotalImpuestos '.
, Path of varchar2 (15) total 'Total '.
);
delivery the following error:
Informed of error:
SQL error: ORA-31038: Valor number no valido: "420,05."
«31038 00000 - "value not valid %s: \"%s\»»
* Cause: The text in the XML document does not represent a valid
value given the data type and other constraints in the schema.
* Action: Make sure the value specified in the XML documents is valid
regarding the data type and other constraints in the schema.
Note that extract le agenda [1] but the reported error is à la point [7]
Please If anyone can Help me with le solution for no report error
Thank you very much in advanceCarlosin Chile, the decimal point are ', 'no'.', the xml data table is OK for us
You do not understand.
Regardless of the locale, numeric values limited by a type of data XS: Decimal must use a point in a correct XML representation, otherwise, the document is not valid by the XSD.
(3) TO_CHAR (...) the code is part of a procedure
Again, do NOT build a dynamic path like that.
Why not just move through the records returned by the query (if you need close at all)?
FOR rec in)
SELECT x.*
From your_table t
XMLTABLE (...) x
)
LOOP
END LOOP;
What is the role of the v_CantItems variable? Paging?
Whence its value?
-
Hello
We ask a web service via PL/SQL. The XML that is returned seems to have ' & amp; ' Lt; "instead of < and '& amp; GT; "instead of >.
When I try to draw the values I don't do anything. How can I get the values from this XML file for attributes? Also, how to get the attributes in separate columns?
Here are the XML, opinion, I added & amp, so you can see what I do when you look in the DB:
< doSelectResponse xmlns = "http://www.ca.com/UnicenterServicePlus/ServiceDesk" >
< doSelectReturn xmlns = "" > & amp; Lt;? XML version = & amp; quot; 1.0 & amp; quot; Encoding = & amp; quot; UTF-8 & amp; quot;? & amp; GT;
& amp; Lt; UDSObjectList & amp; GT;
& amp; Lt; UDSObject & amp; GT;
& amp; Lt; Handle & amp; GT; CR:400318 & amp; Lt; / handle & amp; GT;
& amp; Lt; Attributes & amp; GT;
& amp; Lt; Attribute DataType = & amp; quot; 2002 & amp; quot; & amp; GT;
& amp; Lt; AttrName & amp; GT; ref_num & amp; Lt; / AttrName & amp; GT;
& amp; Lt; AttrValue & amp; GT; 819 & amp; Lt; / AttrValue & amp; GT;
& amp; Lt; / attribute & amp; GT;
& amp; Lt; Attribute DataType = & amp; quot; 2002 & amp; quot; & amp; GT;
& amp; Lt; AttrName & amp; GT; Summary & amp; Lt; / AttrName & amp; GT;
& amp; Lt; AttrValue & amp; GT; Can you please put this circuit on the Tberd and see if there is any mistakes & amp; Lt; / AttrValue & amp; GT;
& amp; Lt; / attribute & amp; GT;
& amp; Lt; / attributes & amp; GT;
& amp; Lt; / UDSObject & amp; GT;
& amp; Lt; / UDSObjectList & amp; GT;
< / doSelectReturn >
< / doSelectResponse >
I threw the XML in a clob, and trying to get the AttrValue like this:
We are on 9.2.0.6 version of the DB, the upgrade to 11g soon, but not before I have to get this to work.SELECT ID, clob001 ,XMLTYPE.createxml(c.clob001).extract('//AttrValue/text()','xmlns=""').getStringVal() val FROM jlb_tmp c
Thanks in advance for your help,
-Johnnie
Published by: johnniebillings on March 30, 2011 17:35
Published by: johnniebillings on March 30, 2011 19:51If someone could explain it, I'd be happy.
Short answer: bug.
Oracle 9i is known to have bugs about the handling of XML, especially when using namespaces. Also note that 9i was not yet fully compliant W3C.
You have circumvented the problem by using a shaft going down in the XPath expression, so without going through the selection of the root node labelled by a space. -
Hi all
I have an xml file store on my bb.
How can I read data within the tag? I think that one way is to use blackberry.find.FilterExpression (), like the example below. I don't know how... but it's okay. I will try!!
function handleOpenedFile(fullPath, blobData) { temp = blackberry.utils.blobToString(blobData); //var NomeOperatore = blackberry.find.FilterExpression(''); } function readPianoViaggi() { if (blackberry.io.file.exists(filePath)) { blackberry.io.file.copy(filePath, filePath2); blackberry.io.file.readFile(filePath, handleOpenedFile); } }
my question is: I can read data within the tag using an operation such as
itemDescription = temp.getElementsByTagName ('NomeOperatore') var [0].firstChild.data or something similar?
Thank you
You would do something like the following... I don't know if my syntax is correct
function readFile() { blackberry.io.file.readFile("file:///store/home/user/sample.xml",handleOpenedFile); } function handleOpenedFile(fullPath, blobData) { var xmlString = blackberry.utils.blobToString(blobData, null); var parser = new DOMParser(); var doc = parser.parseFromString(xmlString, "text/xml"); var itemDescription = doc.getElementsByTagName('NomeOperatore')[0].firstChild.data; }
-
To extract data from a file previously misspelled
I am trying to extract two tables of a previously written file, which contains two tables, separated by a tank/t. Files are saved in this format;
Wavelength (nm)ower (W):
* lambda1 * power1 *.
* lambda2 * power2 *.
...
' lambda # "and" power # ' are the two numbers actually, but I wanted to illustrate that they are correlated.
In addition, with the retrieved data, I want to write a new file, which uses the information (in another port scan) to calculate a third value (called the EQA), which depends on the power and the current at a given wavelength. While the VI is the current reading by lambda, it should also be able to find what the lambda value to such power has been and calculate the EQE.
I have so far on the screws are attached. The third part of 'problem.vi' is locked in a while loop, while she repeats many times.
Thank you very much
-
extract data from text file to draw the graph
Hello
In the attached data file, I would like to extract the (real) % Freq column and then be able to plot them on a graph of % Freq vs other columns (i.e. % Freq vs Amp, or % Freq vs Test1...).
Any help will be greatly appreciated.
Thank you
hiNi.
hiNI,
There are a lot of questions to ask, but to answer your question immediately ' How do I parwse the necessary data as numbers? (see the attachment, png)
1. read worksheet
2 table subset rated 19
This should give you your numeric values for all your X and Y values.
Chazzzmd
-
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 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 -
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.
-
Creating rules file to extract data from Interface OIC
Hello.
I'm new on the BEAK, I worked on the DSN earlier method to extract data from the database.
Can someone give me the steps of how extract data from the interface of the OIC.
My database is Oracle 11 g 2 and I use 11.1.2.2 version merger.
Concerning
Mahesh BallaThe format is DBSERVERNAME:PORT / service name
for example ORACLE11G:1521 / ORCLSee you soon
John
http://John-Goodwin.blogspot.com/ -
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.
-
How to extract data from a signed pdf that was sent to me.
I can extract data from a PDF file that is not signed, but how to extract data from a signed PDF? Exporting data option does not work once it is signed. Specifically, I want to combine the data into a csv file, but a PDF signed does not to me.
Hi evanb92625060,
It is not possible to extract (using Acrobat |) Collection and management of the PDF to form data) data from a signed PDF form is that it locks all fields in the form.
Kind regards
Nicos
Maybe you are looking for
-
OfficeJet Pro 6830 AIO: OfficeJet Pro 6830 whining noise
Pretty much all the time I have had the printer refurbished (I got one with the printhead error), I heard a slight noise whining. I really didn't notice it at first since I wasn't spending much time in my office. In the last months, I went to the off
-
Re: Satellite P850-12 x "pop" noise is in the left hand speaker
You can, or that you have perhaps not seen my other problem with this laptop, which resulted in a replacement unit. Now for the replacement, I got it for a week and everything was perfect until last night when I started to hear a cracking sound from
-
Win XP (Pro) Service Pack 3 download & install
Hello My service provider just instyalled Win XP Pro SP2 after uopgrading the hard drive. I couldn't get acesss to the internet because my Connect Manager requires SP3. Do I know if I can download it on another PC, save it using a USB key and install
-
BlackBerry smartphones how is I can't make videos more?
my blackberry Curve 8310 used to make me make videos on it, but now, whenever I want to make a video it says "to record a video, insert a formatted media card" and I don't have a media card. can someone help me?
-
OK, so I want to download the new Windows 10 and whenever I try to click on the application it will NEVER load. So I went to settings, Control Panel, system and security, windows update, and then update but the problem is, a notification keeps poppin