CLOB XML to Excel
I need to generate an Excel file, which is powered from a clob XML column in my data base. I found some examples to do, and I did it in my case by "pieces". Even if it works, a problem occurs when my file trends to be bigger. This problem is a corruption of my result file. Apparently this corruption is due to the method of pieces, because it does not present when the file is small and it produces more when my 'chunks' is smaller in a large file. For example, if I change my code to use pieces of 32765 characters, problems occur so less when I use pieces of 3000 characters.My code is like this:
CREATE OR REPLACE PROCEDURE DPR_CLOBTOFILE (P_FILENAME IN VARCHAR2,
P_DIR IN VARCHAR2,
P_CLOB IN CLOB) IS
--
DIRECTORY CONSTANT C_AMOUNT: = 32767;
L_CLOBLEN PLS_INTEGER;
L_FHANDLER UTL_FILE. TYPE_DE_FICHIER;
L_BUFFERSIZE PLS_INTEGER: = 3000;
L_BUFFAUX VARCHAR2 (3000);
--
BEGIN
--
L_CLOBLEN: = DBMS_LOB. GETLENGTH (P_CLOB);
L_FHANDLER: = UTL_FILE. FOPEN (P_DIR, P_FILENAME, 'W', C_AMOUNT);
--
FOR I IN 1... CEIL(L_CLOBLEN / L_BUFFERSIZE) LOOP
--
DBMS_LOB. READ (P_CLOB,
L_BUFFERSIZE,
(I - 1) * L_BUFFERSIZE + 1,
L_BUFFAUX);
UTL_FILE. PUT_LINE (L_FHANDLER, L_BUFFAUX, TRUE);
--
END LOOP;
--
UTL_FILE. FCLOSE (L_FHANDLER);
--
EXCEPTION
WHILE OTHERS THEN
--
IF UTL_FILE.IS_OPEN (L_FHANDLER) THEN
UTL_FILE. FCLOSE (L_FHANDLER);
END IF;
LIFT;
--
END;
My result file looks like this:
PURA Estrategia fine VPA
< td > Renta Fund USD
< td > 13
< td > 1
4
51
04/03/2013
53
< td > 13
79
11
105
< td > 999
< td > 8
116
1
< td > 999
1
NORIGIN SORIGIN_DESC NFROMFUNDS FONDO_x0020_ORIGEN NTOFUNDS FONDO_x0020_DESTINO NSTATREGT DCOMPDATE NUSERCODE
1 cot. Voluntaria 2 Baring Europa 2 Baring Europa USD USD 1 1 11/02/2009
2 Depositos A.P.V. Baring Europa 2 Baring Europa USD USD 2 1 1 11/02/2009
As you can see, before the line of title, there are a few lines that are not supposed to be there.
Thank you much in advance.
You can find this more simple:
CREATE OR REPLACE PROCEDURE DPR_CLOBTOFILE (
P_FILENAME IN VARCHAR2
, P_DIR IN VARCHAR2
, P_CLOB IN CLOB
)
IS
BEGIN
dbms_xslprocessor.clob2file(p_clob, p_dir, p_filename);
END;
/
Tags: Database
Similar Questions
-
Publisher XML with Excel output doesnot display values 000 or 0000
Report XML Publisher looks like a table that has segment values that are stored in '000' or '0000' in the database.
They are stored as characters in the database.
XML editor when it is running, does not display these Excel output values if these are text fields (such as it is defined in the XML model).
If she values such as 11190, it displays.
If she values such as '000' or '0000', it doesnot display at all. They appear empty.
Please advise on how to solve this problem.
Thank you
RAM
I tried with the insertion of two spaces after the field in the model.
Now it's displaying.
Thank you
RAM
-
Hi all
I have a table that contain the clob,
Like this:
number of id_flusso;
clob ds_flusso
inside the ds_flusso of the field, there is an xml, and xml inside, there's a code.
I need to write a query that allow me to retriew the id_flusso and a code in the xml code that is stored in the file, how can I achieve this.
Thank you
FrancescoAlways give your version of the database in the first place (select * from version$ v).
It will help provide relevant answers.On 10g:
select id , extractvalue(xmltype(xmldoc), '/root/item[@num="1"]/code') code from documents ;
-
Hello
I have a table containing the xmltype column that contains XML code. I want to read reviews and do the following
1 insert records in the table that are present in < insert > < / insert > tag
2 update records in the table that are present in < updated > < / update > tag
3 delete records from table to present data in < delete > < / remove > tag
Please find below the table and example of xml code.
-------------------------------------------------------------------------------
create table (ID XmlTest
data_xml XMLType)
CLOB XmlType data_xml STORE DID;
insert into values of XmlTest (id, data_xml)
(2
XMLType ("< data >
< Insert >
< id > 101 < /ID > < name > John < / name >
< id > 102 < /ID > < name > Adrian < / name >
< id > 103 < /ID > < name > Kevin < / name >
< / insert >
< updated >
< id > 1 < /ID > < name > Mary < / name >
< code > 2 < /ID > < name > Arron < / name >
< id > 3 < /ID > < name > Bret < / name >
< / update >
< remove >
< id > 51 / < ID >
< id > 52 / < ID >
< id > 53 / < ID >
< / delete >
((< / data > '));
-----------------------------------------------------------------------------------
I cannot playback / analysis of the data available in each section (insert/update/delete).
Best regards
Fred
Published by: user9043085 on 15 Sep, 2010 05:30
Published by: user9043085 on 15 Sep, 2010 05:31Hi Fred,.
Well, you changed the root node and added a default namespace, which complicates things... but not that much good :)
Develop on A_Non post:
select xmltest1.id,xmltest1.name from xmltest, XMLTABLE( XMLNamespaces(default 'syncpsna/schemas'), '/NATOPOLOGYSyncElementRequest/insert/row' PASSING xmltest.data_xml COLUMNS "ID" number(10) PATH 'id', "NAME" varchar2(50) PATH 'name') xmltest1 where xmltest.id = 2;
BTW, to validate the code in shape, you don't need an extra slash in the closing tag, simply use the same
to enclose the section.
-
Hello
I do a mini-fonction to read a CLOB xml:
create the table XmlTest of XmlType;
DECLARE
localXML ClOB;
BEGIN
localXML: = ' <? XML version = "1.0" encoding = "utf-8"? > < message >
< Pippo id = "33" status = '0' / >
< Pippo id = "34" status = "1" / >
< id Pluto = "35" status = '0' / >
< id Pluto = '36' status = "1" / >
< Barcode id = "asfjhsfjkhwegjk22312312" status = '0' / >
< Barcode id = "sdklfjosgkdfgh596895354" status = '0' / > < / messages > ';
INSERT INTO XMLTEST VALUES (XMLTYPE (localXML));
END;
When I do:
SELECT x.getCLobVal (XmlTest) x;
The CLOB create a tag perfect for my job.
So, I want to insert the id value and status in another table (id is a varchar2 and status is a number). Is possible?
I use Oracle Database 10 g Enterprise Edition Release 10.2.0.4.0
Thank you.Your Oracle client version must be incompatible with the server.
Could check you?
-
How to read XML data stored as a Clob
Hello
I'm new on clob & XML types...
Data XML has been inserted into a Clob field in a Table in Oracle (9.2.0.8.0)
-----------------------------------------------------------
CREATE THE TEMP TABLE
(
SNO NUMBER (5),
STR_VAL LONG,
CREATED_DT DATE default sysdate,
COL2 CLOB,
COL3 SYS. XMLTYPE
)
-----------------------------------------------------------
SELECT dbms_lob.getlength (col2) of temp
---
-> 24754
-----------------------------------------------------------
SQL > select temp col2;
COL2
----------------------------------------------
& lt; DataSet1 & gt;
& lt; TAGSDATATABLE & gt;
& lt; TAG_NAME & gt; KST20001 & lt; / TAG_NA
--------------------------------------------------------------------------
If I use the stmt above it shows only a pice of data
How can I get the data in this column.
could someone help to obtain the data.
Concerning
Prakash
Published by: user12957183 on August 25, 2010 12:25 AMInsert data in to table XMLTYPE clob variable:
SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := '
'; 31 BEGIN 33 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 34* end; SQL> / PL/SQL procedure successfully completed. SQL> desc my_tab1; Name --------------------------------------------------------------------------------------------------- TABLE of XMLTYPE SQL> -- For larger data: SQL> ed Wrote file afiedt.buf 1 declare 2 my_clob CLOB := 'KST20001 3 4KST20002 5KST20003 6 8KST20004 79 11KST20005 1012 14KST20006 1315 17KST20007 1618 20KST20008 1921 23KST20009 2224 26KST20010 2527 29KST20009 283 '; 148 l_xmltype xmltype; 149 BEGIN 150 --l_xmltype := my_clob; 151 INSERT INTO my_tab1 VALUES(XMLTYPE(my_clob)); 152* end; SQL> / PL/SQL procedure successfully completed. SQL>4 6KST20001 57 9KST20002 810 12KST20003 1113 15KST20004 1416 18KST20005 1719 21KST20006 2022 24KST20007 2325 27KST20008 2628 30KST20009 2931 33KST20010 3234 36KST20009 3537 39KST20009 3840 42KST20009 4143 45KST20009 4446 48KST20010 4749 51KST20009 5052 54KST20009 5355 57KST20009 5658 60KST20009 5961 63KST20010 6264 66KST20009 6567 69KST20009 6870 72KST20009 7173 75KST20009 7476 78KST20010 7779 81KST20009 8082 84KST20009 8385 87KST20009 8688 90KST20009 8991 93KST20010 9294 96KST20009 9597 99KST20009 98100 102KST20009 101103 105KST20009 104106 108KST20010 107109 111KST20009 110112 114KST20009 113115 117KST20009 116118 120KST20009 119121 123KST20010 122124 126KST20009 125127 129KST20009 128130 132KST20009 131133 135KST20009 134136 138KST20010 137139 141KST20009 140142 144KST20009 143145 147KST20009 146Published by: AP on August 25, 2010 04:46
-
Script Help: The names of layers from the Excel data
Hello!
I'm a noob script and have tried to learn, but unfortunately I just haven't the time. Projects at work keep me in the Bay. In any case, here's my scenario and I hope someone can guide me.
I want a script that would look at a database (XML, CSV, excel or anything that works) and create separate layers in illustrator based on the data.
Example: description and part number comes from a database. Name of the Illustrator layer is what I want the automation script. The reason for this request is a 200 point that I don't want to retype.
Part number Description Name of the Illustrator layer 33456 Point 1 33456_Item 1 33457 Point 2 33457_Item 2 33458 Point 3 33458_Item 3 33459 Point 4 33459_Item 4 33460 Point 5 33460_Item 5 33461 Item 6 33461_Item 6 33462 Point 7 33462_Item 7 33463 Item 8 33463_Item 8 After that, I have all my items, with correct layer names, I export each layer as a separate PDF file. The name of the export file would be identical to the layer name with "_1up" appended to the end. For example, 33456_Item 1_1up.ai.
I would have a separate illustrator file that contains all the same name of the layer as above and then I place the exported file, he respected the layer. This is where the script of another would be great. Is it possible to make a script that will place an image on a layer that has similar naming structures (the only differences would be the name of the layer would not "_1up")?
I hope this makes sense and I know that I ask a lot. I thank very you much in advance!
still not sure why export you all the layers to separate the files only to place them all back again?
but this will get your layers created.
var line,lay,myLayers = []; var csvFile = File('e:/csv.csv'); csvFile.open( 'r' ); while(!csvFile.eof){ line = csvFile.readln(); line = line.replace(',','_'); myLayers.push(line); } csvFile.close(); var doc = app.activeDocument; for(var i = myLayers.length - 1; i > 0; i--){ lay = doc.layers.add(); lay.name = myLayers[i]; } var oldLayer = doc.layers.getByName('Layer 1'); oldLayer.remove();
CSV should simply be:
33456, point 1
33457, point 2
...
-
Literal string too long for the CLOB
Hello
My version of the database is:
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
AMT for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
When I run this piece of code, I get an error.
DECLARE
insCtx DBMS_XMLStore.ctxType;
lines NUMBER;
xmlDoc CLOB: = 'xml string is about 4600 long lines in TOAD...';
BEGIN
insCtx: = DBMS_XMLStore.newContext ("xmlTempTbl"); -get the context
lines: = DBMS_XMLStore.insertXML (insCtx, xmlDoc); -Insert the doc
DBMS_XMLStore.closeContext (insCtx); -close the handle
END;
ERROR:
ORA-06550: line 4, column 19:
PLS-00172: string literal too long
From my understanding a CLOB leave maximum string size of 2 GB. And on top, my xml string is not greater than 2 GB (I cannot display the xml data string, refers to the business). So why I get the error too long string literal.
For the above, I fault the XML into several parts and run the PLSQL, then it gives no error.
Please advice.
Published by: 934451 on November 8, 2012 07:06
Published by: 934451 on November 8, 2012 07:07From my understanding a CLOB leave maximum string size of 2 GB.
Not exactly:
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e25519/datatypes.htm#CHDDCGEEbut this isn't the real problem.
The error is about the "string literal" size, there is a limitation too:
http://docs.Oracle.com/CD/E11882_01/server.112/e17766/pcmus.htm#sthref18132PLS-00172: string literal too long Cause: The string literal was longer than 32767 bytes. Action: Use a string literal of at most 32767 bytes.
For the above, I fault the XML into several parts and run the PLSQL, then it gives no error.
Is this a real case of production or you just test?
In practice, we should first save the file in a variable/column CLOB (or XMLType) and then reference the content from there. -
Hi all
I want to create an XML file to be imported into illustrator.
Of my clients, I get files excel with 1000 + names and membercodes.
In illustrator I is a model for the 24 members.
How can I create an XML file that is compatible with Illustrator.
Simply save as XML to Excel does not include the tower...
I hope someone can help
Here is a tool for her
copy of your data to excellent in the upper part, the data in xml format will be at the bottom, copy this data into an empty text file and save it with an xml extension, your file is ready to be imported into your illustrator file
the page is in Portuguese, but it should be clear enough
-
I'm a DBA. I want to learn XML?
I'm an Oracle DBA(10gR2,11G) working for a team of application development. I don't know anything about the XML data. All I know is that XML files are stored in the CLOB columns.
Should I learn XML? How XML knowledge will strengthen the capacity of an Oracle DBA?Various projects, I have the impression that DBA a developers should learn as much as possible on the XML data.
For a DBA can cause focusing on parts of the administration and storage, while a developer might focus on the part of the use and interpretation.
Here are some topics that might be of particular interest to a DBA.
with no particular order
-Storage of XMLTYPE
-Only XMLTYPE tables
-Use of XML schemas
-XMl Schema evolution (how to manage the change in the XML schemas that are forced into an XMLTYPE column).
-memory CLOB, XML secure secure
-the XML output file system
-SQL - XML, XPATH
...For a developer
-XPATH, XQUERY, XML - SQL
-Analysis of XML (DOM / SAX parser)
XSL/XSLT
-Printing XML (XML - FO, Apache Fop, etc..)
-XML relational mapping using views
-extract, extractvalue
-AppendXml, InsertXml, UpdateXml (not sure on the correct method names)
...Published by: Sven w. on August 31, 2009 13:42
-
Export query data to Excel - better way?
Hello
Something I had to do once or twice in the past but I don't spend enough time to be a true ACE to take a query result and dumping to plain text - CSV, delimited by tabs, something like that. In the past, I've written manually the new file in CF with the help of chr() and so on. Needless to say, "boredom" does not begin to describe it.
I have now a few clients who want to do this more often, each of them using Excel. In one case, they need the file in the CSV format in the end, but I wonder: is there maybe a much easier way to do it? Dumping a CFQUERY directly in XML and Excel format of having read that in? Some tag/CFC custom do that smoothly I did it? What is your favorite downloadable CFQuery and dropping mechanism?
Thank you!
Samuel Knowlton
iamsam.orgAHA! Wonderful. If simpe. Thank you!
-
Security settings do not allow execution of script code in the report.xsl stylesheet
Hello world
I can't open a file of XML in Excel 2007 results - even if I added the stylesheet for trusted locations and deleted all the protections.
Here's what happens:
1. open the XML results file how I am propmpted for select the report.xsl stylesheet TestStand
2. then gives error: Scripts in this XML document and/or references to other documents are disabled.
3. by clicking OK gives more specific information - namely the security settings don't allow execution of code within this stylesheet script:
But I did the following:
-The path to the sheethas style was added to the "trusted locations".
-ActiveX settings are completely enabled for all controls without restrictions
-Macros settings are enabled for all macros
-Is trust access to the VBA project object model
-All data connections are allowed
How can I activate the execution of script code in the style sheet for the file XML can load?
Thank you
Ronnie
Ronnie-
Directly from the Article in the Microsoft Knowledge base, please note that do the following changes "may make your computer or your network more vulnerable to attack by malicious software such as viruses." It's always a good idea to make a backup of your registry before editing. This can be done by clicking on file' export.
In any case, as the article explains, open the registry and navigate to HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Security. The security file must contain a registry key called XSLSecurityLevel. Mine did not have this registry key and I had to create it (see screenshot below). Double-click the XSLSecurityLevel registry key, type 1 in the data value, and then click OK.
You should now be able to view the XML from Excel 2007 report. To reset this setting, simply double-click the registry XSLSecurityLevel key, enter 0 in the given value, and then click OK.
I hope this helps!
-
Hello
I'm trying to export a schema with 2 tables with the CLOB (XML file stored) data type. While the expdp am getting error below.
ORA-39097: Data Pump job encountered the error unexpected-12801
ORA-39065: exception unexpected master process in HAND
ORA-12801: error reported in the PZ99, instance XXXXXX parallel query server
ORA-01460: dead letter or unreasonable conversion requested
Job 'XXXXXXXX '. "" SYS_EXPORT_SCHEMA_01 "stopped because of the mistake at 03:46:32
already my parameter PARALLEL_DEGREE_POLICY value is MANUAL. Help, please
The error that you get a little weird, so if I were you, and if the error is reproducible, I would trace your datapump for more information. You could follow the datapump job Oracle sessions or add "trace = 1FF0300" to the command line expdp; This will create tracking in your folder of trace files. Search for 'trace = 1FF0300' to find out how it works.
-
createRowFromResultSet not called for the first row
Hi all
Jdev Version: 11.1.1.7.0
I have a XML stored in DB as a CLOB. I get this as a CLOB XML file (via clobdomain) in my VO and will fill some other transient attributes. I tried to do this by substituting (according to the ticket) method 'createRowFromResultSet'. I observe a strange behavior that this method does not get invoked at the first line only.
Earlier, I see someone else suffer from a similar problem -
. Is this a bug that appears when you use clob and the override of this method?Thanks in advance,
Srini
Noted bug with Jdev team for this that I was able to reproduce the problem. Once I have remove the CLOB to the VO, he begins to work!.
-
How to NOT send some form data when the form is submitted
Hello
I created a PDF form with radio buttons in the Group and the boxes. When I the form of data, such as values using the submit by e-mail button to send form data as XML or merge data into a spreadsheet files, I'll see the data values for radio buttons and checkboxes.
What I want here is to don't get the data values for some controls such as the boxes option, but no other controls like check boxes, in the XML or Excel worksheet after submission of the form. I know how to hide the controls in the form, but I have to the visible and active boxes on the form.
Is there a way to hide or do not send form data when the form data is submitted?
Thank you
Sam
Hi Kyle,.
That's exactly what I want! Once I have not selected any data binding, the field is in shape and active, but when submitted as XML or it merge with a spreadsheet, the field is gone.
Forgive me if I didn't my self clear in my question. Answer you is straight to the point.
Thank you very much!
Sam
Maybe you are looking for
-
If the applications are written in Javascript, how can a developer protect the rights?
I read that Firefox OS applications are written in Javascript, Html, and CSS. Can anyone see or copy the code? Is it possible to prevent it?
-
6310 all-in-One Installed new color and b & w cartridges. Focus shows only the color... No black. Why black not print?
-
Change the default audio device and the recognition of the application
I'm new to Vista (home premium w/sp2) and I am confused by works the assignment of default device (control_panel-> sounds), specifically the device change with existing applications (running). I change frequently between the speakers and the headphon
-
Failure of a file error message registry
I have a Dell Dimension 5150 (Windows XP) that until recently was working fine. When you turn on now I get the following error message: STOP: c0000218 (registry file failure). The file of registry cannot load the hive (file): \systemRoot\System32\
-
Windows Movie Maker: How to make the pieces of music to play on a CD
I cut/edited the music with windows movie maker and I must be able to have it on a CD and to allow him to play on a CD player. Is there a way I can do this?