Skip to 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
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Oracle Database 12c PL/SQL Advanced Programming Techniques

Oracle Database 12c PL/SQL Advanced Programming Techniques

Michael McLaughlin, John Harper

Publisher Resources

ISBN: 9781449324070Errata Page