Error compiling function in oracle

1

When trying to compile the following function:

CREATE OR REPLACE FUNCTION f_id_fornecedor(Nomefornecedor in varchar(50)) 
RETURN integer  IS
codigoforncedor integer;
BEGIN   
SELECT codfornecedor INTO codigofornecedor FROM TBFORNECEDOR WHERE NOFORNECEDOR=Nomefornecedor;
IF codigofornecedor <> NULL THEN
RETURN codigofornecedor;
ELSE Raise_Application_Error(-20004,
                             'Fornecedor não existe: ' || nomefornecedor);

END IF;      
END;

I get the following error:

  

PLS-00103: Encountered the symbol "(" when expecting one of the   following:

     

: =. ), @% default character The symbol ":=" was substituted for   "(" to continue.

     

Compile error at line 1, column 53 PLS-00103: Encountered the symbol   "end-of-file" when expecting one of the following:

     

; The symbol ";" was substituted for "end-of-file" to continue.

     

Compile error at line 12, column 21

    
asked by anonymous 02.05.2017 / 21:24

1 answer

1

In Oracle functions, you do not need to specify the size of the column in the input parameter, so the declaration of your function would look like this:

CREATE OR REPLACE FUNCTION f_id_fornecedor(nomefornecedor IN VARCHAR)
...
    
02.05.2017 / 22:52