2011-02-28 58 views
-1

任何一個可以更正下面的語句嗎?plpgsql函數文本串聯錯誤

strdir := 'copy ' 
      || t_name.relname 
      || ' from E'''' || C: || ''''' 
      || t_name.relname || '''.txt'' using delimiters '|''; 
+0

什麼問題?只需計算報價。使用熒光筆更容易,但... – GolezTrol 2011-02-28 13:41:42

+0

錯誤是線1:... rom E''''|| C:||'''''|| $ 2 ||'''。txt''使用分隔符'|'' – kallem 2011-02-28 13:56:47

回答

0

我認爲最後|周圍的單引號應該是每兩個單引號。

+0

我試過我得到follwoing錯誤「錯誤:操作符不存在:文本|未知 行1:... E''''|| C:||'''''|| $ 2 ||'''.txt''使用分隔符'''|''''「 – kallem 2011-02-28 13:59:57

1
strdir := 'copy ' 
      || t_name.relname 
      || ' from E''C:"' -- one ' to many here, included C:, which had no ' 
          -- and I suspect you need a double quote here " 
      || t_name.relname 
      || '".txt'' using delimiters ''|'''; -- closing ", double ' around |