我還想求字符串相加呢.
假如有table x有兩個欄位f1,f2,三行數據
-------
f1 f2
-------
a 1
a 2
a 3
SELECT F1, COUNT(F2) FROM X GROUP BY F1
結果為 a,3
-----------------------------------------
SELECT F1, SUM(F2) FROM X GROUP BY F1
結果為 a, 6
-----------------------------------------
-----我想得到 a, 123 該怎麼辦????????
-----------------------------------------
写个函数,
create or replace function fun_test return number as
p_out number:=1;
v_temp number;
cursor c is select * from 表名;
begin
open c ;
loop
fetch c into v_temp;
exit when c%notfound;
p_out:=p_out*v_temp;
end loop;
close c;
return p_out;
exception
when others then
return -99;
end