开发者

How to perform string concatenation in PL/SQL?

开发者 https://www.devze.com 2023-01-21 15:26 出处:网络
I have a variable defined as define dbs \'&1\' Suppose I pass database1 as an argument. Then the statement is int开发者_如何学运维erpreted as

I have a variable defined as

define dbs '&1'

Suppose I pass database1 as an argument. Then the statement is int开发者_如何学运维erpreted 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' || ''''
0

精彩评论

暂无评论...
验证码 换一张
取 消