日期:2014-05-16  浏览次数:20450 次

存储 过程的创建

1.

代码如下以下都是在mysql中的执行结果

无参存储过程的创建

mysql> create procedure nnd()
??? -> begin
??? -> set @d=90;
??? -> insert into users(id) values(@d);
??? -> select * from users;
??? -> end;

执行存储过程用call 例如执行上面的存储过程call nnd()

该存储过程的执行结果如下

+----+----------+----------+
| id | username | password |
+----+----------+----------+
|? 1 | aaaaaa?? | aaaaaa?? |
|? 2 | bbbbbb?? | bbbbbb?? |
|? 3 | aaaaaaa? | NULL???? |
|? 4 | aaaaaaa? | NULL???? |
|? 5 | aaaaaaa? | NULL???? |
|? 6 | 6??????? | NULL???? |
|? 7 | 6??????? | NULL???? |
|? 8 | 6??????? | NULL???? |
|? 9 | 3df????? | NULL???? |
| 90 | NULL???? | NULL???? |
+----+----------+----------+
10 rows in set

Query OK, 0 rows affected

?

?