In EDB Postgres, \set
command is used to set variables, like for example \set detpno 80
and while inserting we can use :deptno
instaed of actual value like
insert into dept values (:deptno, 'SALES', 'HYD');
it's working fine, but when i use it in Procedure or anonymous block its throwing error.
simple anonymous block
begin
insert into dept values (:deptno, 'SALES', 'LONDON');
end;
when i execute this block, I am getting below error
ERROR: syntax error at or near ":"
LINE 2: insert into dept1 values (:deptno, 'SALES', 'BAN');
Please help me out to use \set variable in procedures or functions.