2014-01-11 46 views
0

不知道我在做什麼錯在這裏:錯誤(20,5):PLS-00306:錯號碼或類型的調用參數「F_DREPTURI」

所以我有這樣的:

CREATE OR REPLACE PACKAGE pachet_drepturi IS 

    FUNCTION f_identif_furnizor (codcomandahrana_ comanda_hrana.codcomandahrana%TYPE) 
    RETURN furnizor.codfurnizor%TYPE ; 

    FUNCTION f_drepturi (codangajat_ numeric, 
         codfurnizor_ furnizor.codfurnizor%TYPE, 
         tip_drept CHAR) RETURN BOOLEAN ; 

END pachet_drepturi ; 
/
/*drop type tip_drepturi; 
create or replace type TIP_DREPTURI as object (
    CODANGAJAT TIP_ANGAJAT, 
    codfurnizor tip_furnizor, 
    DREPT_INSERARE CHAR(1), 
    DREPT_MODIFICARE CHAR(1), 
    DREPT_STERGERE CHAR(1), 
    member function GETCODANGAJAT return TIP_ANGAJAT , 
    member function GETCODFURNIZOR return TIP_FURNIZOR, 
    member function GETDREPT_INSERARE return CHAR , 
    member function GETDREPT_MODIFICARE return CHAR, 
    member function getDREPT_STERGERE return CHAR 
    )FINAL; 
     /
-------------------------------------------------------------------------------- 
create or replace TYPE BODY TIP_DREPTURI AS 
------------------------------------------- 
    MEMBER FUNCTION getCODANGAJAT RETURN TIP_ANGAJAT IS 
    BEGIN 
     RETURN SELF.CODANGAJAT ; 
    END getCODANGAJAT ; 
    ------------------------------------------- 
    MEMBER FUNCTION getcodfurnizor RETURN tip_furnizor IS 
    begin 
     RETURN SELF.codfurnizor ; 

    END getcodfurnizor ; 

    ----------------------------------------------------------------- 
     MEMBER FUNCTION getDREPT_INSERARE RETURN char IS 
    begin 
     RETURN SELF.DREPT_INSERARE ; 

    end GETDREPT_INSERARE ; 
    ------------------------------------------------------------------ 
    MEMBER FUNCTION getDREPT_MODIFICARE RETURN char IS 
    begin 
     RETURN SELF.DREPT_MODIFICARE ; 

    end GETDREPT_MODIFICARE ; 
    ------------------------------------------------------------------ 
    MEMBER FUNCTION getDREPT_STERGERE RETURN char IS 
    begin 
     RETURN SELF.DREPT_STERGERE ; 

    end GETDREPT_STERGERE ; 
    ------------------------------------------------------------------ 
end ;*/ 
--drop table drepturi; 
/*create table DREPTURI(
CODANGAJAT numeric (10) , 
CODFURNIZOR numeric(10), 
DREPT_INSERARE CHAR(1) default 'N' not null constraint CK_DREPT_INS check (DREPT_INSERARE in ('D','N')), 
DREPT_MODIFICARE CHAR(1) default 'N' not null constraint CK_DREPT_MOD check (DREPT_MODIFICARE in ('D','N')), 
drept_stergere char(1) default 'N' not null constraint ck_drept_del check (drept_stergere in ('D','N')), 
constraint pk_drepturi primary key (codangajat, codfurnizor) 
);*/ 


----------------------------------------------- 
CREATE OR REPLACE PACKAGE BODY pachet_drepturi IS 
-------------------------------------------------------------------------- 
FUNCTION f_identif_furnizor (codcomandahrana_ comanda_hrana.codcomandahrana%TYPE) 
RETURN furnizor.codfurnizor%TYPE 
is 
    V_CODFURNIZOR varchar2(5); 
    ref1 ref tip_furnizor; 
begin 
    select REF_FURNIZOR 
     into REF1 
     from COMANDA_HRANA 
    where CODCOMANDAHRANA=CODCOMANDAHRANA_ ; 
    RETURN v_codfurnizor ; 
END ; 

-------------------------------------------------------------------------- 
FUNCTION f_drepturi (codangajat_ numeric, 
        codfurnizor_ furnizor.codfurnizor%TYPE, 
       tip_drept CHAR) 
    RETURN BOOLEAN 
IS 
    v_sir CHAR(1) ; 
BEGIN 
    CASE 
     WHEN tip_drept = 'I' THEN  
     SELECT drept_inserare INTO v_sir FROM drepturi 
     WHERE codangajat = codangajat_ AND codfurnizor=codfurnizor_ ; 
     WHEN tip_drept = 'U' THEN  
     SELECT drept_modificare INTO v_sir FROM drepturi 
     WHERE codangajat = codangajat_ AND codfurnizor=codfurnizor_ ; 
     WHEN tip_drept = 'D' THEN  
     SELECT drept_stergere INTO v_sir FROM drepturi 
     WHERE codangajat = codangajat_ AND codfurnizor=codfurnizor_ ; 
    END CASE ; 
    RETURN CASE v_sir WHEN 'D' THEN TRUE ELSE FALSE END ; 
EXCEPTION 
    WHEN NO_DATA_FOUND THEN 
    RETURN FALSE ; 
END ; 
END pachet_drepturi ; 
--======================================================================== 
/

當我調用該函數在下面的觸發,我得到這個錯誤:

IF **pachet_drepturi.f_drepturi (USER, :NEW.ref_furnizor, 'I') THEN** 
     NULL ; 
    ELSE 
     RAISE_APPLICATION_ERROR (-20572, 'Nu aveti dreptul de a insera comenzi noi pentru acest furnizor !'); 
    END IF ; 
~~~~~~ 

Error(20,5): PLS-00306: wrong number or types of arguments in call to 'F_DREPTURI' 

~~~~~ 

一提的是我在ANGAJATI表codAngajat是VARCHAR2(5)。

你能解釋我做錯了什麼嗎?

回答

0

USER返回的數據類型是字符,而在你的函數中codangajat_是數字。

我希望你寫的觸發器的表中ref_furnizor的數據類型與codfurnizor_ furnizor.codfurnizor%TYPE類似,如果不是,那麼你也需要改變它。

+0

用以下代碼替換codangajat_:varchar2。另外,試圖用angajati.codangajat%TYPE替換,仍然是同樣的錯誤! – user3185322

+0

furnizor.codfurnizor和ref_furnizor的數據類型是什麼? – San

+0

furnizor.codfurnizor - varchar2,ref_furnizor - varchar2 – user3185322

相關問題