mysql> BEGIN
select sysdate();
select sysdate();
END;
ERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select sysdate()' at line 2
+--+
| sysdate() |
+--+
| 2011-04-27 11:55:02 |
+--+
1 row in setERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1
mysql> 为什么会失败呢?
其实我的Ibatis里想在一条statement里执行2条语句, like this:
<statement ....>
BEGIN
statement1;
statement2;
END;
</statement ....>
select sysdate();
select sysdate();
END;
ERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select sysdate()' at line 2
+--+
| sysdate() |
+--+
| 2011-04-27 11:55:02 |
+--+
1 row in setERROR 1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 1
mysql> 为什么会失败呢?
其实我的Ibatis里想在一条statement里执行2条语句, like this:
<statement ....>
BEGIN
statement1;
statement2;
END;
</statement ....>
BEGIN
statement1;
statement2;
END;
</statement ....>在Ibatis里不能这样写, 在Mysql里写procedure?
其实我的Ibatis里想在一条statement里执行2条语句mysql> SELECT * FROM AAB;SELECT * FROM AA;
+------+-------+------+-------------------+------+------------+------+
| BID | Ccode | ID | ff | dd | dq | dd1 |
+------+-------+------+-------------------+------+------------+------+
| 1231 | A1 | 0 | 2009-6-2401:00:00 | 1 | 1 | NULL |
| 3 | A | 3 | NULL | NULL | 4 | NULL |
| 4 | B | 7 | NULL | NULL | 8 | NULL |
| 2 | C | 9 | NULL | NULL | 10 | NULL |
| NULL | D | 10 | NULL | NULL | 1300154351 | NULL |
+------+-------+------+-------------------+------+------------+------+
5 rows in set (0.00 sec)+-------------+------------+------------+-----------+-------+
| entity_code | group_code | group_name | create_by | jj |
+-------------+------------+------------+-----------+-------+
| 1 | 2 | *a*aa | NULL | 12.23 |
| CF370400 | 01 | aaa | 1 | NULL |
| CF370400 | 02 | bbb | 1 | NULL |
| CF370400 | 03 | ccc | 2 | NULL |
| CF370400 | A4 | eee | 2 | NULL |
| CF370400 | B1 | ddd | 2 | NULL |
+-------------+------------+------------+-----------+-------+
6 rows in set (0.00 sec)mysql>
在定义过程,函数啊都会先加个delimiter //