初学oracle(二)

第一个问题:

oracle 资源正忙,要求指定nowait

当进行删除表的数据或是删除表时报出此错。

原因:其他地方占用了此资源,致使不能对它进行操作。

第二个问题:

oracle 表间连接返回0行数据,前提是数据库中有符合条件的数据,可是以查询时却返回0行。

这个问题困扰了一天多时间,终于在高手的指点下找到答案。

select * from testuser.tablea where trim(aid) in (select trim(aid) from testuser.tablec where cnd='2009')

只要在字段上加上trim()函数,使两边字段完全匹配才能得到想要的数据。

select a.aid,a.aname,c.cnd from testuser.tablea a join  testuser.tablec  c  on trim(a.aid)=trim(c.aid)
where c.cnd='2009'

表间连接亦是如此。

posted @ 2011-03-30 17:22  编程改变生活  阅读(189)  评论(0编辑  收藏  举报