Default insertion for missing elements using DBMS_XMLSave.insertXML
Hi,
I am trying to insert default values for some columns, without having those column names as elements in the xml document. Is it possible to do so?? This is the code I am using for now, but it inserts null values for missing elements in the xml document.
insCtx := DBMS_XMLSave.newContext ('TABLENAME'); -- get the context
rows := DBMS_XMLSave.insertXML (insCtx, p_xmlDoc); -- insert the doc
DBMS_XMLSave.closeContext (insCtx); -- close the handle
Only thing I noticed with dbms_xmlstore.insertXML, was when my xml document had "<?xml version = "1.0" ?>" at the start, it gave an error "LPX-00209: PI names starting with XML are reserved"That's probably due to the XML document not starting exactly with "<", like this :
SQL> DECLARE
2
3 xmldoc clob := '
4 <?xml version="1.0"?>
5 <ROWSET>
6 <ROW>
7 <COL1>1</COL1>
8 <COL2>TEST1</COL2>
9 </ROW>
10 <ROW>
11 <COL1>2</COL1>
12 </ROW>
13 </ROWSET>';
14
15 ctx dbms_xmlstore.ctxHandle;
16 numrows number;
17
18 BEGIN
19
20 ctx := dbms_xmlstore.newContext('MY_TABLE');
21 numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
22 dbms_xmlstore.closeContext(ctx);
23
24 END;
25 /
DECLARE
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00209: PI names starting with XML are reserved
ORA-06512: at "SYS.DBMS_XMLSTORE", line 78
ORA-06512: at line 21 However, it runs OK if the prolog actually starts the character stream :
SQL> DECLARE
2
3 xmldoc clob := '<?xml version="1.0"?>
4 <ROWSET>
5 <ROW>
6 <COL1>1</COL1>
7 <COL2>TEST1</COL2>
8 </ROW>
9 <ROW>
10 <COL1>2</COL1>
11 </ROW>
12 </ROWSET>';
13
14 ctx dbms_xmlstore.ctxHandle;
15 numrows number;
16
17 BEGIN
18
19 ctx := dbms_xmlstore.newContext('MY_TABLE');
20 numrows := dbms_xmlstore.insertXML(ctx, xmldoc);
21 dbms_xmlstore.closeContext(ctx);
22
23 END;
24 /
PL/SQL procedure successfully completed.
With the dbms_xmlsave.inserXML, [...] it wont insert the default column values.Now that's strange...
I understand there could be differences in the parsing implementation, but in the end both processes must issue an INSERT into the target table using plain SQL, so I really wonder why default values are not applied.
I'll try to reproduce when I have access to a Java-enabled db.
Similar Messages
-
How do you create a save as default folder for MP3 files used Captivate text to audio voices files?
Hi Ed
Thank you for contacting me, however I already know how to save text to
audio files via timeline using the Export feature.
So my question was not entirely clear and I apologize for that. To explain
further, whenever I save a text to audio file, captivate takes me to a
default save as folder where I then have browse back to my production
folder where I am keeping all my Txt to Aud files. This is very tedious
process when you have alot of files to save. So my question was is there a
way to configure captivate so I can make my production folder the default
file for whenever I save a Txt to Audio file through Export feature that
the system automatically takes me to that production folder, and I am
spared the long tedious process of saving the file manually to the
prodcution folder I want.
I have copy the pathway to the production folder in the URL filed in the
Save As dialoge box and that workaround as cut the work down but I still
have to paste that URL field to point the file to the right folder. So it
would be nice if I could do everything automatically. Microsoft makes this
capability in their MS Office applications, so I was thinking Adobe might
do the same thing. Your help with this would be appreicated,
Thanks
Merrill Roberts
Sr. Training Specialist
SunGard Availability Services
Direct 925-831-7730
Mobile:415-215-9280 -
Can't replicate data inserted using DBMS_XMLSAVE.insertXML
Enviroment:
OS: SLES 10 SP2
Database Version: 11.1.0.6
I have configured an Oracle Streams environment compose by two database. The first is the source where a local capture process should captures dml changes from some tables. If I insert some data using a classic dml insert operation the changes are replicated without problems. The problem is when the tables are populated using the DBMS_XMLSAVE.insertXML procedure. With that implementation there isn't data replication. I think DBMS_XMLSAVE.insertXML must generate redolog so the capture process should capture the changes from them but it doesn't seems to be like that.
I need some suggestion about this matter, thank you.Here you are
CREATE TABLE TEST.HABI
ID_DATA NUMBER,
ID_HOCU INTEGER,
ID_HABI INTEGER,
DESCRIPTION VARCHAR2(1000 BYTE)
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 32M
NEXT 80K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
I'am not performe explicit commit here you are the procedure:
FUNCTION import(p_id_data IN INTEGER,
p_lote IN INTEGER,
p_fecha_hotel DATE,
p_error IN OUT NOCOPY CLOB,
p_hab_habi IN OUT NOCOPY CLOB,
p_hcl_clie IN OUT NOCOPY CLOB,
p_hcl_habi IN OUT NOCOPY CLOB,
p_hcl_hist IN OUT NOCOPY CLOB,
p_tel_llpr IN OUT NOCOPY CLOB) Return integer
AS
ctx DBMS_XMLSAVE.ctxType;
v_rows NUMBER;
v_err_msg VARCHAR(4000);
v_cant integer;
BEGIN
IF length(p_error) > (length('<?xml version = ''1.0''?><ENL_TRAN_ERROR/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_ERROR');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_error);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
IF length(p_hab_habi) > (length('<?xml version = ''1.0''?><ENL_TRAN_HAB_HABI/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HAB_HABI');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hab_habi);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
IF (INSTR(p_hcl_clie, '&')<>0) THEN
p_hcl_clie := replace(p_hcl_clie, '&', '&');
END IF;
IF length(p_hcl_clie) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_CLIE/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_CLIE');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_clie);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
IF length(p_hcl_habi) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_HABI/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_HABI');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_habi);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
IF length(p_hcl_hist) > (length('<?xml version = ''1.0''?><ENL_TRAN_HCL_HABI_HIST/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_HCL_HABI_HIST');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_hcl_hist);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
IF length(p_tel_llpr) > (length('<?xml version = ''1.0''?><ENL_TRAN_TEL_LLPR/>') + 3) THEN
ctx := DBMS_XMLSAVE.newContext('ENL_TRAN_TEL_LLPR');
DBMS_XMLSAVE.setRowTag(ctx, 'ROW');
--BEGIN
v_rows := DBMS_XMLSAVE.insertXML(ctx, p_tel_llpr);
--EXCEPTION WHEN OTHERS THEN
-- NULL;
--END;
DBMS_XMLSAVE.closeContext(ctx);
END IF;
END import;
I hope you can help me. -
Loading data into XMLType column using dbms_xmlsave.insertxml get ORA-29532
The following simple test case succeeded in 9.2.0.1 but failed in 9.2.0.2.
CREATE OR REPLACE procedure InsertXML(xmlDoc IN VARCHAR2, tableName IN VARCHAR2) is
insCtx DBMS_XMLSave.ctxType;
rows number;
begin
insCtx := DBMS_XMLSave.newContext(tableName); -- get the context handle
rows := DBMS_XMLSave.insertXML(insCtx,xmlDoc); -- this inserts the document
dbms_output.put_line(to_char(rows) || ' rows inserted');
DBMS_XMLSave.closeContext(insCtx); -- this closes the handle
end;
CREATE TABLE XMLtable
(column1 xmltype)
exec insertxml('<?xml version = "1.0"?><ROWSET><ROW><COLUMN1><TEST>HELLO</TEST></COLUMN1></ROW></ROWSET>', 'XMLTABLE');Hi,
For your XML file I think you just need to enclose XML elemnts in ROWSET AND ROW TAGS - so xml should look like :
<ROWSET>
<ROW>
<DEPT>
</DEPT>
and just pass it as CLOB to dbms_xmlsave.insertXML proc.
I hope it should work.
I am also trying to insert XML file but with a bit complex structure having multiple nested elements.
I am not sure how to transform the external XML file to wrap it in ROWSET/ROW using XSLT. It's mandatory to use ROWSET/ROW tags to be able to insert in oracle tables. I am facing this problem right now. I am using object views to accomplish the purpose but still needs to figure out the way to apply stylesheet to incoming XML file.
If you come to know of any way, pls do let me know also.
Thanks -
Using dbms_xmlsave.insertXML
Hi all,
I am reading an XML data which has similar structure to:
<dept>
<name> department name </name>
<loc> department location </loc>
<emp>
<fisrt> first name for first employee </first>
<last> last name for first employee </last>
</emp>
<emp>
<first> first name for second employee </first>
<last> last name for second employee </last>
</emp>
</dept>
I do not have control on the structure of the XML data as I am reading it from external source. Now I have created a table as follows:
SQL> create type emprec as object (
first varchar2(30),
last varchar2(30)
SQL> create type empreclist as table of emprec;
SQL> create table mydept (
name varchar2(30),
loc varchar2(50),
emp empreclist);
Now when I use the dbms_xmlsave.insertXML , the columns name,loc are populated but the column emp is not populated and i I define the emp column as (emprec) type, then only the last <emp></emp> data is inserted.
Any ideas how to read all the <emp></emp> data into the dept table ?Hi,
I have been trying for a while to get a nested collection loaded. The oracle documentation is no help. But what i did in the end is this. I built the object table, inserted the nested collection manual and then ran the command line XSU (documented in the app. dev. guide xml) to save the tabledata as XML (only one record) with the -withDTD switch. This creates a XML with inline DTD. Surprise surprise when you load that document it does work, even when you add more nested rows in the document. This XML file will also show you if you build the table correctly. It seems that XSU needs the DTD to be able to load nested collections.
If you are running windows the command line utility can be run like this
java -cp c:\oracle\ora81\rdbms\jlib\xsu12.jar;c:\oracle\ora81\lib\xmlparserv2.jar;c:\oracle\ora81\jdbc\lib\classes12.zip OracleXML getXML -user "username/password" -withDTD "select * from yourtable" >g:\xmlfiles\output.xml
have fun -
Error opening external DTD 'Segnatura.dtd' using dbms_xmlsave.insertXML
I've been trying to insert a document in a table. All works fine
if the xml doesn't contains the doctype element!
If I add the row
<!DOCTYPE Segnatura SYSTEM "Segnatura.dtd">
to my xml I get the error:
oracle.xml.sql.OracleXMLSQLException: Error opening external DTD
'Segnatura.dtd'.
If I specify all the path "file:///temp/Segnatura.dtd" the insert
works, but I don't want to do in that way beacause I don't want
to modify the original xml that i'm inserting!
In the package dbms_xmlsave I have no ways to change the
basedir/baseurl
or to setValidationMode to false like in xmlparser package.
Is there any way to solve this problem??
Thank's in advance
Mauro
This is an example scratch of my xml doc:
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<!DOCTYPE Segnatura SYSTEM "Segnatura.dtd">
<Segnatura versione="2001-05-07"
xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:lang="it">
</Segnatura>Hy Steven, thank's for your attention.
I'm not using the xsql servlet.
I'm reading an xml file coming from the file system and I want to
import it in the db using a java stored proc.
I also have the dtd file (Segnatura.dtd) but I don't know where
to put in on the server.
If I run my java program and I put Segnatura.dtd in the execution
classpath on the program the xml is loaded fine.
If I load the stored proc in the db then I don't know where to
put the dtd. Do I have to put the directory containing the dtd in
the server classpath and the restart the db maibe?
thank's
mauro -
Inserting Date AND Time using DBMS_XMLStore.insertXML
Hello,
I'm using a c# app to create an xml file to be passed to a stored procedure. The store procedure then uses DBMS_XMLStore.insertXML to insert the record in the xml file into the database.
There is a field in the Oracle table called "ENTER_DATE". I've been putting a date into the xml file for this field (ie. "10-mar-2010") and this has worked fine. However, I've now been asked to include the time with the date.
Is it possible to somehow put a date AND time value in the xml tag value so that DBMS_XMLStore.insertXML will properly insert it into the Oracle table? Everything I try returns a date picture format error.
ThanksSQL> create table dept2
as
select d.*, sysdate enter_date
from dept d
where 1 = 2
Table created.
SQL> select * from dept2
no rows selected.
SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss'
Session altered.
SQL> declare
ctx dbms_xmlstore.ctxtype := dbms_xmlstore.newcontext ('dept2');
doc xmltype
:= xmltype('<START>
<ROW>
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
<ENTER_DATE>10.10.2010 23:11:16</ENTER_DATE>
</ROW>
</START>');
ret int;
begin
ret := dbms_xmlstore.insertxml (ctx, doc);
dbms_xmlstore.closecontext (ctx);
end;
PL/SQL procedure successfully completed.
SQL> select * from dept2
DEPTNO DNAME LOC ENTER_DATE
10 ACCOUNTING NEW YORK 10.10.2010 23:11:16
1 row selected. -
Searching for missing files, using PSE6
After I have transfered a batch of photos using the -file -get photos -From files and folders, the thumbnails appear in " Organizer" but when I want to look at the photos in full screen they come up unclear and a dialogue box comes up ," searching for missing files" I then click on "browse" and the folder from which i have transfersd the photos, in "My Pictures" is not shown in the list. I have done this with an other folder of photos and it is also not shown in the list, as if they have dissapeared. The folders are still in " My Pictures"
I am totally frustrated with trying to get past first base with this program I have spent many hours trying to find a solutionIt sounds like you may be encountered one of the drive-handling bugs in PSE. To diagnose that, download and run the free utility "psedbtool":
http://www.johnrellis.com/psedbtool/#_Downloading,_Installing,_andhttp://www.johnrellis.com/psedbtool/
Copy and paste the output in a reply here. -
How do I get back to default settings for photoshop elements edit
How do I get back to default settings of photoshop elements 9 for edit. I tried to edit one picture and now all of my pictures are discolored.
Quit the editor, then restart it while holding down ctrl+alt+shift (cmd+option+shift on a mac). Keep the keys down till you see a window asking if you want to delete the settings file. You do.
-
Changing Field Label length for Data Element using ABAP code.
Hi Experts,
We have a scenario where we have to update the maximum length of the various Field Labels (Short, Medium, Long..) for a Data Element using ABAP code.
Does anyone know how to do this ? Is there a Function Module available for this purpose ?
Appreciate your valuable inputs.Hi ,
Use the view
DD03M
Give
TABNAME as table name,
DDLANGUAGE = EN / sy-langu
and order by position. (for correct sequencing)
You will get description of the fields (short,medium, long etc). You will also get the length and other details. -
HI,
We are running Exchange 2010 and are migrating users from 2003 to 2010 with no problems. The client has asked me to set OWA font to LuidaSans which I can do for individuals with no problems. However, when I try and run the following command
Get-Mailbox -Resultsize Unlimited | Set-MailboxMessageConfiguration -LucidaSans but then got a message to state
"property composefontname can't be set on this object becuase it requires the object to have version 0.1 <8.0.535.0> or later. The object's currant version is 0.0 <6.5.6500.0>"
What object is this reffered to? Can anyone help please?
Thanks
PaulHi,
To set a default font for all users, you can use this command: -
Get-Mailbox | Set-MailboxMessageConfiguration -DefaultFontName "Trebuchet"
You can use any font style in place of “Trebuchet”.
I hope this information will be helpful for you.
Thanks and regards
Ashish@S
Ashish@V -
HTAccess - set default image for missing image
Hi Folks,
I have a folder full of images and when en images is called form that directory and not found I would like the default image to show up.
I have added an HTAccess file with this content:
ErrorDocument 404 default.jpg
And added a default.jpg image in the directory.
I have used this approach successfully on a few other sites but in this instance when I open a page with a missing photo I still get the standard ugly missing image icon. However, if I open that image in a new tab I get a page with the text 'default.jpg' on it.
Anyone got an idea how I can fix it?
Cheers
DaveIf I remember well, in the Report Attributes, you should select the linked column. At the link image, there are 2 edit images(the default is the big one), but there is one more image which is smaller.
Hope it helps. -
Make Default Settings for cost element -OKB2
Hi,
What is the importance of the this process?
Please give your views, I have read the information provided by SAP.
Regards,
PankajHi
This process is for creating Cost Elements.
We can create Cost Elements in FS00 by selecting Edit Cost Element and giving Validity Period and Cost Element category.
We can create Cost Elements in KA01 also.
In the above 2 processes we can create a single Cost Element only at a time.
If you want to create more number of Cost Elements at a time, then you need to do the Process of Automatic Creation of Cost Elements, Make Default Settings -->OKB2 , Create Batch Input Session -->OKB3 and Execute Batch Input Session -->SM35.
Regards
Venkat -
Set different default values for table built using subforms
I'm using Designer 7.1 and need to have tables with a fixed number of rows, where the first column is readonly and displays a set of distinct values. For example
Body System Normal Abnormal Comments
Head
Neck
Respiratory
etc.
I'm constrained to building the table using subforms. I'd love to do it using the new table feature but this will not interface with our software.
I'm trying to put Javascript code in the Initialize section of the body subform that puts a different value in each row. I'm not finding a way to distinguish one row from the other. If I simply say
this.body_system.rawValue = 'Head'
Then all of the rows will have 'Head' in the first column.
I've tried the following but it doesn't work:
this.body_system.rawValue[0] = 'Head'
this.body_system.rawValue[1] = 'Neck'
Thanks for your help!
PeterThat worked perfectly. I'd love to have figured that out myself but it must be buried in the help somewhere. Is there a good reference document for LiveCycle Designer Javascript? I've scoured around but could only find bits and pieces.
BTW here's the code that worked:
xfa.datasets.data.resolveNode("form1.TableParent.TableBodyRow[0].body_system").value = 'Head;
xfa.datasets.data.resolveNode("form1.TableParent.TableBodyRow[1].body_system").value = 'Neck';
etc.
Thanks so much!
Peter -
How to set default value for Zfeild using statusprofile
hi experts,
I need to set a default value for a zfeild using status profile.Although we can default the values,using getter and setter methods,but in my requirement,the feild will be defaulted when the page is locked,also in display mode,which will require me to write code to unlock then set the value and then write a commit,as there wont be any user action performed.
I have created a zstatus profile and have set the required status to inital,but no luck
please suggest if this canbe achived through status profile.
Regards
Anu.Hi,
You can check in the getter if the Page is locked and then display the value to want to display. Note that this will be just Displaying the default value for the Zfield and it will not set the default value into the Zfield in DB, because when the document is locked ( means locked for editing - mostly when system status is completed ) , setters are not called and so you can display the value but cant set it. This is fine if the value you want to display in Z field is just for user's informations and its not required to save this default value.
The best approach would be to set the value in the Zfield before the page is locking. For example, If you wat to set the zfield value when status is set to "Completed" , then you can configure an action that is 1) triggered during saving of the document with 2) start condition "When status is completed" ( both 1 and 2 you can mention in action defination ), then Implement this action badi in which you can set the Zfield to default value.
This will ensure that default value is always set whenever the page is getting locked for editing ( i assumed that page lock means status completed ).
Thanks & Regards
Suchita
Maybe you are looking for
-
Even with 3 signal bars on a 11mb/s connection. It takes more then 3 mintues to load Google fully! It works fine loading one page then goes back to being slow or no excitant. It seems to start working again after using speed test. At first i thought
-
Installing Acrobat Pro 9.2 in a Terminal Server Environment
Hi everyone, we're facing massive problems in our attempts to install Acrobat Pro 9.2 in a terminal server environment. It seems to be impossible to convert for example a .doc-file into a pdf via the adobe pdf-printer using a restricted user-account.
-
How do I turn off list formatting in Notes app?
I want the Notes app to function as a plain text editor. But I was experimenting with formatting & selected "Insert Numbered List" from the "Format" menu. Now I can't turn it off! E.g. any time I enter "1) " as the begining of a line, Notes indents &
-
Hi Not sure whether its right forum to post this, I'm using server for long time and its performance is getting bad, Can somebody suggest how I can speed up its performance? Any suggestions Thanks in advance Srikant
-
When will carplay for sonata be available
I just leased a 2015 Hyundai Sonata Limited. Very nice car. When will Carplay be available?