on 2014 May 22 2:38 PM
Latest Powerbuilder 12.5.2
Oracle 11g
How can I update a XMLType column?
can select it, but errors on update.
Request clarification before answering.
I suspect that you will need to treat it as a clob, on your select you use the .getCLOBVal() syntax to convert the XMLType to a string.
Likewise on your update you use the XMLTYPE function to convert the string back to XML.
Something like this:
UPDATE purchaseorder
SET OBJECT_VALUE = XMLType(<xmlstring>), nls_charset_id('AL32UTF8')) where ....
Not tried this but I hope it helps.
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry about that, I got the information from this link:
I guess we need to get the right syntax in sqlplus (or equivalent) then map that to PB.
The other alternative is to create a procedure to do the update for you, pass in a clob and convert that. The 4k limit you are seeing is the limit on a varchar2. All the xml work I have done has involved endless conversions.
CREATE OR REPLACE PROCEDURE xmlupdate (xmlin IN CLOB, xmlout OUT CLOB)
IS
txml XMLTYPE;
BEGIN
-- Convert Clob Received into an XML document
txml := xmltype (xmlin);
.....
END;
After trying all different ways I cannot get it to work. Looking at the PB documentation the XMLTYPE is handled as a string, and oracle limits you to 4000 characters. If I go over that I get string literal too long.
So I conclude the procedure method is the only way to update large XML strings.
This is the syntax I used, as you can see I tried it with two strings less that 4000 just in case, but once the string went over 4000 I got the error.
update timesheets.test set xmlstuff = xmltype('<XX>'||:xmlss1||:xmlss1||'</XX>') where keyx = '1
Message was edited by: David Peace
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.