I have a PHP calling Oracle database. The issue is that when I'm using SQLDeveloper to query the database with the given SQL, I can get the correct results. Now I have an existing PHP application that reads SQL from an XML. Other SQLs successfully returns rows, but when I used the given SQL it did not return any rows. Is there something wrong in my SQL which cannot be accepted in PHP Oracle? Or are there case where tables in Oracle that cannot be queried? Thank you.
SQL in XML file:
Select "PROJECT_NAME" From TABLE_A
Where EXISTS (
SELECT "DATA ID", "DATA NAME" FROM TABLE_B
WHERE TABLE_B."DATA LEVEL" = 3
AND TABLE_B."DATA TYPE" = 'TYPEA')
AND TABLE_A.COLUMN1 is null
PHP Code:
<?php
echo '<br> sql: ' . $report_sql;
$stmt = oci_parse($conn, $report_sql);
oci_execute($stmt, OCI_DEFAULT);
echo '<div style="width:450px;"> <table id="tableBD1" class="display" cellspacing="0" width="100%">';
echo '<thead>
<tr >
<th>Project Name</th>
</tr>
</thead>';
echo '<tbody>';
while ($row=oci_fetch_array($stmt,OCI_BOTH))
{
echo "<tr><td> <a href='#'>". $row['PROJECT_NAME'] . "</a> </td>";
}
echo '</tbody>';
echo '</table> </div>';
oci_free_statement($stmt);
?>