|
Posted by Andy Hassall on 12/18/06 20:19
On Mon, 18 Dec 2006 11:37:15 -0000, "Tony Marston" <tony@NOSPAM.demon.co.uk>
wrote:
>Unfortunately that does not work as $col>size() always returns 0, even when
>I know the field is not empty.
Works for me, as demonstrated above, but as I said YMMV depending on the
version of the oci8 extension you're using.
>Even if this approach did work I do not like the idea of having to retrieve
>the VARRAY column independently of all the other columns.
Indeed, it's not suitable for your needs, just a demonstration of the limited
support the oci8 extension does have in this area.
>I know that I can write into this column using the name of the user-defined
>type as a function name, as in
>
>UPDATE person SET favourite_food=T_FAV_FOOD('1','2','4','10') WHERE
>person_id='FB'
>
>so would it not be possible to write a function which would do the reverse,
>i.e. convert the array into a comma-delimited string? This would then enable
>me to read the table with
>
>SELECT person_id, first_name, last_name, T_FAV_FOOD_R(favourite_food) FROM
>person WHERE person_id='FB'
>
>Hopefully that should then get around the "ORA-00932: inconsistent
>datatypes, expected CHAR got ARRAY"
>error. What do you think?
I think it's an abomination ;-) but that's what I think about varrays as table
columns in the first place. Without submitting a patch to the oci8 extension to
support defining varrays, then it's probably the closest you'll get, and should
work.
Probably the main reason why you're having trouble here is that hardly anyone
uses nested tables/varray columns in Oracle in the first place; that varray
column should be a separate table. Since they're not generally used like that,
then interface support in many languages is poor (as in there's full support on
Oracle's interface side, but it's not been connected in the PHP oci8
extension). But I do understand why you're trying to do this.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Navigation:
[Reply to this message]
|