Eduardo Acuña
Eduardo Acuña

Reputation: 71

error executing a script in oracle

i am trying create a boolean function in oracle. But i get the following error:

Line: 3 Column: 20
Error: PLS-00103: Encountered the symbol "("

This is the code i want execute:

        CREATE OR REPLACE Function ART.prueba
        (                             
        p_cuser  in varchar(20)
        ) return boolean is

            l_mstat swt500.m_stat%type := null;
            l_factu  swt500.f_actu%type  := null;
        Begin
            Select m_stat , f_actu             
               into l_mstat, l_factu
             from swt500
           where  c_empr = 59
              and  c_user  = p_cuser
              and  c_codi = 401
              and  t_codi = 'PR';                           
        return true;

        End;
        /

Can somebody help me?

Upvotes: 1

Views: 33

Answers (1)

Jair Hernandez
Jair Hernandez

Reputation: 494

Varchar and varchar2 as a parameter don't need to specify the size, lose the "(20)" in the parameter.

CREATE OR REPLACE Function ART.prueba
        (                             
        p_cuser  in varchar
        ) return boolean is

            l_mstat swt500.m_stat%type := null;
            l_factu  swt500.f_actu%type  := null;
        Begin
            Select m_stat , f_actu             
               into l_mstat, l_factu
             from swt500
           where  c_empr = 59
              and  c_user  = p_cuser
              and  c_codi = 401
              and  t_codi = 'PR';                           
        return true;

        End;
        /

Upvotes: 2

Related Questions