On Fri, Jan 13, 2023 at 9:12 AM Ron <ronljohnso...@gmail.com> wrote:

>
> is there any way to *directly* embed v_ssn in another string?
>

No
As 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')
'%' || :'v_ssn' || '%'

David J.

Reply via email to