当前位置:数据库 > Oracle >>

oracle,where in,数据库语法

关于一个where in 的语法 求高手解答: 如:select * from tab where id in (select xid from tabl ) 这样的语句能执行. select * from tab where id in ('1','2','3','4') 这样的语句也能执行. 为什么我把select xid from tabl 查询出来的数据 替换成 '1','2','3','4' 就不能执行? 如: select * from tab where id in ( 替换成的字符串( '1','2','3','4' ) ) 不能执行!
补充:对不起,是我意思表达可能有问题. 
我的问题是:
表tabl;
xid       |          name
--------------------------------------------
1,2,3,4|          eg.name
表tab;
id        |           name
-----------------------------------------------------
1         |           eg1
2         |           eg2
3         |           eg3
4         |           eg4
查询语句:
sql1:select * from tab where id in ( REPLACE((select xid from tabl),“,”,"''''") )  查询出来没有值
其实上面语句sql也等同于:
sql2:select * from tab where id in ('1','2','3','4')  但这个有值
 其实sql1 中的 in 中的sql值等于'1','2','3','4'
答案:你是不是想问,例如:
select xid from tabl  查出来的数据是 '123','234','432'
然后select * from tab where id in ('123','234','432')这个查询不出来

如果是你把查出来的数据发出来看看呢
其他:select * from tab where id in (select XID from tab1); 依稀觉得里面有点小问题,想不起来了 

上一个:大家谁有oracle数据库软件,帮忙发我一个,谢谢
下一个:偶然发现oracle用的数据库文件居然是 dbf,那么oracle和dbase、foxbase有关系吗?

Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,