写个自定义函数
create function f_1(id in varchar2)
return varchar2
as
Result varchar2(5000);
begin
...
...
return(Result);
end f_1;--然后调用:
select id,f_1(id) name from t
create function f_1(id in varchar2)
return varchar2
as
Result varchar2(5000);
begin
...
...
return(Result);
end f_1;--然后调用:
select id,f_1(id) name from t
cursor c is select to_char(a.grade) from table a where a.id=p_stu;
p_out varchar2(3000);
p_temp varchar2(20);
begin
open c ;
loop
fetch c into p_temp;
exit when c%notfound;
p_out:=p_out||' '||p_temp;
end loop;
close c;
return p_out;
exception
when others then
return '出错';
end
select b.id,fun_test(b.id) from ( select distinct a.id id from table a ) b