Oracle 长原始问题
select utl_raw.cast_to_varchar2(DCFILE) hexchar from T_FILE
ORA-00997: 非法使用 LONG 数据类型
select to_char(DOC_FILE) hexchar from T_DOC_FILE
ORA-00932: 不一致的数据类型: 预期 CHAR 得到 LONG BINARY
我的列类型为 long raw,如何选择 varchar2 ?
select utl_raw.cast_to_varchar2(DCFILE) hexchar from T_FILE
ORA-00997: illegal use of LONG datatype
select to_char(DOC_FILE) hexchar from T_DOC_FILE
ORA-00932: inconsistent datatypes: expected CHAR got LONG BINARY
My column type long raw, how to make selected varchar2 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
十多年前,Oracle 在 8.0 版本中引入了 LOB 数据类型。 LONG 和 LONG RAW 从千禧年之前就已被弃用(分别支持 CLOB 和 BLOB),正是因为使用 LONG 是一件令人头疼的事情,而 LONG RAW 则更加令人头疼,正如您现在所发现的那样。
您究竟想要实现什么目标?你的逻辑看起来很混乱。 LONG RAW 用于存储二进制数据(图像、文档等),因此将其渲染为文本不太可能产生令人满意的结果。
Oracle introduced their LOB datatypes in version 8.0, well over a decade ago. LONG and LONG RAW have been deprecated since before the Millenium (in favour of CLOB and BLOB respectively) precisely because working with LONGs is a pain in the neck and LONG RAWs doubly so, as you are now finding.
What exactly are you trying to achieve? Your logic seems confused. LONG RAW is intended for storing binary data (images, documents, etc) so rendering it as text is unlikely to produce satisfactory results.