This PL/SQL code block checks the evolution and pre-evolution of a Pokémon entered by its Pokédex number or name. It queries the Pokémon, evolution, and pre-evolution tables to get the names associated with the entered Pokédex number, then outputs a message describing its evolution and pre-evolution status.
This PL/SQL code block checks the evolution and pre-evolution of a Pokémon entered by its Pokédex number or name. It queries the Pokémon, evolution, and pre-evolution tables to get the names associated with the entered Pokédex number, then outputs a message describing its evolution and pre-evolution status.
This PL/SQL code block checks the evolution and pre-evolution of a Pokémon entered by its Pokédex number or name. It queries the Pokémon, evolution, and pre-evolution tables to get the names associated with the entered Pokédex number, then outputs a message describing its evolution and pre-evolution status.
This PL/SQL code block checks the evolution and pre-evolution of a Pokémon entered by its Pokédex number or name. It queries the Pokémon, evolution, and pre-evolution tables to get the names associated with the entered Pokédex number, then outputs a message describing its evolution and pre-evolution status.
/* EJERCICIO 4: SI LO QUEREIS COMPLETO AÑADIRLE LA COMPROBACION SI INSERTA UN NUMERO DE POKEDEX O UN NOMBRE */
set SERVEROUTPUT on;
declare nume number; prevo number; evo NUMbER; exist number; aux1 POK_POKEMON.NOMbRE%type; aux2 POK_POKEMON.NOMbRE%type; aux3 POK_POKEMON.NOMbRE%type; Begin nume:=&nume; select count(numero_pokedex) into exist from POK_POKEMON where numero_pokedex=nume; if exist>0 then select count(POKEMON_EVOLUCIONADO) into evo from POK_EVOLUCIONA_DE where POKEMON_ORIGEN=nume; select count(POKEMON_ORIGEN) into prevo from POK_EVOLUCIONA_DE where POKEMON_EVOLUCIONADO=nume; if evo>0 and prevo>0 then select NOMBRE into aux1 from POK_POKEMON p inner join POK_EVOLUCIONA_DE d on p.NUMERO_POKEDEX=d.POKEMON_ORIGEN where d.POKEMON_EVOLUCIONADO=nume; select NOMBRE into aux2 from POK_POKEMON p inner join POK_EVOLUCIONA_DE d on p.NUMERO_POKEDEX=d.POKEMON_EVOLUCIONADO where d.POKEMON_ORIGEN=nume; select NOMBRE into aux3 from POK_POKEMON where NUMERO_POKEDEX=nume; DBMS_OUTPUT.PUT_LINE ('El pokemon numero '||nume||' = '||aux3||' evoluciona de '||aux1||' y puede evolucionar a : '||aux2); elsif evo=0 and prevo>0 then select NOMBRE into aux1 from POK_POKEMON p inner join POK_EVOLUCIONA_DE d on p.NUMERO_POKEDEX=d.POKEMON_ORIGEN where d.POKEMON_EVOLUCIONADO=nume; select NOMBRE into aux3 from POK_POKEMON where NUMERO_POKEDEX=nume; DBMS_OUTPUT.PUT_LINE ('El pokemon numero '||nume||' = '||aux3||' evoluciona de '||aux1||' y no evoluciona '); elsif evo>0 and prevo=0 then select NOMBRE into aux1 from POK_POKEMON p inner join POK_EVOLUCIONA_DE d on p.NUMERO_POKEDEX=d.POKEMON_EVOLUCIONADO where d.POKEMON_ORIGEN=nume; select NOMBRE into aux3 from POK_POKEMON where NUMERO_POKEDEX=nume; DBMS_OUTPUT.PUT_LINE ('El pokemon numero '||nume||' = '||aux3||' no tiene prevolucion y puede evolucionar a : '||aux1); else select NOMBRE into aux3 from POK_POKEMON where NUMERO_POKEDEX=nume; DBMS_OUTPUT.PUT_LINE ('El pokemon numero '||nume||' = '||aux3||' no tiene prevolucion ni evolucion'); end if; else DBMS_OUTPUT.PUT_LINE ('El pokemon numero '||nume||' no existe!'); end if; end; ```