我有這種類型的功能:使用功能的Oracle
FUNCTION mfi_cust_details (vacid VARCHAR2)
RETURN VARCHAR2
IS
vcustdetails VARCHAR2 (300);
BEGIN
BEGIN
SELECT a.cust_title_code
|| ','
|| a.cust_id
|| ','
|| b.address_line1
|| ','
|| b.address_line2
|| ','
|| mfi_citycountry (b.country, b.city)
|| ','
|| b.zip
INTO vcustdetails
FROM tbaadm.cmg a, crmuser.address b
WHERE TRIM (a.cif_id) = TRIM (b.orgkey)
AND UPPER (b.addresscategory) IN ('MAILING', 'REGISTERED')
AND cust_id IN (SELECT cust_id
FROM tbaadm.gam
WHERE acid = vacid);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
vcustdetails :=
NULL
|| ','
|| NULL
|| ','
|| NULL
|| ','
|| NULL
|| ','
|| NULL
|| ','
|| NULL
|| ','
|| NULL;
END;
RETURN vcustdetails;
END mfi_cust_details;
,我需要從這些數據插入到表,例如:
insert into my_table values(mfi_cust_details(myacid),anotherFunction());
,但我的程序是甚至沒有編譯一個錯誤:
not enough values
是什麼我試圖做甚至可能嗎?
編輯 我的表定義
create table my_table cust_title_code varchar2(10),
cust_id varchar2(10),
address1 varchar2(10),
address_2 varchar2(10),
city_code varchar2(5),
country_code varchar2(5),
zip_code varchar2(10));
您需要'INSERT INTO..SELECT'語句。 –
有多少列有在MY_TABLE?如果不是2(由你的價值觀語句定義),我使用的其他值光標內插入它不會工作 – davegreen100
@ davegreen100。 – ErrorNotFoundException