Difficulty in assigning valorer in plsql

1

In a college exercise the following was requested:

  

In a presidential election there are three candidates. Votes are   informed by code. The data used for scrutiny   following codification: 1, 2, 3 = votes for the respective   candidates; 4 = null vote; 5 = blank vote. Write a program   in Plsql that calculates and writes: The total of votes for each candidate;   The total of null votes; The total blank votes. As a finisher   of the set of votes, we have the value 0 (zero).

My response was as follows

declare
valorVoto number type:= &voto;
votosDeputado1 number:= 0;
votosDeputado2 number:= 0;
votosDeputado3 number:= 0;
votosNulos number;
votosBrancos number;

begin
if valorVoto = 1 then 
  votosDeputado2:=votosDeputado2 + 1;
end if;

if valorVoto = 2 then 
  votosDeputado2:=votosDeputado2 + 1;
end if;

if valorVoto = 3 then 
  votosDeputado3:=votosDeputado3 + 1;
end if;

if valorVoto = 4  then
  votosNulos := votosNulos+1;
end if;

if valorVoto = 5  then
  votosBrancos := votosbrancos+1;
end if;


  DBMS_OUTPUT.PUT_LINE ('O primeiro candidato teve ' || votosDeputado1);
  DBMS_OUTPUT.PUT_LINE ('O segundo candidato teve ' || votosDeputado2);
  DBMS_OUTPUT.PUT_LINE ('O terceiro candidato teve ' || votosDeputado3);

  DBMS_OUTPUT.PUT_LINE ('O total de votos nulos foi ' || votosNulos);
  DBMS_OUTPUT.PUT_LINE ('O total de votos em branco foi ' || votosBrancos);

end;

But the only output I have is the following

  

ORA-06550: line 2, column 18: PLS-00103: The symbol "TYPE"   when one of the following symbols was expected:

     

: =. (@%; not null track default character The "." symbol was   replaced with "TYPE" to continue.   06550. 00000 - "line% s, column% s: \ n% s"   * Cause: Usually a PL / SQL compilation error.   * Action:

Any help is welcome:)

    
asked by anonymous 16.04.2017 / 22:53

1 answer

1

Lucas, just remove the type , getting it as follows:

declare
valorVoto number := &voto;
votosDeputado1 number:= 0;
votosDeputado2 number:= 0;
...
    
17.04.2017 / 04:15