Error compiling function in oracle

Asked

Viewed 319 times

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;

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

1 answer

1

In Oracle functions, it is not necessary to specify the column size in the input parameter, so the declaration of your function would look like this:

CREATE OR REPLACE FUNCTION f_id_fornecedor(nomefornecedor IN VARCHAR)
...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.