substring operation on blob text in informix

走远了吗. 提交于 2019-12-24 10:58:25

问题


How can I substring a text of BLOB datatype in informix? If the operation is possible only on text of char datatype, is it possible to convert from BLOB to char (like to_char in oracle)?

Thanks in advance,


回答1:


You can use substring operator: http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp?topic=/com.ibm.sqls.doc/sqls1069.htm

Code looks like:

select txt, txt[3,5] from  _text_test

(txt is of BLOB type, but I also tested using TEXT type).

WARNING! In my tests such select gives different 2nd field values when executed by JDBC (correct values) and ODBC (seems incorrect). My ODBC Client is 3.70TC1, and JDBC.3.70.JC1DE. Please check if it works correctly in your environment. For txt value=1234567890 I got 123 using ODBC and 345 using JDBC. Seems like bug!



来源:https://stackoverflow.com/questions/4460623/substring-operation-on-blob-text-in-informix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!