我正在使用觸發器更新記錄。在Postgresql中使用帶有變量的Escape Letter
上午試圖
CREATE OR REPLACE FUNCTION fn_trg_sales2()
RETURNS trigger AS
$BODY$ declare
xNarr text='';
select name into xNarr from t1 where id =1;
update t2 set narration =E narration || case when narration ='' then xNarr else
'\n' || xNarr end where id=1
return null;
end;
$BODY$
上述過程顯示錯誤。
如何在此更新查詢中使用escape character
使用變量? 如何使用帶變量的轉義字符?不要使用轉義字符提示out變量。
正在使用的PostgreSQL 9.1
編輯
我得到的信息形成一些命令,所以我在我的觸發更新這樣
update t2 set narration =narration || case when narration ='' then xNarr else
quote_literal('\n') || xNarr end where id=1
現在顯示在表中兩行但它的結束並從'開始。
像
narration
this is first'
'this is second
如何與出單qutoation存儲?