各位大侠,在定义存储过程的时候,如何定义表变量,以及如何为表变量进行赋值,最好有例子,谢谢!
解决方案 »
- 字符串字段排序问题。。。
- 如何实现简单的列转化
- 在线等 数据导入问题
- 奉献全部可用分求以下主从表查询优化方案
- pl/sql 语句 关于日期的输入格式
- select ...into 如果select查询语句有多条记录,用select ...into 会不会报错呢?
- 动态sql 编译通过,但执行提示:‘无效列名’
- 打开数据库时提示:oracle initializition or shutdown in progress 导致不能打开数据库,怎么解决?急!!!!!!!!!!!
- oracle9i中DATE型数据的格式是什么样的?
- 用C#,ORACLE开发遇到的问题
- oracle的表空间数据容量问题
- 什么语句需要提交?
http://blog.csdn.net/inthirties/archive/2009/08/02/4400905.aspx
Eunpassnum out number, //变量定义
Eoversixty out number,
Eoversenventy out number,
Eovereighty out number,
Eoverninety out number,
punpassnum out number,
poversixty out number,
poversenventy out number,
povereighty out number,
poverninety out number,
munpassnum out number,
moversixty out number,
moversenventy out number,
movereighty out number,
moverninety out number,
bunpassnum out number,
boversixty out number,
boversenventy out number,
bovereighty out number,
boverninety out number)
as
HEnglish number;
Hplitics number;
Hmath number;
Hbasicmajor number;
cursor Firststu_cursor is
select English,plitics,math,basicmajor from 初试考生;
begin
Eunpassnum:=0;
Eoversixty:=0;
Eoversenventy:=0;
Eovereighty:=0;
Eoverninety:=0;
punpassnum:=0;
poversixty:=0;
poversenventy:=0;
povereighty:=0;
poverninety:=0;
munpassnum:=0;
moversixty:=0;
moversenventy:=0;
movereighty:=0;
moverninety:=0;
bunpassnum:=0;
boversixty:=0;
boversenventy:=0;
bovereighty:=0;
boverninety:=0;
open Firststu_cursor;
loop
fetch Firststu_cursor into HEnglish,Hplitics,Hmath,Hbasicmajor;
exit when Firststu_cursor%notfound;
if HEnglish<60 then
Eunpassnum:=Eunpassnum+1;
end if;
if HEnglish>60 then
Eoversixty:=Eoversixty+1;
end if;
if HEnglish>70 then
Eoversenventy:=Eoversenventy+1;
end if;
if HEnglish>80 then
Eovereighty:=Eovereighty+1;
end if;
if HEnglish>90 then
Eoverninety:=Eoverninety+1;
end if;
if Hplitics<60 then
punpassnum:=punpassnum+1;
end if;
if Hplitics>60 then
poversixty:=poversixty+1;
end if;
if Hplitics>70 then
poversenventy:=poversenventy+1;
end if;
if Hplitics>80 then
povereighty:=povereighty+1;
end if;
if Hplitics>90 then
poverninety:=poverninety+1;
end if;
if Hmath<60 then
munpassnum:=munpassnum+1;
end if;
if Hmath>60 then
moversixty:=moversixty+1;
end if;
if Hmath>70 then
moversenventy:=moversenventy+1;
end if;
if Hmath>80 then
movereighty:=movereighty+1;
end if;
if Hmath>90 then
moverninety:=moverninety+1;
end if;
if Hbasicmajor<60 then
bunpassnum:=bunpassnum+1;
end if;
if Hbasicmajor>60 then
boversixty:=boversixty+1;
end if;
if Hbasicmajor>70 then
boversenventy:=boversenventy+1;
end if;
if Hbasicmajor>80 then
bovereighty:=bovereighty+1;
end if;
if Hbasicmajor>90 then
moverninety:=moverninety+1;
end if;
end loop;
close Firststu_cursor;
end scorestage;