Skip to Main Content
Oracle PL/SQL Programming: A Developer's Workbook
book

Oracle PL/SQL Programming: A Developer's Workbook

by Steven Feuerstein, Andrew Odewahn
May 2000
Intermediate to advanced content levelIntermediate to advanced
594 pages
11h 32m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Programming: A Developer's Workbook

Expert

22-19.

Write a package that manages communication through a private pipe named “invasions”. Each message in the pipe contains the information as specified by the following query:

SELECT country, date_of_invasion, people_killed
  FROM invasions
 WHERE (invader IN ('USA', 'CHINA', 'GERMANY', 'SOVIET UNION')
   AND date_of_invasion > '01-JAN-1900';

Features of this package should include the following:

  • The user never specifies or knows the name of the pipe; it is hidden to avoid any spelling mistakes and to ensure consistency.

  • It create the pipe automatically when a session tries to use the pipe.

  • The list is a long one (including, for example, Grenada, Poland, Nicaragua, Vietnam, Chile, France, Tibet, Norway, El Salvador, and Iraq), so set the initial pipe size to at least 2 MB.

  • It waits up to 10 seconds to get or send the information.

Here is the package specification; you write the body:


/* Filename on web page: invasions.pkg */
CREATE OR REPLACE PACKAGE invasion
IS
   TYPE inv_rectype IS RECORD (
      country IN invasions.country%TYPE,
      date_of_invasion invasions.date_of_invasion%TYPE,
      people_killed invasions.people_killed%TYPE
      );

   PROCEDURE sendinfo (
      country IN VARCHAR2,
      date_of_invasion DATE,
      people_killed NUMBER
      );

   PROCEDURE sendinfo (rec IN inv_rectype);

   FUNCTION nextinfo RETURN inv_rectype;
END;
/

22-20.

How can you can obtain a list of all the currently defined database pipes to which you have ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 12c PL/SQL Programming

Oracle Database 12c PL/SQL Programming

Michael McLaughlin
Oracle PL/SQL for DBAs

Oracle PL/SQL for DBAs

Arup Nanda, Steven Feuerstein
Oracle PL/SQL For Dummies

Oracle PL/SQL For Dummies

Michael Rosenblum, Paul Dorsey

Publisher Resources

ISBN: 9781449324070Supplemental ContentErrata Page