How to perform string concatenation in PL / SQL?

I have a variable defined as

define dbs '&1'

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

define dbs database1

I want to add single quotes around the string, i.e. I want her to be interpreted as

define dbs 'database1'

How should I do it?

+5
source share
1 answer

Single quotes in strings should be escaped with one separate quotation mark, so you should write (if I understand macro decomposition correctly)

 '''&1'''

String concatenation is performed using || Operator

 '''' || '&1' || ''''
+16
source

All Articles