oracle 单行子查询出现多个行的错误
select distinct d.name, t.qry_code ,b.info_query_times from qry_log t left join tdcode b on t.qry_code = b.code_info left join
tdcode_batch c on b.sys_batch = c.sys_batch left join product d on c.product_id = d.id left join qry_exception_def e on d.id = e.product_id
where b.info_query_times>=e.qry_times
and e.period >= (select ((max(to_date(to_char(a.qry_time,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss'))-min(to_date(to_char(a.qry_time,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd hh24-mi-ss'))))*24
from qry_log a group by a.qry_code)
在这里and e.period >= 出现了单行子查询出现多个行的错误,请问谁能帮我改过来
and e.period >= all (select ((max(to_date(to_char(a.qry_time,'yyyy-mm-dd hh24-mi-ss'),'yyyy-mm-dd
谢谢,不过好像和我要的结果不一样,一条记录没有
SQL code:
select distinct d.name, t.qry_code ,b.info_query_times
from qry_log t left join tdcode b on t.qry_code = b.code_info
left join tdcode_batch c on b.sys_batch = c.sys_batch
left join product d on c.product_id = d.id
left join qry_exception_def e on d.id = e.product_id
where b.info_query_times >= e.qry_times
and exists (select 1 from qry_log a
where a.qry_c
相关问答:
我在创建数据库的时候用的名字为oracle10,但是创建好后,在默认的目录下显示的名称却是oracle10g,这是为什么?
你看的 10g是安装目录吧
SQL> select name from v$database;
NAME
---------
ORCL
......
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
在执行包的时候引用oracle spatial空间函数出错,出错情况如下
Errors in file
/user/oracle/app/oracle/admin/grid/udump/grid1_ora_143768.trc: ORA-29902:
error in executing ODCIIndexStart() routine ORA-0 ......
select sum(a.t)from ta a group by ta.a,这条语句将表ta中的数据按照a字段分组汇总t字段。
结果比如:
3 30
4 50
我想得到这个结果:
1 0
2 0
3 30
4 50
5 0
这个结果,请问sql语句怎么写?多谢
nobody ......
我是在toad中输入下段sql
declare
TYPE test_rec IS record(
code varchar(10),
name varchar(30)
);
v_book test_rec;
......