The Brewbeans\' lead programmer has noticed that only a few states require Inter
ID: 3912175 • Letter: T
Question
The Brewbeans' lead programmer has noticed that only a few states require Internet sales tax, and the rates do not change often. Create a package named TAX_RATE_PKG to hold the following tax rates in packaged variables for reference: pv_tax_nc = .035, pv_tax_tx =.05, and pv_tax_tn = .02. Code the variables to prevent the rates from being modified. Use an anonymous block with DBMS_OUTPUT statements to display the value of each packaged variable. Create the package with the procedures to retrieve shopper information.
Explanation / Answer
--The Tax_parameters table holds the default values for Tax parameters
create_Tax_parameters_tab.sql
CREATE TABLE Tax_parameters (
pv_tax_nc NUMERIC(10,5) NOT NULL,
pv_tax_tx NUMERIC(10,5)NOT NULL,
pv_tax_tn NUMERIC(10,5) NOT NULL
);
INSERT INTO Tax_parameters VALUES (.035, 005, 0.02);
COMMIT;
TAX_RATE_PKG.sql
CREATE OR REPLACE PACKAGE TAX_RATE_PKG AS
pv_tax_nc Tax_parameters.pv_tax_nc%TYPE;
pv_tax_tx Tax_parameters.pv_tax_tx%TYPE;
pv_tax_tn Tax_parameters.pv_tax_tn%TYPE;
PROCEDURE initialize AS
BEGIN
SELECT pv_tax_nc,
pv_tax_tx,
pv_tax_tn
INTO pv_tax_nc,
pv_tax_tx,
pv_tax_tn
FROM Tax_parameters;
BEGIN
DBMS_OUTPUT.PUT_LINE('pv_tax_nc is ' || pv_tax_nc);
DBMS_OUTPUT.PUT_LINE('pv_tax_tx is ' || pv_tax_tx);
DBMS_OUTPUT.PUT_LINE('pv_tax_tn is ' || pv_tax_tn);
END
END initialize;
END TAX_RATE_PKG;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.