How to perform string concatenation in PL/SQL? – Education Career Blog

I have a variable defined as

define dbs '&1'

Suppose I pass database1 as an argument. Then the statement is interpreted as

define dbs database1

I want to append single quotes around the string, ie I want it to be interpreted as

define dbs 'database1'

How should I do this?

,

Single quotes in strings need to be escaped with another single quote, so you would write (if I understand macro expansion correctly)

 '''&1'''

String concatenation is done with the || operator

 '''' || '&1' || ''''

Leave a Comment