1.单纯加单引号:
select chr(39)||name||chr(39) from users ;
或者
select ''''||name||'''' from users ;
如果后面需要加逗号,写为:
select ''''||name||''',' from users ;
2.加其他内容
select 'alter table '||table_name||' allocate extent;' from user_tables
参考:https://www.cnblogs.com/tan80000/p/9953097.html