Is it possible to have a placeholder on the left side of a select criteria? eg: SELECT CASE WHEN date_part('dow',?::date)=5 this bit is fine THEN CASE WHEN ? = 2 OR ? =3 OR ?=6 OR ?=7 OR ?=8 OR ?=12 THEN '7:00' here the ? is being read as NULL ie, output from LOG SELECT CASE WHEN date_part('dow', '2005-02-28'::date)=5 THEN CASE WHEN NULL = 2 OR NULL =3 OR NULL=6 OR NULL=7 OR NULL=8 OR NULL=12 THEN '7:00' WHEN NULL = 1 OR NULL =5 OR NULL=13 THEN '3:30' ELSE NULL END I am getting the ? translated as nulls apologies for off-topic, but any help appreciated ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)