php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40078 oci_bind_array_by_name with NULL => ORA-01405
Submitted: 2007-01-09 17:11 UTC Modified: 2007-01-11 11:28 UTC
From: fsurleau at skyservices dot net Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.2.1RC2 OS: RedHat EL4
Private report: No CVE-ID: None
 [2007-01-09 17:11 UTC] fsurleau at skyservices dot net
Description:
------------
When the returned Oracle table contains at least one NULL, oci_execute() fails: ORA-01405: fetched column value is NULL.

Regards,
Fred.

Reproduce code:
---------------
<?php
$c = oci_connect("scott", "tiger");

$create_pkg = "
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
    TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
    PROCEDURE nullbind(c1 OUT ARRTYPE);
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);

$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
    PROCEDURE nullbind(c1 OUT ARRTYPE) IS
    BEGIN
        c1(1) := 'one';
        c1(2) := 'two';
        c1(3) := '';   -- <= This cause ORA-01405
        c1(4) := 'four';
        c1(5) := 'five';
    END nullbind;
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);

$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");

oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);

oci_execute($statement);

var_dump($array);
?>


Expected result:
----------------
array(5) { [0]=>  string(3) "one" [1]=>  string(3) "two" [2]=>  string(1) "" [3]=>  string(4) "four" [4]=>  string(4) "five" }

Actual result:
--------------
oci_execute() [function.oci-execute]: ORA-01405

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-11 11:28 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC