Language:EN
Pages: 2
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
bypassed the business rule and applied daily fine

Bypassed the business rule and applied daily fine publishing the daily fine variable

Term Fly Presents http://www.flyheart.com

program run from a session with EXECUTE authority on the package. This is always a bad idea and should be avoided.

FUNCTION days_overdue (isbn_in IN book.isbn%TYPE) RETURN INTEGER;

-- Relies on g_daily_fine for calculation FUNCTION fine (isbn_in IN book.isbn%TYPE) RETURN INTEGER;
END overdue_pkg;

The following rewrite of overdue_ pkg fixes the problem; for the sake of the trees, I show only the replacement of the g_daily_fine variable with its "get and set" programs:

CREATE OR REPLACE PACKAGE overdue_pkg
IS
PROCEDURE set_daily_fine (fine_in IN NUMBER); PROCEDURE daily_fine RETURN NUMBER;

FUNCTION daily_fine
RETURN NUMBER
IS
BEGIN
RETURN g_daily_fine;
END;

Now it's impossible to bypass the business rule for the daily fine.

By hiding the data structure, you give yourself the freedom to change how that data is defined without affecting all accesses to the data.

Package data can now be accessed from Oracle Developer tools, such as
Formsbuilder. You may not, from "client-side" PL/SQL (i.e., code written in Oracle Developer components) reference stored package elements unless they are procedures or functions.

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : Jiya Manne

PageId: ELICD0F26A