08-modpr.sql

来自「《Oracle8i PL/SQL程序设计》附源码」· SQL 代码 · 共 50 行

SQL
50
字号
REM 08-MODPR.SQL
REM This file contains the modular programming examples from 
REM Chapter 8 of "Oracle PL/SQL Programming".

REM This is version 1.0 of this file, updated 2/18/96.
REM Comments and questions should go to Scott Urman, at
REM surman@us.oracle.com.


REM *** Chapter 8: CalculateGPA stub ***
CREATE OR REPLACE PROCEDURE CalculateGPA(
  /* Returns the grade point average for the student identified
     by p_StudentID in p_GPA. */
  p_StudentID IN students.ID%TYPE,
  p_GPA OUT NUMBER) AS
BEGIN
  NULL;
END CalculateGPA;
/

REM *** Chapter 8: PrintTranscript stub ***
CREATE OR REPLACE PROCEDURE PrintTranscript(
  /* Outputs a transcript for the indicated student. The 
     transcript will consist of the classes for which the
     student is currently registered and the grade received
     for each class. At the end of the transcript, the student's
     GPA is output. */
  p_StudentID IN students.ID%TYPE) AS

  v_StudentGPA  NUMBER;  -- Grade point average for this student.
  CURSOR CurrentClasses IS
    SELECT *
      FROM registered_students
      WHERE student_id = p_StudentID;
BEGIN
  -- Output some header information about the student such
  -- as first and last name, major, etc.

  FOR v_ClassesRecord IN CurrentClasses LOOP
    -- Output information about each class.
    NULL;
  END LOOP;

  -- Determine the GPA.
  CalculateGPA(p_StudentID, v_StudentGPA);

  -- Output the GPA.
END PrintTranscript;
/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?