存储过程程序编写总结
2007-05-18 00:55
330 查看
夜里快一点了,听着爱情转移,做出下列正对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;
就先写到这里了,因为爱情转移已经唱完了,我先去米个好听的.
一使用步骤:
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;
就先写到这里了,因为爱情转移已经唱完了,我先去米个好听的.
相关文章推荐
- 为什么使用plsql编写存储过程会提高程序的性能?
- 转载:TonyBaoBao:在.NET中调用Oracle9i存储过程经验总结
- ASP.NET结合存储过程写的通用搜索分页程序
- 解决存储过程执行快,但程序调用则执行慢的问题
- sqlserver总结-视图及存储过程
- 通用存储过程的编写
- 使用游标编写的存储过程进行分页
- db2 存储过程动态游标及函数返回值总结
- ABAP程序编写过程中怎么提高程序执行效率八
- mysql 5.0存储过程学习总结
- 如何调用 Oracle 存储过程在 Visual Basic.NET 使用 Microsoft Oracle 托管提供程序
- SQL Server存储过程的编写和优化措施
- 存储过程的编写
- 在.NET中调用Oracle9i存储过程经验总结
- 编写第一个XML-RPC程序遇到的问题总结
- 【Linux】使用vim编写一个程序,gcc查看预处理、编译、汇编、链接过程
- 编写程序读入一组string类型的数据,并将它们存储在vector中,再将vector对象复制给一个字符指针数组。
- 存储过程编写经验和优化措施
- 从.net 程序中传递table 参数个存储过程
- 使用matlab编写程序的一些总结