Muhammad Abdul Qaium is a Database Engineer/Oracle Apex Developer/BI Developer (in Connecticut, USA) who is an Oracle Certified Cloud Architect Professional, OCI Autonomous DB specialist as well as Oracle Business Intelligence Foundation Suite 11g Certified Implementation Specialist with extensive expertise in Database design , PL/SQL, Oracle Apex, Microsoft SSIS, ETL, Power BI, Qlik Sense, BI Publisher, Jasper Report, OBIEE. Contact: qaiuminfo@gmail.com
Sunday, February 24, 2019
Group Report In Oracle Apex
Just Create A Region with PL/SQL Dynamic Content Type.
Then copy-pest the code.
This report is just a demo. Do your report yourself. Just you can take the concept .
declare
v_did varchar2(50) :=1000;
v_cnt number;
v_rowspan number;
begin
htp.p('<style>
tr,th,td{
border: 1px solid black;
}
table{
width: 100%;
}
</style>');
htp.p('<table><tr><th>did</th><th>name</th><th>sal</th></tr>');
for i in (select department_id did, department_name dname from departments where department_id in (select department_id from employees) order by 1 asc) loop
select count(*) into v_cnt from employees where department_id=i.did;
v_rowspan :=v_cnt+1;
htp.p('<tr><td rowspan="'||v_rowspan||'">'||i.did||'</td></tr>');
for a in (select last_name lname, salary sal from employees where department_id =i.did) loop
if v_did<> i.did then
htp.p('<tr><td>'||a.lname||'</td><td>'||a.sal||'</td></tr>');
end if;
end loop;
v_did :=i.did;
end loop;
htp.p('</table>');
end;
--Thank You
No comments:
Post a Comment