当前位置:数据库 > Oracle >>

oracle多个结果集拼接字符串

oracle多个结果集拼接字符串
 
Java代码  
create or replace function getStrWxr(id in varchar2) RETURN varchar2 AS  
  v_wxrname varchar2(20);  
BEGIN  
  /* 
  SELECT  csrname into v_wxrname 
  FROM workorder_dispatch inner join csr on csr.csrid = workorder_dispatch.csr_id 
  WHERE wo_id=id; 
  */  
  SELECT ltrim(max(sys_connect_by_path(csrname, ',')), ',')  
    into v_wxrname  
    from (select csrname, rownum t  
            FROM workorder_dispatch  
           inner join csr on csr.csrid = workorder_dispatch.csr_id  
           WHERE wo_id = id)  
  connect by prior t = t - 1  
   start with t = 1;  
  
  RETURN(v_wxrname);  
END getStrWxr;  
 
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,