|
本帖最后由 likeyouli 于 2025-4-4 23:51 编辑
解决代码:with jichu as (select shfzhm,yyxmmc,tcje,fyfssj,row_number() over(partition by shfzhm order by fyfssj) as rn from tanghua where ybxmmc like '%糖化血红蛋白%') ,
digui (shfzhm,yyxmmc,tcje,fyfssj,rn,所有日期) as (
select jichu.*,cast(to_char(jichu.fyfssj,'yyyy-mm-dd') as varchar2(4000)) as 所有日期 from jichu where rn=1
union all
select jichu.shfzhm,jichu.yyxmmc,jichu.tcje,jichu.fyfssj,jichu.rn, (to_char(jichu.fyfssj,'yyyy-mm-dd') || '>>' ||所有日期) as 所有日期
from jichu join digui on jichu.shfzhm=digui.shfzhm and jichu.rn=digui.rn+1
)
select * from digui order by shfzhm,fyfssj
即 to_char转换为字符串后,再cast一下所有日期这列才可以, 感觉所有日期这列有点相当于变量, cast as varchar2(4000) 这样就没问题了, 这么简单的问题, 为啥百度,deepseek就解决不了呢?
是问的方式不对,还是怎么回事 ?? 老让我转to_clob,转完又报什么错误, 关键是根本就不需要转,最长的字符也不长 .
再说句, 这两天光研究递归查询了, 总算有点明白了
|
-
..png
(73.89 KB, 下载次数: 0)
|