When should the colon (:) character be used in procedure or trigger code?
The colon character should only be used to prefix variables in SQL statements. It is not needed to use it for simple assignments, and sometimes even not desirable. It is never used for 'new.' and 'old.' values in triggers as 'new' and 'old' are relations valid in both SQL and PSQL expression evaluation. Example:
create procedure p1 ( x integer )
declare variable y integer;
select emp_id from employee where emd_id = :x into :y;
if (y > 20) then y = x * 12;
update t1 set my_num = :y where id = :x;