DELIMITER $$
drop procedure if exists disk.p_dir_info$$
create definer = root@localhost procedure disk.p_dir_info(in user varchar(20), in parent_path varchar(255))
begin
select * from
(select d.user, d.path, d.parent_path, d.dir, d.create_time,
(case isnull(sum(f.count)) when true then 0 else sum(f.count) end) as count,
(case isnull(sum(f.size)) when true then 0 else sum(f.size) end) as size
from t_directories d_left join
(select path, count(file) as count, sum(size) from t_files group by path) f on instr(f.path, d.path) = 1
where d.user = user and d.parent_path = parent_path group by path) dir order by create_time;
end $$
DELIMITER;
运行时报语法错误,请大牛看看是哪里出问题了,提示显示是第一行出错...谢谢大牛~
drop procedure if exists disk.p_dir_info$$
create definer = root@localhost procedure disk.p_dir_info(in user varchar(20), in parent_path varchar(255))
begin
select * from
(select d.user, d.path, d.parent_path, d.dir, d.create_time,
(case isnull(sum(f.count)) when true then 0 else sum(f.count) end) as count,
(case isnull(sum(f.size)) when true then 0 else sum(f.size) end) as size
from t_directories d_left join
(select path, count(file) as count, sum(size) from t_files group by path) f on instr(f.path, d.path) = 1
where d.user = user and d.parent_path = parent_path group by path) dir order by create_time;
end $$
DELIMITER;
运行时报语法错误,请大牛看看是哪里出问题了,提示显示是第一行出错...谢谢大牛~
解决方案 »
- 高人指点,我新建的mysql数据库怎么没有默认的函数库啊?
- 这条语句什么意思,执行的先后顺序可以给我讲一下吗?
- mysql中if脚本的问题
- mysql如何变更数据库实例名
- 关于如何把Access数据如何导进mysql中的方法
- mysql客户端中,variables列表里的have_bdb为何不能修改
- 求一个把表记录导入到文本文件,并且带‘|’分隔符。
- 请问怎样改变MYSQL数据库的字段长?????????????
- 1000人在线,2000条数据的情况下读取一条数据,是mysql还是xml好?
- 两个日期时间的字段值,如何得出他们之间的时间的差值?
- MySQL 事务的问题
- 【求助】第一次设master/slave,不同步,不知道原因。100元报酬当我请顿饭
mysql> drop procedure if exists p_dir_info$$
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> create procedure p_dir_info(in user varchar(20), in parent_path varchar(255))
-> begin
-> select * from
-> (select d.user, d.path, d.parent_path, d.dir, d.create_time,
-> (case isnull(sum(f.count)) when true then 0 else sum(f.count) end) as count,
-> (case isnull(sum(f.size)) when true then 0 else sum(f.size) end) as size
-> from t_directories d_left join
-> (select path, count(file) as count, sum(size) from t_files group by path) f on instr(f.path, d.path) = 1
-> where d.user = user and d.parent_path = parent_path group by path) dir order by create_time;
-> end $$
Query OK, 0 rows affected (0.00 sec)mysql> DELIMITER ;
mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.33-community-log |
+----------------------+
1 row in set (0.00 sec)mysql>