mysql
>
delimiter
//
mysql
>
mysql
>
CREATE
PROCEDURE
simpleproc (
IN
myId
INT
)
->
BEGIN
->
CREATE
TEMPORARY
TABLE
tmpMyTbl
LIKE
t2;
->
insert
into
tmpMyTbl
->
select
*
from
t2
where
id
<
myId;
->
END
;
->
//
Query OK,
0
rows affected (
0.09
sec)
mysql
>
mysql
>
delimiter ;
mysql
>
call simpleproc(
10
);
Query OK,
9
rows affected (
0.13
sec)
mysql
>
select
*
from
tmpMyTbl;
+
--
--+------+
|
id
|
col
|
+
--
--+------+
|
1
|
2
|
|
2
|
4
|
|
3
|
6
|
|
4
|
8
|
|
5
|
10
|
|
6
|
12
|
|
7
|
14
|
|
8
|
16
|
|
9
|
18
|
+
--
--+------+
9
rows
in
set
(
0.00
sec)
mysql
>