存储过程程序编写总结

夜里快一点了,听着爱情转移,做出下列正对ORACLE数据储存程序总结:

一使用步骤:

1 Delare --------------定义变量

2 begin

exception---------------异常处理句断

end; ---------------执行程序体

给出一个实例吧:

declare

maxrecords constant int:=100;

i:=1;

begin

for i in 1..maxrecords loop

insert into yuxin.testtable(recordnumber,currentdate) value( i,sysdate);

end loop;

dbmp_output.put_line("欢迎使用余新专栏项目实例");

end;

这样,就能插出100条记录

二属性定义记录类型:

格式:

Declare

mydate yuxin.testtable.currentdate% type;

begin

end;

三结构化记录类型:

declare

type myrecord is record(

myrecordnumber int,

mycurrentdate date

);

srrecord myrecord;

begin

select * into srrecord form yuxin.testtable where recordnumber=68;

dbms_output.put_line(srrecord.mycurrentdate);

end;

四:利用行格式记录类型:

declare

mytable yuxin.testtable%rowtype;

begin

select * into mytable form yuxin.testtable where recordnumber=88;

dbms_output.put_line(mytable.currenttable);

end;

五 使用一维表类型变量

Delcare

type tabletype1 is table of varchar2(4) index by binary_integer;

type tabletype2 is table of yuxin.testtable.recordnumber%type index by binary_integer;

table1 tabletype1;

table2 tabletype2;

begin

table1(1)="欢迎进入";

table1(2)="希望有所收获";

table2(1)="余新";

table2(2)="专栏";

dbms_output.put_line(table1||table2(1)||table1(2)||table1(2));

end;

就先写到这里了,因为爱情转移已经唱完了,我先去米个好听的.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值