SELECT '1' + char(13)+char(10) + '2'
結果為1
2
在INFORMIX SQL中換行則需先執行換行設定後
EXECUTE PROCEDURE IFX_ALLOW_NEWLINE('t');
再進行換行
select '1' ||'
'||'2' from empty ;以上只在當次session中生效.否則就要在$ONCONFIG 中將ALLOW_NEWLINE設定為1
參考來源 http://www.iiug.org/forums/classics/index.cgi/read/4100
後記:
後來建了一個function,在里頭進行折行效果,結果一直無法建立, 出現以下錯誤
-282 Found a quote for which there is no matching quote
查看informix online help說明,
Quotes on different lines:
- Run EXECUTE PROCEDURE ifx_allow_newline ('t'). This stays in effect until the end of your session.
- Set the ALLOW_NEWLINE parameter to 1 in the ONCONFIG configuration file and restart the database server.
測了半天,原來要在create function前先啟用 IFX_ALLOW_NEWLINE, 如下
EXECUTE PROCEDURE IFX_ALLOW_NEWLINE('t');
create function fn_bevtest
(i_col1 integer) RETURNING varchar(255);
define v_name varchar(255);
EXECUTE PROCEDURE IFX_ALLOW_NEWLINE('t');
select '1'||'
'||'2' into v_name from empty;
return v_name;
end function;
(i_col1 integer) RETURNING varchar(255);
define v_name varchar(255);
EXECUTE PROCEDURE IFX_ALLOW_NEWLINE('t');
select '1'||'
'||'2' into v_name from empty;
return v_name;
end function;
沒有留言:
張貼留言