Вы находитесь на странице: 1из 5

FUNCTION Get_numeric_attribute_value(

p_list_line_id IN NUMBER,
p_list_line_no IN VARCHAR2,
p_order_header_id IN NUMBER,
p_order_line_id IN NUMBER,
p_price_effective_date IN DATE,
p_req_line_attrs_tbl IN ACCUM_REQ_LINE_ATTRS_TBL,
p_accum_rec IN ACCUM_RECORD_TYPE
) RETURN NUMBER
IS
v_cust_class VARCHAR2(240);
v_order_type VARCHAR2(240);
v_req accum_req_line_attrs_rec;
i NUMBER;
accum_value NUMBER
BEGIN
-- this loop extracts the customer class and the order type that is
-- passed on the request line. We only use the
p_req_line_attrs_tbl
-- input parameter here.
i := p_req_line_attrs_tbl.FIRST;
WHILE I IS NOT NULL LOOP
v_req := p_req_line_attrs_tbl(i);
IF (v_req.context = 'CUSTOMER' AND
v_req.attribute = 'PRICING_ATTRIBUTE31')
THEN
v_cust_class := v_req.value;
ELSIF (v_req.context = 'ORDER' AND
v_req.attribute = 'PRICING_ATTRIBUTE40')
THEN
v_order_type := v_req.value;
END IF;
i := p_req_line_attrs_tbl.NEXT(i);
END LOOP;
-- supposing the customer class and order type are not null, now
-- query the user-defined table for the stored accumulation value
-- and return this value.
SELECT value
INTO accum_value
FROM accum_val_tbl
WHERE customer_class = v_cust_class
AND order_type = v_order_type;
RETURN accum_value;
END Get_numeric_attribute_value;


FUNCTION Get_numeric_attribute_value(
p_list_line_id IN NUMBER,
p_list_line_no IN VARCHAR2,
p_order_header_id IN NUMBER,
p_order_line_id IN NUMBER,
p_price_effective_date IN DATE,
p_req_line_attrs_tbl IN ACCUM_REQ_LINE_ATTRS_TBL,
p_accum_rec IN ACCUM_RECORD_TYPE
) RETURN NUMBER
IS
v_cust_class VARCHAR2(240);
v_order_type VARCHAR2(240);
v_req accum_req_line_attrs_rec;
i NUMBER;
accum_value NUMBER
BEGIN
-- this loop extracts the customer class and the order type that is
-- passed on the request line. We only use the
p_req_line_attrs_tbl
-- input parameter here.
i := p_req_line_attrs_tbl.FIRST;
WHILE I IS NOT NULL LOOP
v_req := p_req_line_attrs_tbl(i);
IF (v_req.context = 'CUSTOMER' AND
v_req.attribute = 'PRICING_ATTRIBUTE31')
THEN
v_cust_class := v_req.value;
ELSIF (v_req.context = 'ORDER' AND
v_req.attribute = 'PRICING_ATTRIBUTE40')
THEN
v_order_type := v_req.value;
END IF;
i := p_req_line_attrs_tbl.NEXT(i);
END LOOP;
-- supposing the customer class and order type are not null, now
-- query the user-defined table for the stored accumulation value
-- and return this value.
SELECT value
INTO accum_value
FROM accum_val_tbl
WHERE customer_class = v_cust_class
AND order_type = v_order_type;
RETURN accum_value;
END Get_numeric_attribute_value;

FUNCTION Get_numeric_attribute_value(
p_list_line_id IN NUMBER,
p_list_line_no IN VARCHAR2,
p_order_header_id IN NUMBER,
p_order_line_id IN NUMBER,
p_price_effective_date IN DATE,
p_req_line_attrs_tbl IN ACCUM_REQ_LINE_ATTRS_TBL,
p_accum_rec IN ACCUM_RECORD_TYPE
) RETURN NUMBER
IS
v_cust_class VARCHAR2(240);
v_order_type VARCHAR2(240);
v_req accum_req_line_attrs_rec;
i NUMBER;
accum_value NUMBER
BEGIN
-- this loop extracts the customer class and the order type that is
-- passed on the request line. We only use the
p_req_line_attrs_tbl
-- input parameter here.
i := p_req_line_attrs_tbl.FIRST;
WHILE I IS NOT NULL LOOP
v_req := p_req_line_attrs_tbl(i);
IF (v_req.context = 'CUSTOMER' AND
v_req.attribute = 'PRICING_ATTRIBUTE31')
THEN
v_cust_class := v_req.value;
ELSIF (v_req.context = 'ORDER' AND
v_req.attribute = 'PRICING_ATTRIBUTE40')
THEN
v_order_type := v_req.value;
END IF;
i := p_req_line_attrs_tbl.NEXT(i);
END LOOP;
-- supposing the customer class and order type are not null, now
-- query the user-defined table for the stored accumulation value
-- and return this value.
SELECT value
INTO accum_value
FROM accum_val_tbl
WHERE customer_class = v_cust_class
AND order_type = v_order_type;
RETURN accum_value;
END Get_numeric_attribute_value;

Вам также может понравиться