php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35421 pdo_oci error
Submitted: 2005-11-27 08:35 UTC Modified: 2016-03-08 01:36 UTC
From: hellower at nate dot com Assigned:
Status: Not a bug Package: PDO OCI
PHP Version: 5.1.0 OS: windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hellower at nate dot com
New email:
PHP Version: OS:

 

 [2005-11-27 08:35 UTC] hellower at nate dot com
Description:
------------
when I use "ROWNUM" as bind variable name,
the query result set doesn't appeared.


db:  oracle 8.1.7.4
db os: aix 5.3

webserver: apache 2.0.55
webserver os: winows 2000

php : 5.1.0



Reproduce code:
---------------
<?php
$dbh = new PDO("oci:dbname=sslgm166_8174", 'XXX', 'XXX',array(PDO::ATTR_PERSISTENT => true));
echo "<pre>";
$sql = 'select * from  tab where rownum < :ROWNU';
$sth = $dbh->prepare($sql);
$sth->execute(array(':ROWNU' => 2));
$result = $sth->fetchAll();
print_r($result);

echo "<hr>";
$sql = 'select * from  tab where rownum < :ROWNUM';
$sth = $dbh->prepare($sql);
$sth->execute(array(':ROWNUM' => 2));
$result = $sth->fetchAll();
print_r($result);
echo "</pre>";
?>

Expected result:
----------------
Array
(
    [0] => Array
        (
            [TNAME] => CREDITS
            [0] => CREDITS
            [TABTYPE] => TABLE
            [1] => TABLE
            [CLUSTERID] => 
            [2] => 
        )

)
-----------------------------------------
Array
(
    [0] => Array
        (
            [TNAME] => CREDITS
            [0] => CREDITS
            [TABTYPE] => TABLE
            [1] => TABLE
            [CLUSTERID] => 
            [2] => 
        )

)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [TNAME] => CREDITS
            [0] => CREDITS
            [TABTYPE] => TABLE
            [1] => TABLE
            [CLUSTERID] => 
            [2] => 
        )

)
-----------------------------------------
Array  <------------------- EMPTY ARRAY !!!
(

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-27 08:42 UTC] hellower at nate dot com
.
 [2005-11-27 19:23 UTC] tony2001@php.net
Use $sth->errorInfo() to get the error message if $sth->execute() fails.
Hint: ROWNUM is a reserved word in Oracle.
No bug here.
 [2016-03-08 01:36 UTC] sixd@php.net
-Package: PDO related +Package: PDO OCI
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 18:01:32 2019 UTC