Problem with composed queries (eg UNION, INTERSECT ..) and PHP

From: Date: Tue, 02 Jan 2001 22:20:24 +0000
Subject: Problem with composed queries (eg UNION, INTERSECT ..) and PHP
Groups: php.db 
Request: Send a blank email to php-db+get-5533@lists.php.net to get a copy of this message
Hi all, I can't find a way to get composed queries working with PHP. I've tried to parse some forums, mailing list archives, developpers sites, and I was really disapointed because I didn't saw any example of a composed query ... So what ? Am I the only one to use that type of queries with PHP ? :-) My problem is the following :I want to run a query like this on an Oracle database SELECT field1, field2 FROM table1 WHERE (some conditions) UNION SELECT field1, field2 FROM table1 WHERE (some conditions) But Oracle's parser raises an error if I don't put ';' at the end of each query. And I know I shouldn't put a ';' when parsing a query from PHP API. I tried several methods : coma, parenthesis. I also tried to put my query between a 'BEGIN ..... END;' statement like in PL/SQL. Is there a way to execute this style of query from PHP, and what is the correct syntax ? Or should I store the query in the database and run it as a stored procedure ? Thanks for reading this. Olivier.

« previous php.db (#5533) next »