Re: Oracle XMLTYPE column truncates

From: Date: Thu, 08 Mar 2007 17:18:50 +0000
Subject: Re: Oracle XMLTYPE column truncates
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-250093@lists.php.net to get a copy of this message
Roberto Mansfield wrote:
Mikey wrote:
Roberto Mansfield wrote:
Hi Mikey, OCI doesn't directly support the XMLtype so you need to convert to string (if < 4k) or clob before retrieving. Use: select xml_metadata.getClobVal() ... OR select xml_metadata.getStringVal() ... If converting to clob, you get a clob object back and you'll need to run the load() method on it to get the text back. Roberto
Hi Roberto, thanks for your reply - any pointers to resources for dealing with CLOBS? Mikey
Checkout http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html and go to the section "Selecting a LOB". -Roberto
LOL - thanks a lot Roberto ;o) Two caveats that I just found the hard way... 1). In the documentation they alias the table - IGNORE THIS AT YOUR PERIL! It will not recognise getClobVal() unless you do. 2). Bit of a silly one, but I guess someone else might make the same mistake... when you add the alias and the getClobVal() call, you change the name of the column returned. So $row['xml_metadata'] won't exist unless you alias the column back ot that name. Doh! Mikey

« previous php.general (#250093) next »