PostgreSQL currently uses $1/$2 for placeholders in prepared statements.
I'm writing something that may potentially submit queries to both Oracle
and Postgres, and it seems Oracle doesn't accept this syntax. Someone on
IRC said I could use ? for both Oracle and Postgres. It isn't entirely
clear to me if Oracle accepts it, but Postgres doesn't seem to.
My copy of the SQL92 standard says:
«In SQL-statements that are executed dynamically, the parameters are called dynamic parameters (<dynamic parameter
specification>s)and are represented in SQL language by a <question mark> (?).»
(There's also an "<embedded variable name>" production in the standard,
which looks like the :foo syntax that Oracle also accepts, but I'm not
sure it applies to placeholders. The standard is a bit hard to read.)
Should Postgres accept ? as a placeholder?
(If so, I'll dig around and try to figure out how to make it do so.)
-- ams