0

Ive been tasked to write a simple php+oracle web reprting tool and I happen to have chanced a pretty complex query that perfectly works in SQL Developer:

SELECT 'LASTNAME, FIRSTNAME, STATUS' from dual;

with user as

(
...
..
..
..

(very long query)

and then it gives me this:

PHP Warning:  oci_execute(): ORA-00911: invalid character

based on my initial investigation, it looks like PHP complains about the ';' after first line (where it says select from ... dual ;)

On the PHP side, it looks like this:

$stid = oci_parse($conn, $query);
oci_execute($stid);

where $query is the very long query:

$query = "SELECT 'LASTNAME, FIRSTNAME, STATUS' from dual;

with user as

(
...
..
..
..

I want to know if there is a way to rewrite the entire query without using the 'dual' part?

Robert L.
  • 1
  • 1

1 Answers1

0

Dual table is a dummy table with an single row, single column, only data is X.

You can create you own dual table, it is just a dummy table. may be you want to repeat the result twice and create a dual2 table with two row in it. the content doesn't matter.

tom87416
  • 542
  • 4
  • 9
  • Apparently, the first line that says `select... from dual ; ` was what's breaking it. Further research (internally & via Google) led me to the conclusion that I may not need that line after all, and could just rewrite the header myself. Helpful link which made me discover/learn about the WITH clause : http://www.oracle-base.com/articles/misc/with-clause.php – Robert L. Feb 11 '14 at 20:14