日期:2014-05-16 浏览次数:20324 次
Creat procedure 存储过程名(in 参数名 数据类型,out 参数名 数据类型) Language 语言 (sql,java,c,.net) Specific 标识名 Dynamic result sets 数量 Determitation//not Begin End
Connect to sample@ Create procedure pro( Put w char(20) ) Language sql Begin Declare f char(20); Set f=’welcome’; Set w=f; End@
Connect to sample@ drop table test@ create table test (id int ,name char (20))@ insert into test values(1,'张三')@ insert into test values (2,'李四')@ Create procedure view( In i int,out vname char(20) ) Language sql Begin // 游标方式 // Declare c1 cursor for Select name from test where id =i; Open c1; Fetch from c1 into vname; Close c1; // 普通方式 // declare temp char(20); For temp as select name from test where id=i do Set vname = temp.name End for; end@