- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
sResult:= '';
select code||' '||h.longname into sResult
from tbl1 mo, tbl2 ob, g_cli c, tbl3 h
where mo.m_dep_id = ob.obj_dep_id and mo.m_id = ob.obj_id
and ob.dep_id = nDepId and ob.id = nId
and mo.cli_dep_id = c.dep_id and mo.cli_id = c.id
and c.id = h.id and c.dep_id = h.dep_id and p_operday between h.FROMDATE and h.TODATE;
return sResult;
exception
when NO_DATA_FOUND then return null;
when TOO_MANY_ROWS then
for rec in( select distinct code as cli_code, h.longname as cli_name
from tbl1 mo, tbl2 ob, g_cli c, tbl3 h
where mo.m_dep_id = ob.obj_dep_id and mo.m_id = ob.obj_id
and ob.dep_id = nDepId and ob.id = nId
and mo.cli_dep_id = c.dep_id and mo.cli_id = c.id
and c.id = h.id and c.dep_id = h.dep_id and dT between h.FROMDATE and h.TODATE)
loop
if nvl(length(sResult),0) = 0 then
sResult:= rec.cli_code||' '||rec.cli_name;
else
sResult:= sResult||', '||rec.cli_code||' '||rec.cli_name;
end if;
end loop;
return sResult;
when others then return null;
guest 25.11.2014 11:21 # 0
ColvirBydlokod 25.11.2014 11:24 # 0
defecate-plusplus 25.11.2014 11:46 # +1