<!doctype html>
Oracle
是存储在数据库里的
xxxxxxxxxx10 1
declare2
cursor name is select......3
begin4
open name;5
loop6
fetch name into ....7
exit when name%notfound;8
end loop;9
close name;10
end;
xxxxxxxxxx11 1
declare2
cursor name is ...3
begin4
open name;5
fetch name into ....6
while name%found loop7
...8
fetch name into ......;9
end loop;10
close loop;11
end;
%found:判断最近一次使用fetch语句是否从缓存中检索导数据,如果检索到数据,返回true,否则返回false;(经常与while连用)
%notfound:判断最近一次使用fetch语句是否从缓存中检索导数据,如果没有检索到数据,返回true,否则返回false;(经常与when连用)
xxxxxxxxxx10 1
create or replace procedure lisi(2
id student.studentId%type,3
na student.name%type)4
as5
begin6
update student set studentId=id, name=na where studentId=id;7
exception8
when others then9
DBMS_OUTPUT.PUT('无法修改');10
end;
xxxxxxxxxx8 1
create or replace function jindao2
return number3
as4
c number;5
begin6
select COUNT(*) into c from student where name='金导';7
return c;8
end jindao;
xxxxxxxxxx5 1
create or replace package pkg2
as3
procedure hello;4
FUNCTION getid(id number) return number;5
end pkg;
xxxxxxxxxx13 1
create or replace package body pkg2
as3
procedure hello4
as5
begin6
dbms_output.put_line('hello');7
end hello;8
FUNCTION getid(id number) return number9
as10
begin11
return id;12
end getid;13
end pkg;
xxxxxxxxxx7 1
declare2
c number;3
begin4
pkg.hello;5
c:=pkg.getid(1);6
DBMS_OUTPUT.put_line(c);7
end;
xxxxxxxxxx5 1
create or replace trigger jindaogrant2
after update or delete on student3
begin4
DBMS_OUTPUT.put_line('触发器发现你了');5
end;