pkgcur.sql

来自「OReilly Oracle PL SQL Programming第4版源代码」· SQL 代码 · 共 54 行

SQL
54
字号
/* Formatted on 2002/03/05 14:07 (Formatter Plus v4.6.0) */
CREATE OR REPLACE PACKAGE book_info
IS
   CURSOR byauthor_cur (
      author_in   IN   books.author%TYPE
   )
   IS
      SELECT *
        FROM books
       WHERE author = author_in;

   CURSOR bytitle_cur (
      title_filter_in   IN   books.title%TYPE
   ) RETURN books%ROWTYPE;

   TYPE author_summary_rt IS RECORD (
      author                        books.author%TYPE,
      total_page_count              PLS_INTEGER,
      total_book_count              PLS_INTEGER);

   CURSOR summary_cur (
      author_in   IN   books.author%TYPE
   ) RETURN author_summary_rt;
END book_info;
/
CREATE OR REPLACE PACKAGE BODY book_info
IS
   CURSOR bytitle_cur (
      title_filter_in   IN   books.title%TYPE
   ) RETURN books%ROWTYPE
   IS
      SELECT *
        FROM books
       WHERE title LIKE UPPER (title_filter_in);

   CURSOR summary_cur (
      author_in   IN   books.author%TYPE
   ) RETURN author_summary_rt
   IS
      SELECT author, SUM (page_count), COUNT (*)
        FROM books
       WHERE author = author_in;
END book_info;
/



/*======================================================================
| Supplement to the third edition of Oracle PL/SQL Programming by Steven
| Feuerstein with Bill Pribyl, Copyright (c) 1997-2002 O'Reilly &
| Associates, Inc. To submit corrections or find more code samples visit
| http://www.oreilly.com/catalog/oraclep3/
*/

⌨️ 快捷键说明

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