Here is a little test program.


SQL> select emp_id, emp_name from employee;

dgrimes              Dean Grimes

35 rows selected.

This is a select using SQLPLUS to select all of the employees. There were a
lot of other names, I just removed them from the list.

SQL> select emp_id, emp_name from employee where emp_id = 'dgrimes';

dgrimes              Dean Grimes

This is a select using SQLPLUS that specifies the WHERE clause. It too works

I did not include the code to process using ora_open, ora_pars and ora_exec.
But it does work just fine with or without a WHERE clause.


$dbconnect = ora_logon('ops$dgrimes','changemenow');

// Select with WHERE clause
// $sql = "SELECT * FROM employee WHERE emp_id = 'dgrimes'";

// Select without WHERE clause
$sql = "SELECT * FROM employee";

$cur = ora_do($dbconnect,$sql);

// Uncomment this block to see results of WHERE CLAUSE. It gets No Data
echo ora_errorcode($cur);
echo ora_error($cur);
// Comment the above block to see results of select without WHERE CLAUSE

(ora_fetch_into($cur,$results,ORA_FETCHINTO_NULLS|ORA_FETCHINTO_ASSOC)) {
//      print_r($results);
//      echo "<br>\n";
        while (list($k,$v) = each($results))
                echo "Key=".$k." Val=".$v."<br>\n";


-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 03, 2002 3:51 PM
Subject: [PHP] Re: Problem With ora_do

>I'm having a weird problem with ora_do. It works fine as long as I don't
>have a "WHERE" clause in the query. For example:
>select * from table_name
>works just fine but ....
>select * from table_name where col_name = value
>returns nothing.
>However, if I use ora_open, ora_parse and ora_exec everything works fine.
>I'm running on Compaq Tru64 ver 5.1. I compiled PHP with gcc 3.1. I'm not
>getting any errors or warnings and nothing is being logged in the Apache
>logs. I guess it's not a big deal since I have been able to work around it,
>but it would be nice to know what the problem is.

Show us real source code...

Nothing in what you say seems 'wrong', but who knows?

Wild Guesses:

You're not seeing any errors because you're not *ASKING* to see any errors.
You have to specifically request error messages to be displayed or logged

You are doing something like:
$x = 2;
$query = "select * from table_name where col_name = x";
And, oddly enough, there are none with 'x' even though there are lots with
So, there's no problem with the query, it's just not the query you intended.
Try printing out your query, and paste it into the Oracle command-line
thingie (sql-dba?)

Like Music?

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to