Question:You want to update the last modified timestamp in the orders table. The correct way to do this in a PL/pgSQL function, when the parameter integer order_id is passed, would be:
A DECLARE order_id ALIAS FOR $1; mytimestamp timestamp; BEGIN mytimestamp := ''now''; UPDATE orders SET orderid=order_id, lastmodified = mytimestamp; RETURN mytimestamp; END; ' LANGUAGE 'plpgsql';
B DECLARE order_id ALIAS FOR $1; mytimestamp timestamp; BEGIN mytimestamp := 'now'; UPDATE orders SET orderid=order_id, lastmodified = mytimestamp; RETURN mytimestamp; END; ' LANGUAGE 'plpgsql';
C DECLARE order_id ALIAS FOR $1; BEGIN mytimestamp := ''now''; UPDATE orders SET orderid=order_id, lastmodified = ''now''; RETURN mytimestamp; END; ' LANGUAGE 'plpgsql';
D DECLARE order_id ALIAS FOR $1; BEGIN mytimestamp := ''now''; UPDATE orders SET orderid=order_id, lastmodified = 'now'; RETURN mytimestamp; END; ' LANGUAGE 'plpgsql';