三個單引號 ''' 代表 SQL 一個單引號
select ' insert into HOSPIN_USER ( HOSPITAL_CODE,HOSPITAL_FULL_NAME,user_id,user_Name,user_PW,hospital_grade) VALUES('''
|| A.HOSPITAL_CODE || ''',''' || TRIM(A.HOSPITAL_FULL_NAME) || ''',''' || A.HOSPITAL_CODE || ''',''' || TRIM(A.HOSPITAL_FULL_NAME)
|| ''',''' || A.HOSPITAL_CODE || ''',''' || A.hospital_grade || ''');'
from mast.hospital A
where A.nh_suspend_date is null
and substr(A.HOSPITAL_CODE,0,2) not in ('17', '18', '30', '31', '32', '33', '34', '37', '38')
and A.hospital_grade not in ('5','9')
Run out
insert into HOSPIN_USER ( HOSPITAL_CODE,HOSPITAL_FULL_NAME,user_id,user_Name,user_PW,hospital_grade) VALUES('0211070012','基隆市立醫院','0211070012','基隆市立醫院','0211070012','3');