select.sql
来自「Oracle 9i PL/SQL程序设计的随书源码」· SQL 代码 · 共 30 行
SQL
30 行
REM select.sql
REM Chapter 4, Oracle9i PL/SQL Programming by Scott Urman
REM This block contains examples of 2 SELECT statements.
DECLARE
v_StudentRecord students%ROWTYPE;
v_Department classes.department%TYPE;
v_Course classes.course%TYPE;
BEGIN
-- Retrieve one record from the students table, and store it
-- in v_StudentRecord. Note that the WHERE clause will only
-- match one row in the table.
-- Note also that the query is returning all of the fields in
-- the students table (since we are selecting *). Thus the
-- record into which we fetch is defined as students%ROWTYPE.
SELECT *
INTO v_StudentRecord
FROM students
WHERE id = 10000;
-- Retrieve two fields from the classes table, and store them
-- in v_Department and v_Course. Again, the WHERE clause will
-- only match one row in the table.
SELECT department, course
INTO v_Department, v_Course
FROM classes
WHERE room_id = 20003;
END;
/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?