-1
Hello!
I am developing a function that receives as a parameter the customer and the value and checks if the customer has credit limit to effect a sale, but when calling the function is not returning correctly the result.
CREATE OR REPLACE FUNCTION F_LIMITE_CREDITO(
P_NOME IN TB_CLIENTES.NOME%TYPE
)
RETURN NUMBER
IS
P_LIMITE NUMBER;
BEGIN
SELECT LIMITE INTO P_LIMITE
FROM TB_CLIENTES
WHERE NOME = P_NOME;
RETURN P_LIMITE;
END F_LIMITE_CREDITO;
/
DECLARE
C_NOME VARCHAR2 := TB_CLIENTES.NOME;
BEGIN
IF F_LIMITE_CREDITO (C_NOME) < 10 THEN
dbms_output.put_line("LIMITE INDISPONIVEL");
END IF;
END;
/
I would like your help because I’m starting in PL.
Does your select return any results? I think it would be interesting to search for the client ID instead of the name.
– Darlei Fernando Zillmer
Returns the column name and credit limit but with the value reset.
– rdevenz
The clients table has the columns
cliente_id, nome e limite
– rdevenz
Compared and Function result to select execution ?
– Motta