String length in PL / SQL

0
 CREATE OR REPLACE FUNCTION TamanhoString(texto char(100))
 RETURN NUMBER IS tamanho NUMBER;
 BEGIN
    tamanho := LENGTH(texto);
    RETURN tamanho;
 END TamanhoString;

I need to create a function that receives text as a parameter and returns its size. The code is giving the following error:

Error: PLS-00103: Found the symbol "(" when one of the following symbols was expected:: =), default varying large character The symbol ":=" has been replaced by "     

asked by anonymous 18.10.2018 / 01:39

1 answer

1

There were some errors in the writing of your function, correcting remained:

CREATE OR REPLACE FUNCTION TamanhoString (texto IN CHAR)
RETURN NUMBER AS
    tamanho NUMBER;
    BEGIN
        tamanho := LENGTH(texto);
    RETURN tamanho;
END;
    
18.10.2018 / 01:49