From:             tony at marston-home dot demon dot co dot uk
Operating system: Windows XP
PHP version:      5.2.0
PHP Bug Type:     OCI8 related
Bug description:  ORA-00932: inconsistent datatypes: expected CHAR got ARRAY

Description:
------------
I am using the latest OCI8 extension from PECL.

I have created a database table which contains a VARRAY user-defined type
as follows:

CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
CREATE TABLE x_person (
  person_id varchar2(8) NOT NULL,
  first_name varchar2(20) NOT NULL,
  last_name varchar2(30) NOT NULL,
  favourite_food t_fav_food,
  PRIMARY KEY  (person_id)
);

I can write a record containing a VARRAY type, but I am unable to read it
as oci_fetch_array() fails with error ORA-00932.




Reproduce code:
---------------
<?php
$dbconn = ociLogon('tony', 'tony', '//localhost/xe') or die('unable to
connect to database');
$query = "TRUNCATE TABLE x_person";
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('truncate
failed');
$query = "INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('AJM','Tony','Marston', t_fav_food(1,3,5))";
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #1
failed');
$query = "INSERT INTO x_person (person_id, first_name, last_name,
favourite_food) VALUES ('FB','Fred','Bloggs', t_fav_food(2,4,6))";
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS) or die('insert #2
failed');
$query = "SELECT * FROM x_person";
$stmt  = oci_parse($dbconn, $query);
$result = oci_execute($stmt) or die('select failed');
while ($row = @oci_fetch_array ($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
    $array[] = array_change_key_case($row, CASE_LOWER);
} // while
if ($error_array = oci_error($stmt)) {
    echo 'Error code: ' .$error_array['code'] ."\r\n";
    echo 'Error msg : ' .$error_array['message'] ."\r\n";
    exit();
} // if
echo 'Done';
?>


Expected result:
----------------
I expect the VARRAY column to be made available in my program so that it
can be processed using the oci-collection methods, similar to the way
CLOBs and BLOBs are handled.

This is what I can already do with the SET type in MySQL, and the ARRAY
type in PostgreSQL.

Actual result:
--------------
The call to oci_fetch_array() fails with ORA-00932: inconsistent
datatypes: expected CHAR got ARRAY. This means that I am unable to read
table that contains a VARRAY column.

-- 
Edit bug report at http://bugs.php.net/?id=40186&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40186&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40186&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40186&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40186&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40186&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40186&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40186&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40186&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40186&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40186&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40186&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40186&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40186&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40186&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40186&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40186&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40186&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40186&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40186&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40186&r=mysqlcfg

Reply via email to