0
I’m making a bookstore in APEX and I can’t allow the client to rent more than 3 books. But even putting the code the program does not bar.
declare
W_QUANTIDADE_EMPRESTIMOS number;
W_STATUS LIVROS.IND_STATUS%TYPE;
begin
SELECT COUNT(EL.COD_EMPRESTIMO), L.IND_STATUS
into W_QUANTIDADE_EMPRESTIMOS, W_STATUS
FROM EMPRESTIMO_LIVRO EL
,LIVROS L
WHERE NM_USUARIO_LOC = :P16_NM_USUARIO_LOC;
IF W_QUANTIDADE_EMPRESTIMOS > 3 AND W_STATUS = 'P' THEN
raise_application_error( -20001, 'Você já possui muitos livros alugados!');
end if;
end;
Johnny, have you checked what your query is putting in the variables? What else is this W_STATUS?
– Eduardo Bissi
Block runs ? Seems to be missing a "group by" in sql.
– Motta