PHP & OCI: the bad semicolon
I don’t know who to blame: PHP or the Oracle Client Interface?Surely the latter!
I had some time wasted in trying to figure out why my query, issued by a PHP piece of code, were not hitting the Oracle database. Somehow, with a pure guess, I figured out that ending semicolon is provoking OCI to fail and
oci_error()
is of no help at all in finding this.
So I digged into the documentation, and find out that SQL statements should not have an ending semicolon:
SQL statements should not end with a semi-colon (";").
PL/SQL statements should end with a semi-colon (";").
Why isn’t the driver (
oci
) cleaning the query string by itself?
Why is semicolon used as a discriminator between plain SQL and procedures?
These are the times I thank PostgreSQL to be so much cleaner and consistent.