Oracle:存储过程的使用

  • 以sys身份登录,创建用户c##zs,密码111,分配dba角色

  • 以c##zs身份登录,导入数据表

  • 编写存储过程,根据学生学号,查询出学生所选课程成绩等级,

  • 打印结果示例:

    1801001 张三 Oracle A

    1801001 张三 Java C

参考代码:

create or replace procedure p_studentid(p_sid in char)
is
v_grade number;
begin
for student in(
select s.student_id,s.sname,c.cname,sc.grade
from student s, sc,course c
where s.student_id = sc.student_id and
sc.course_id = c.course_id and s.student_id = p_sid
)loop v_grade := student.grade;
if v_grade >= 90 then
dbms_output.put_line(student.student_id || student.sname || student.cname || 'A');
elsif v_grade >= 80 then
dbms_output.put_line(student.student_id || student.sname || student.cname || 'B');
elsif v_grade >= 70 then
dbms_output.put_line(student.student_id || student.sname || student.cname || 'c');
elsif v_grade >=60 then
dbms_output.put_line(student.student_id || student.sname || student.cname || 'D');
else
dbms_output.put_line(student.student_id || student.sname || student.cname || 'E');
end if; end loop;
end p_studentid; set serveroutput on
begin
p_studentid('1801001');
end;

Oracle:存储过程的使用的更多相关文章

  1. oracle 存储过程

    来自:http://www.jb51.net/article/31805.htm Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 I ...

  2. Oracle存储过程语法

    原文链接:http://www.jb51.net/article/31805.htm Oracle存储过程基本语法 存储过程  1 CREATE OR REPLACE PROCEDURE 存储过程名  ...

  3. ORACLE存储过程调用Web Service

    1. 概述 最近在ESB项目中,客户在各个系统之间的服务调用大多都是在oracle存储过程中进行的,本文就oracle存储过程调用web service来进行说明.其他主流数据库,比如mysql和sq ...

  4. Oracle存储过程基本语法介绍

    Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR RE ...

  5. MyBatis调用Oracle存储过程

    MyBatis调用Oracle存储过程 1.无输入和输出参数的存储过程 2.带有输入和输出参数的存储过程 3.返回游标的存储过程 mybatis中的配置文件代码 <resultMap type= ...

  6. Oracle存储过程(转)

    Oracle存储过程基本语法 存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR RE ...

  7. Oracle存储过程中异常Exception的捕捉和处理

    Oracle存储过程中异常的捕捉和处理 CREATE OR REPLACE Procedure Proc_error_process ( v_IN in Varchar2, v_OUT Out Var ...

  8. Oracle存储过程动态创建临时表/存储过程执行权限问题--AUTHID CURRENT_USER

    关于Oracle存储过程执行权限问题的解决 http://blog.sina.com.cn/s/blog_6ceed3280101hvlo.html (2014-04-02 04:06:28) 转载▼ ...

  9. ORACLE存储过程学习

    存储过程 1 CREATE OR REPLACE PROCEDURE 存储过程名 2 IS 3 BEGIN 4 NULL; 5 END; 行1: CREATE OR REPLACE PROCEDURE ...

  10. C# 获取 oracle 存储过程的 返回值1

    /// <summary> /// 返回对应表的模拟自增字段值 /// </summary> /// <param name="tablename"& ...

随机推荐

  1. shell Usage

    Usage(){ cat <<EOF Usage: $ [tenant] $ (Run database table check_table_data_config all tenants ...

  2. C# Brush Color String 互相转换

    using System.Windows.Media; //String转换成Color Color color = (Color)ColorConverter.ConvertFromString(s ...

  3. ORACLE内部操作

    当执行查询时,ORACLE采用了内部的操作. 下表显示了几种重要的内部操作. ORACLE Clause 内部操作 ORDER BY SORT ORDER BY UNION UNION-ALL MIN ...

  4. phpstorm IDEA 双击Shift键会弹出 SearchEverywhere 对话框,如何取消这个功能

    https://blog.csdn.net/qq_27598243/article/details/80526352 解决方法:一:Open lib/resources.jar/idea/Platfo ...

  5. Python的内置方法,abs,all,any,basestring,bin,bool,bytearray,callable,chr,cmp,complex,divmod

    Python的内置方法 abs(X):返回一个数的绝对值,X可以是一个整数,长整型,或者浮点数,如果X是一个复数,此方法返回此复数的绝对值(此复数与它的共轭复数的乘积的平方根) >>> ...

  6. ubuntu14.04本地域名服务器配置

    dnsmasq 1 修改dnsmasq配置文件/etc/dnsmasq.conf # Change this line if you want dns to get its upstream serv ...

  7. "?:"在正则表达式中什么意思

    “?:”非获取匹配,匹配冒号后的内容但不获取匹配结果,不进行存储供以后使用. 单独的“?”:匹配前面的子表达式零次或一次. 当“?”紧跟在任何一个其他限制符(*,+,?,{n},{n,},{n,m}) ...

  8. H3C 物理层

  9. 各种浏览器怎么换ip

    https://jingyan.baidu.com/article/e4d08ffdb784050fd2f60ddd.html 方法/步骤   1 用浏览器搜索ip,得到自己当前的ip. 2 用浏览器 ...

  10. H3C 配置NAPT