Question is : I have to Create Function with below Details
Function Name : Credit_Limit
Input : Entity_Id (Shipment_entity)
Returns : VARCHAR2 (Limit_Status)
Design rules:
- If the credit_limit of the given entity id is greater then 50000,then display the limit_status as 'Credit limit is greater than 50000'
- If the credit_limit of the given entity id is less then 50000,then display the limit_status as 'Credit limit is less than 50000'
Note: DO NOT CHANGE the given status message in your solution.
CREATE OR REPLACE FUNCTION credit_limit (entity_id IN INTEGER)
RETURN VARCHAR2
IS
c_credit_limit NUMBER (5, 2);
limit_status VARCHAR (255);
BEGIN
SELECT credit_limit
INTO c_credit_limit
FROM shipment_entity
WHERE id = entity_id;
IF c_credit_limit > 50000
THEN
limit_status := 'Credit limit is greater than 50000';
ELSE
IF c_credit_limit < 50000
THEN
limit_status := 'Credit limit is less than 50000';
END IF;
END IF;
RETURN (c_credit_limit);
END;
/
I executed the above mentioned code the function is created but it shows wrong answer after submit the code. help on this.
number(5, 2)will allow numbers up to999.99...c_credit_limit shipment_entity.credit_limit%TYPE;instead ofc_credit_limit NUMBER (5, 2);