I want to try to make a script that the user has 3 attempts to enter your login and password. And I have to do this with repeating lace or a: While.
But I am having difficulty asking the user after it entered wrong with two more chances. And the script I did only do one, the purpose of this script, is to create a simple script with while based on my database.
Below is the script:
create table Administrador(
ID_Administrador number(4) primary key not null,
Nome_Administrador varchar(30),
Email_Administrador varchar(100),
Senha_Admin varchar(16) not null);
INSERT INTO Administrador VALUES (1,'Felipe Silva','felipe@xama.com','felipe123');
DECLARE
v_idadmin administrador.id_administrador%TYPE:=1;
v_senha administrador.senha_admin%TYPE;
a number (2):=1;
BEGIN
SELECT ID_Administrador,Senha_Admin
INTO v_idadmin,v_senha
FROM Administrador;
IF v_idadmin = :P_ID and v_senha = :P_SENHA THEN
dbms_output.put_line ('Seja bem vindo');
ELSE
WHILE a = 1
LOOP
FOR i in i <3
LOOP
dbms_output.put_line ('Senha do usuário não confere');
END LOOP;
a := a+1;
dbms_output.put_line ('entre em contado com o Administrador do Sistema ');
END LOOP;
END IF;
END;