> > At the top-level, it's even more dubious. In DB2, apparently you write >> >> CALL foo(123, ?); >> >> with a literal ? for the OUT parameters. >> > That's not actually as scary as it seems.
DB2 has two cases where you can use a ? like that: 1) In CLP (DB2's equivalent to psql) DB2 draws a distinct line between procedures and functions, and you have to invoke procedures with CALL FOO(...). Since CLP doesn't support variables (and SQL variables didn't exist in DB2 when the CALL statement was introduced), they needed a way to say "there's an output parameter here" so they settled on using ? as the placeholder. (? was chosen because it ties nicely into the next point.) 2) In dynamic SQL DB2 has traditionally used ? as a parameter marker (placeholder for a variable) in dynamic SQL. So the usage would look something like: DECLARE res INTEGER; DECLARE text VARCHAR(50); SET text = 'CALL foo(123, ?)'; PREPARE stmt FROM text; EXECUTE stmt INTO res; -- This invokes the statement and maps the ? into the variable "res" If you didn't need/want to use dynamic SQL, then you could have simply written: CALL foo(123, res); - Doug Doole Salesforce