這是我的 postgresql 查詢
select 'insert into employee(ID_NUMBER,NAME,OFFICE) values ('''||ID_NUMBER||''','''||NAME||''','''||replace(DESIGNATION,'&','and')||''','''||replace(DEPT_NAME,'&','and')||''')' as col
from icare_employee_view
where id_number='201403241'
order by name;
輸出
insert into employee(ID_NUMBER,NAME,OFFICE) values ('201403241','ABINUMAN, JOSEPHINE CALLO','Assistant AGrS Principal for Curriculum and Instruction','AGrS Principal's Office')
但我'AGrS Principal's Office'需要'AGrS Principal''s Office'
但我需要“AGrS 校長辦公室”成為“AGrS 校長辦公室”
任何建議或解決方案都非常感謝如何修復我的 PostgreSQL 查詢
uj5u.com熱心網友回復:
嗨,從pgDocs檢查一下:
quote_literal ( 文本 ) → 文本
回傳適當參考的給定字串,以用作 SQL 陳述句字串中的字串文字。嵌入的單引號和反斜杠被適當地加倍。請注意,quote_literal 在 null 輸入上回傳 null;如果引數可能為 null,則 quote_nullable 通常更合適。另見示例 43.1。
quote_literal(E'O'Reilly') → 'O''Reilly'
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/454919.html
標籤:PostgreSQL 单引号
