0

I'm trying to do a very simple thing: extract a date and do some controls on it.
Everything's fine but when I try to compile this error pops out and I really don't have a clue about how to solve it...
This is the code:

    function get_crediti_formativi_biennio(p_userid          varchar2,
                                         p_prof_abil       varchar2,
                                         p_id_persona      number,
                                         p_tipo_formazione number,
                                         p_anno_formazione varchar2,
                                         p_flag_calcolo    number,
                                         p_crediti_totali  out number)
    return varchar2 is
    v_count        number;
    v_anno         varchar2;
    v_biennio_from number;
    v_biennio_to   number;

    l_err_msg varchar2(1024) := '+OK0000 Operazione effettuata con successo';

  begin
    v_count := null;

    begin
      select TO_CHAR(ap.valore)
        into v_anno
        from intc_attr_persone ap
       where ap.id_attributo = 202
         and ap.id = p_id_persona;
    exception
      when no_data_found then
        v_anno := '';
    end;

    if v_anno >= 2015 and (mod(v_anno, 2) != 0) then
      if (mod(p_anno_formazione, 2) = 0) then
        v_biennio_from := p_anno_formazione;
        v_biennio_to   := p_anno_formazione + 1;
      else
        v_biennio_from := p_anno_formazione - 1;
        v_biennio_to   := p_anno_formazione;
      end if;
    else
      if v_anno < 2015 or v_anno = '' or v_anno is null then
        if (mod(p_anno_formazione, 2) = 0) then
          v_biennio_from := p_anno_formazione - 1;
          v_biennio_to   := p_anno_formazione;
        else
          v_biennio_from := p_anno_formazione;
          v_biennio_to   := p_anno_formazione + 1;
        end if;
      end if;
    end if;

The problem is on v_anno.....

Leon
  • 665
  • 4
  • 10
  • 32
  • 3
    `varchar2` as a parameter can´t have a length as `p_prof_abil varchar2` , while in the variable definition it **needs** a length definition as `v_anno varchar2(10)` for example. – SomeJavaGuy Oct 04 '16 at 09:46
  • ......the level of stupidity in me is above average..... if you write it as an answer I'll accept it ;) – Leon Oct 04 '16 at 09:52

0 Answers0