CREATE OR REPLACE FUNCTION GET_SAS_MLZ_SUPPLIER(Contract_ IN VARCHAR2, Part_No_ IN VARCHAR2)
RETURN VARCHAR2
AS
TYPE name_table IS TABLE OF VARCHAR2(1000);
names name_table := name_table();
result VARCHAR2(4000);
BEGIN
-- Firma adlarını doldur
FOR rec IN (select m.vendor_no,supplier_api.Get_Vendor_Name(m.vendor_no)VendorName
from PURCHASE_PART_SUPPLIER m
where m.contract=Contract_ and m.part_no=Part_No_) LOOP
names.extend;
names(names.count) := rec.vendor_no || ' ' || rec.vendorname;
END LOOP;
-- Adları birleştir
FOR i IN 1..names.count LOOP
result := result || names(i) || ', ';
END LOOP;
-- Son virgülü kaldır
result := RTRIM(result, ', ');
RETURN result;
END;
0 yorum:
Yorum Gönder