【发布时间】:2018-07-02 08:47:28
【问题描述】:
早上好,伙计们,我在医疗保健部门工作的代码有问题,抱怨代码必须是复选框,但他们要求报告包含将出现在数据库中的治疗代码,如 1:15:2:3 等我需要单独计算每个代码 我必须数到我得到“:”然后我需要取一个可以是 1 或 2 位的数字,然后与另一个表进行内部连接 谁能帮我解决这个功能和循环中的问题并获得每个人的号码
create or replace function hcc_get_tcd_codes (p_id in number )
return varchar2 is
x number := 0 ;
y number := 0 ;
z number ;
code1 number ;
code_name varchar2(15);
begin
for i in 0 .. x
loop
select length(t.tcd_codes ) into x from hcc_patient_sheet t where t.id = p_id ; --- (9)العدد كامل
select instr(tcd_codes, ':') into y from hcc_patient_sheet t where t.id = p_id ; ---- عدد الكود الاو(3)ل
select instr(tcd_codes, ':')+1 + y into z from hcc_patient_sheet t where t.id = p_id ; --عدد الكود كامل +1
enter code here
i := x -y ;
select substr(t.tcd_codes,z, instr(tcd_codes, ':')-1) into code1
--,select substr(t.tcd_codes, 0, instr(tcd_codes, ':')-1) as code2
from Hcc_Patient_Sheet t
where t.id = 631 ;
select t.alt_name into code_name from hcc_complaint_codes t where t.code = code1 ;
select instr(tcd_codes, ':') into y from hcc_patient_sheet t where t.id = p_id ; ---- عدد الكود الاول
return code_name ;
end loop ;
end;
【问题讨论】:
标签: plsql oracle-apex