Re: Oracle XMLTYPE column truncates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


Mikey wrote:
> Hi!
> 
> I am running some tests for implementing variable metadata using
> Oracle's XMLTYPE.  Creating the XML and inserting it into the database
> works fine, however when trying to retrieve data it truncates the
> returned results.  The code I am using to fetch the data is as follows:
> 
> $row_sql = "SELECT xml_metadata FROM mdt1_metadata WHERE key_id = :kid";
> $row_sth = oci_parse ($conn, $row_sql); // $conn defined elsewhere
> oci_bind_by_name ($row_sth, ":kid", $row['key_id']);
> if (oci_execute ($row_sth)) {
>     $xml_row = oci_fetch_array ($row_sth, OCI_ASSOC);
>     try {
>         $xml = new SimpleXMLElement ($xml_row['xml_metadata']);
>     }
>     catch (Exception $e) {
>         echo "\n\n{$xml_row['xml_metadata']}\n\n";
>         exit;
>     }
>     // stuff goes in here....
> }
> 
> 
> I was wondering if anyone else on this list has had the same problem, or
> knows of a better way of returning long values using OCI?
> 
> TIA,
> 
> Mikey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux