有人能将下面的sql语句转到oracle里执行吗
create function fun(@userid varchar(200))
returns varchar(2000)
as
begin
declare @re varchar(2000)
set @re= ' '
select @re=@re+ ', '+username from userinfo
where charindex(userid, @userid)> 0
return(stuff(@re, 1, 1, ' '))
end
select meetingid, meetingname,
createrid=dbo.fun(createrid),
joinid=dbo.fun(joinid)
from meetinginfo
------解决方案--------------------create or replace function fun(p_userid varchar2)
returns varchar2(2000)
is
v_re varchar2(2000);
begin
p_re:= ' ';
select v_re|| ', '|| username into v_re from userinfo
where instr(userid, p_userid)> 0;
return substr(v_re,2,length(v_re)-1);
end;
------解决方案--------------------select meetingid,meetingname,
fun(createrid) as createrid ,
fun(joinid) as joinid
from meetinginfo