#40785 [NEW]: Error trying to insert into CLOB column using PDO_OCI and Streams.

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40785 [NEW]: Error trying to insert into CLOB column using PDO_OCI and Streams.

    From: jarismar at adplabs dot com dot br
    Operating system:
    PHP version: 5.2.1
    PHP Bug Type: PDO related
    Bug description: Error trying to insert into CLOB column using PDO_OCI and Streams.

    Description:
    ------------
    Trying to inset into a CLOB field usint RETURNING column INTO sql syntax,
    results on the following error :

    OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BLOB got CLOB

    I've tested with Oracle 9i and 10g (both relases 10.1 and 10.2).



    Reproduce code:
    ---------------
    try {
    $oPDO = new PDO($sDSN, $sUserName, $sPassword);
    $oPDO->beginTransaction();

    $oStmt = $oPDO->prepare(
    'INSERT INTO test_clob (id,data) '.
    'VALUES (:id, EMPTY_CLOB()) '.
    'RETURNING data INTO :value');

    if($oStmt === false) { print_r($oPDO->errorInfo()); }

    $iID = 1;
    if(!$oStmt->bindParam(':id', $iID)) { print_r($oStmt->errorInfo()); }

    $sData = str_repeat('x', 65535);
    if(!$oStmt->bindParam(':value', $resource, PDO::PARAM_LOB)) {
    print_r($oStmt->errorInfo()); }

    if(!$oStmt->execute()) {print_r($oStmt->errorInfo());}

    if (is_resource($resource)) {
    fwrite($resource, $sData);
    fclose($resource);
    }

    $oPDO->commit();

    } catch (Exception $oE) {
    print $oE->getMessage()."\n";
    }
    $oPDO = null;



    Expected result:
    ----------------
    No error or exception should occurs.

    Actual result:
    --------------
    Array
    (
    [0] => HY000
    [1] => 932
    [2] => OCIStmtExecute: ORA-00932: inconsistent datatypes: expected
    BLOB got CLOB
    (/oracle/applications/php-5.2.0/ext/pdo_oci/oci_statement.c:142)
    )

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

  2. Similar Questions and Discussions

    1. #40787 [NEW]: Error trying to insert into a CLOB column when using multi-byte charset.
      From: jarismar at adplabs dot com dot br Operating system: PHP version: 5.2.1 PHP Bug Type: PDO related Bug description: ...
    2. #25112 [Fbk]: SQLExecDirect error with CLOB column in SQL
      ID: 25112 Updated by: sniper@php.net Reported By: gms08701 at yahoo dot com Status: Feedback Bug Type: ...
    3. #25112 [Opn->Fbk]: SQLExecDirect error with CLOB column in SQL
      ID: 25112 Updated by: sniper@php.net Reported By: gms08701 at yahoo dot com -Status: Open +Status: ...
    4. #25112 [Bgs->Opn]: SQLExecDirect error with CLOB column in SQL
      ID: 25112 User updated by: gms08701 at yahoo dot com Reported By: gms08701 at yahoo dot com -Status: Bogus +Status:...
    5. #25112 [Opn->Bgs]: SQLExecDirect error with CLOB column in SQL
      ID: 25112 Updated by: sniper@php.net Reported By: gms08701 at yahoo dot com -Status: Open +Status: ...
  3. #2

    Default #40785 [Opn->Asn]: Error trying to insert into CLOB column using PDO_OCI and Streams.

    ID: 40785
    Updated by: [email]tony2001@php.net[/email]
    Reported By: jarismar at adplabs dot com dot br
    -Status: Open
    +Status: Assigned
    Bug Type: PDO related
    PHP Version: 5.2.1
    -Assigned To:
    +Assigned To: wez


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-03-12 16:22:07] jarismar at adplabs dot com dot br

    Description:
    ------------
    Trying to inset into a CLOB field usint RETURNING column INTO sql
    syntax, results on the following error :

    OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BLOB got
    CLOB

    I've tested with Oracle 9i and 10g (both relases 10.1 and 10.2).



    Reproduce code:
    ---------------
    try {
    $oPDO = new PDO($sDSN, $sUserName, $sPassword);
    $oPDO->beginTransaction();

    $oStmt = $oPDO->prepare(
    'INSERT INTO test_clob (id,data) '.
    'VALUES (:id, EMPTY_CLOB()) '.
    'RETURNING data INTO :value');

    if($oStmt === false) { print_r($oPDO->errorInfo()); }

    $iID = 1;
    if(!$oStmt->bindParam(':id', $iID)) { print_r($oStmt->errorInfo());
    }

    $sData = str_repeat('x', 65535);
    if(!$oStmt->bindParam(':value', $resource, PDO::PARAM_LOB)) {
    print_r($oStmt->errorInfo()); }

    if(!$oStmt->execute()) {print_r($oStmt->errorInfo());}

    if (is_resource($resource)) {
    fwrite($resource, $sData);
    fclose($resource);
    }

    $oPDO->commit();

    } catch (Exception $oE) {
    print $oE->getMessage()."\n";
    }
    $oPDO = null;



    Expected result:
    ----------------
    No error or exception should occurs.

    Actual result:
    --------------
    Array
    (
    [0] => HY000
    [1] => 932
    [2] => OCIStmtExecute: ORA-00932: inconsistent datatypes: expected
    BLOB got CLOB
    (/oracle/applications/php-5.2.0/ext/pdo_oci/oci_statement.c:142)
    )


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40785&edit=1[/url]
    tony2001@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139