I have this request in Oracle that is used by a PHP file
$pub_request = oci_parse($conn, "
select * from TP2_PUBLICITE p, TP2_PUBLICITE_MOT_CLE m
where
p.NO_PUBLICITE = m.NO_PUBLICITE and
p.DATE_DEBUT_PUB < CURRENT_DATE and
p.NB_CLICS_FAITS_PUB < p.NB_CLICS_PUB and
m.MOT like :search
order by DBMS_RANDOM.RANDOM fetch first 1 rows only
");
This snippet causes an error : ORA-00918: column ambiguously defined
When I remove the order by
clauses, the request is valid and everything works fine.
Why ? And how can I use DBMS_RANDOM.RANDOM in this context ?