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