在 Oracle 9.2 中,如何将包含字符串文本的 LONG 类型与 VARCHAR2 的列进行比较
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/501625/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
in Oracle 9.2, how to compare LONG Type containing String text to a Column of VARCHAR2
提问by
simple q. in Oracle 9.2, how to compare LONG Type containing String text to a Column of VARCHAR2.
简单的q。在 Oracle 9.2 中,如何将包含 String 文本的 LONG 类型与 VARCHAR2 的列进行比较。
select * from table1 t1, table2 t2 where t1.long_value = t2.varchar2_value
select * from table1 t1, table2 t2 where t1.long_value = t2.varchar2_value
how can i execute such a query the easiest way?
我怎样才能以最简单的方式执行这样的查询?
回答by DCookie
回答by John Nilsson
hmm, without having Oracle accesible I'm guessing your problem is with casting to the correct types.
嗯,没有 Oracle 可访问我猜你的问题是转换为正确的类型。
try (''||t1.long_value) = t2.varchar2_value
to force a conversion
尝试(''||t1.long_value) = t2.varchar2_value
强制转换
but it depends on how you have your indexes setup. If you want to utilize the index on t1.long_value you may be better of converting t2.varchar2_value to something
但这取决于您如何设置索引。如果您想利用 t1.long_value 上的索引,最好将 t2.varchar2_value 转换为某些内容