Re: Oracle XMLTYPE column truncates
| From: | Mikey | 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: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! MikeyRoberto Mansfield wrote:Checkout http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/fuecks_lobs.html and go to the section "Selecting a LOB". -RobertoHi 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. RobertoHi Roberto, thanks for your reply - any pointers to resources for dealing with CLOBS? Mikey