Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

Cursor in userdefined function

$
0
0

Hi All,

Please help me this is a urgent request

I have a oracle function that has been created now i wanted that to be created in sqlserver. Can u pelase suggest me any link or script where i can use the cursor in user-defined function in sqlserver. Appreciate your help.

FUNCTION fun_din (id IN NUMBER, dim IN VARCHAR2 DEFAULT ' < ')
RETURN VARCHAR2
IS
  param varchar2(2000);
  cursor c1 is 
  
  select name
  from (select id, inf
        from task
        start with id = pid
        connect by prior parentid = id) ids
        left join info info on ids.id = inf.id;
 
BEGIN
   
  for c2 in c1 
  loop
    if length(param) > 0 then
      param := dim || param;
    end if;
 
    param := c2.dim || param;
  end loop;


Viewing all articles
Browse latest Browse all 15694

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>