The code listed below creates a package with only a specification
but your code shows that you are creating a package BODY
CREATE OR REPLACE PACKAGE
BODY TAXRATE_PKG IS -- your code doesnt follow what you are trying to do
PROCEDURE state_tax_pf(
p_state IN VARCHAR2,
pv_tax_nc OUT NUMBER,
pv_tax_tx OUT NUMBER,
pv_tax_tn OUT NUMBER)
IS
lv_state NUMBER;
BEGIN
IF p_state = 'NC' THEN
pv_tax_nc := 0.35;
ELSIF p_state = 'TX' THEN
Pv_tax_tx := 0.05;
ELSIF p_state = 'TN' THEN
pv_tax_tn := 0.02;
END IF;
RETURN lv_state;
END;
END;
A PACKAGE SPECIFICATION
contains only the first line of your PROCEDURES/FUNCTIONS,
It starts with CREATE OR REPLACE PACKAGE and doesnt include the word "BODY" since its the specification and not the BODY of the package.
While a PACKAGE BODY
contains the BODY of the procedures/functions starting from the word "PROCEDURE" up to the END statement of the procedure.
If you want to create a package with only specification. You should write it like this:
CREATE OR REPLACE PACKAGE
TAXRATE_PKG IS
PROCEDURE state_tax_pf(
p_state IN VARCHAR2,
pv_tax_nc OUT NUMBER,
pv_tax_tx OUT NUMBER,
pv_tax_tn OUT NUMBER) ;
END TAXRATE_PKG;
Just to warn you, you have a procedure inside but you are returning a value.This will return an error. You should make sure that the codes you are inserting in a package works to avoid having too many errors.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…