📄 08-crdlp.sql
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -