Question is : I have to Create Function with below Details
Function Name : Credit_Limit
Input : Entity_Id (Shipment_entity)
Returns : VARCHAR2 (Limit_Status)
设计规则:
注意:请勿更改解决方案中的给定状态消息。
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;
/
我执行上面提到的代码函数已创建,但在提交代码后显示错误的答案。帮助。
答案 0 :(得分:2)
你想:
RETURN limit_status;
不
RETURN (c_credit_limit);
答案 1 :(得分:0)
下面的功能正常
创建或替换功能credit_limit(entity_id IN INTEGER) RETURN VARCHAR2 IS c_credit_limit shipment_entity.credit_limit%TYPE; limit_status VARCHAR(255); 开始 选择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 limit_status;
END;
/