On Fri, Jan 13, 2023 at 9:12 AM Ron <ronljohnsonjr@xxxxxxxxx> wrote:
is there any way to directly embed v_ssn in another string?
NoAs expected, this fails:
postgres=# SELECT * FROM employee WHERE ssn LIKE :'%v_ssn%';
ERROR: syntax error at or near ":"
LINE 1: SELECT * FROM employee WHERE ssn LIKE :'%v_ssn%';
Two options:
format('%%%s%%', :'v_ssn')
This one looks clean, and works perfectly:
'%' || :'v_ssn' || '%'
--
Born in Arizona, moved to Babylonia.
Born in Arizona, moved to Babylonia.