标签:style 更新 code birt otf else when set sel
隐式游标
sql游标
insert
delete
update
select(返回单行记录的查询)
引用游标类型
type stucursor is ref cursor;
程序包和程序包体
create or replace package pname as
procedure p1(b in varchar2);
function f1(a in number);
end pname;
create or replace package body pbname as
procedure p1(b varchar2) as
begin
dbms_output.put_line(123);
end;
end pbname;
隐式游标:
Declare
Begin
/*
insert
update
delete
select(返回单行的查询)
*/
Update student s Set s.sbirthday = s.sbirthday + 3650 Where s.class=95031;
If Sql%Found Then
dbms_output.put_line(‘数据更新成功!‘);
--修改的行数
dbms_output.put_line(Sql%Rowcount);
Commit;
Else
dbms_output.put_line(‘更新失败!‘);
End If;
End;
构建程序包:
--构建程序包
Create Or Replace Package stuinfo As
Type stucur Is Ref Cursor;
--存储过程
Procedure showname(scla In Number,stus Out stucur);
End stuinfo;
--构建程序包体
Create Or Replace Package Body stuinfo As
Procedure showname (scla In Number,stus Out stucur)As
Begin
Open stus For Select * From student s Where s.class=scla;
End;
End stuinfo;
调用程序包
--调用程序包存储过程
Declare
i Integer;
--引用游标
Type stuc Is Ref Cursor;
sts stuc;
stu student%Rowtype;
Begin
stuinfo.showname(95033,sts);
Loop
Fetch sts Into stu ;
Exit When sts%Notfound;
dbms_output.put_line(stu.sname);
End Loop;
End;
标签:style 更新 code birt otf else when set sel
原文地址:http://www.cnblogs.com/jgjk/p/7388900.html