--1存储过程基本语句①
connect to StudentTest;
select * from tbl_classinfo
--创建存储过程
create procedure proc_demo()
begin
<wbr>declare v_i int default 10;<br><wbr>declare v_classname varchar(20);<br><wbr>set v_classname='德语';<br><wbr>insert into tbl_classinfo values('007',v_classname);<br>
end@</wbr></wbr></wbr></wbr>
--执行存储过程
call proc_demo
--删除存储过程
drop procedure proc_demo
<wbr></wbr>
--2存储过程基本语句②
connect to bookshop
select * from tbl_publisher
--创建存储过程
create procedure proc_publisher()
begin
<wbr>declare v_pubid num(10);<br><wbr>declare v_name varchar(23);<br><wbr>declare v_contact varchar(15);<br><wbr>declare v_phone varchar(12);<br><wbr>set v_pubid=100;<br><wbr>set v_name='徐越出版社';<br><wbr>set v_contact='111';<br><wbr>set v_phone='111';<br><wbr>insert into tbl_publisher values(v_pubid,v_name,v_contact,v_phone);<br>
end@</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
--执行存储过程
call proc_publisher()
--删除存储过程
drop procedure proc_publisher;
<wbr></wbr>
--3输入参数
connect to StudentTest;
select * from tbl_classinfo;
select * from tbl_result;
create table tbl_result
(
<wbr>result varchar(100)<br>
)</wbr>
--创建存储过程
create procedure pro_classinfo(in v_classno character(2), in v_classname varchar(10))
begin
<wbr>insert into tbl_classinfo values(v_classno,v_classname);<br>
end@</wbr>
create procedure pro_modifyByclassno(in v_classno character(2))
begin
<wbr>for classfor as select classname from tbl_classinfo where classno=v_classno<br><wbr>do<br><wbr><wbr>insert into tbl_result values(classfor.classname);<br><wbr>end for;<br>
end@</wbr></wbr></wbr></wbr></wbr>
--执行存储过程
call pro_classinfo('10','体育')
call pro_modifyByclassno('10');
--删除存储过程
drop procedure pro_classinfo
drop procedure pro_modifyByclassno
<wbr></wbr>
--4输出参数
select * from tbl_result;
create table tbl_result
(
<wbr>result varchar(100)<br>
)</wbr>
create procedure proc_out(out v_classname varchar(10),in v_classno character(2))
begin
<wbr>for classfor as select classname from tbl_classinfo where classno=v_classno<br><wbr>do<br><wbr><wbr>set v_classname = classfor.classname;<br><wbr>end for;<br>
end@</wbr></wbr></wbr></wbr></wbr>
用另一个存储过程使用输出参数
create procedure pro_test()
begin
<wbr>declare v_classname varchar(10);<br><wbr>call proc_out(v_classname,'10');<br><wbr>insert into tbl_result values(v_classname);<br>
end@</wbr></wbr></wbr>
call pro_test();
分享到:
相关推荐
"用友U8自定义报表使用存储过程时,使用系统的分组和小计、累计、合计" 用友U8自定义报表使用存储过程时,使用系统的分组和小计、累计、合计是指在用友U8自定义报表中使用存储过程来生成报表,同时利用系统的分组和...
在hibernate中使用存储过程,调用存储过程
一点简单的用户添加,使用存储过程例子,仅供学习参考 一点简单的用户添加,使用存储过程例子,仅供学习参考
在java中使用存储过程,如何进行数据库连接,语法简析
PL/SQL使用存储过程实现导出指定数据到文件(仿EXP).
.NET使用存储过程实现对数据库的增删改查 .NET使用存储过程实现对数据库的增删改查
Visual C++源代码 130 如何使用存储过程查询时间段数据Visual C++源代码 130 如何使用存储过程查询时间段数据Visual C++源代码 130 如何使用存储过程查询时间段数据Visual C++源代码 130 如何使用存储过程查询时间段...
C#完美分页 效率很不错的分页 不使用存储过程也能达到快速分页的效果
使用存储过程,在NET 环境中如何使用存储过程
使用存储过程备份数据库 c# asp.net
86X自定义报表中如何使用存储过程.rar
讲述SQL使用存储过程导入和导出Excel,比较经典哦
C#使用存储过程录入数据
Mysql使用存储过程快速添加百万数据
本程序,主要使用存储过程,实现转帐,查询,修改密码等一系统功能..内附数据库
这个文档是一个告诉大家如何使用存储过程的实例文档,有助于帮助大家学习ORACLE 存储过程!
delphi增删改查使用存储过程小模块, 右下角 还有关于Delphi,SQL,C#的资料
用户登陆窗口(使用ASP.NET2.0[C#]实现),使用存储过程实现和必须输入验证码才能登陆,文件里有代码、数据库设计图、文本说明、WEB.CONFIG,对初学者的帮助应该很大。
本文很详细地介绍了如何使用存储过程来创建数据源。
"实验八 存储过程的使用(学生)" 本实验的目的是让学生掌握创建存储过程的基本方法,并学会使用 Transact-SQL 编写存储过程的方法。实验中,学生需要创建多个存储过程来完成不同的数据库操作,例如检索学生基本...