08-crdlp.sql
来自「《Oracle8i PL/SQL程序设计》附源码」· SQL 代码 · 共 31 行
SQL
31 行
REM 08-CRDLP.SQL
REM This file contains the first version of the CreditLoop
REM procedure, from Chapter 8 of "Oracle PL/SQL Programming".
REM This is the version with the error.
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.
CREATE OR REPLACE PROCEDURE CreditLoop AS
/* Inserts the student ID numbers and their current credit
values into temp_table. */
v_StudentID students.ID%TYPE;
v_Credits students.current_credits%TYPE;
CURSOR c_Students IS
SELECT ID
FROM students;
BEGIN
OPEN c_Students;
LOOP
FETCH c_Students INTO v_StudentID;
v_Credits := CountCredits(v_StudentID);
INSERT INTO temp_table (num_col, char_col)
VALUES (v_StudentID, 'Credits = ' || TO_CHAR(v_Credits));
EXIT WHEN c_Students%NOTFOUND;
END LOOP;
CLOSE c_Students;
END CreditLoop;
/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?