CREATE OR REPLACE PROCEDURE Test_C_2 IS -- Master-detail report --------------- CURSOR c_user IS SELECT user_id, username FROM all_users; CURSOR c_obj(pc_owner VARCHAR2) IS SELECT OBJECT_ID, OBJECT_NAME, OBJECT_TYPE, CREATED FROM all_objects WHERE owner = pc_owner AND ROWNUM < 40; l_blob BLOB; l_first BOOLEAN; BEGIN Plpdf.init; -- initialize, without parameters means: page orientation: portrait, unit: mm, default page format: A4 Plpdf.nopAlias; Plpdf.SetFooterProcName('x1footer'); -- set footer creator procedure Plpdf.NewPage; -- begin a new page, without parameters means: page orientation: default (portrait) Plpdf.SetPrintFont('Arial','BU',14); -- set titles font: Arial 14, bold, underline Plpdf.PrintCell(0,20,'List of Objects','0',0,'C'); -- print out the title Plpdf.LineBreak(5); -- line break with 5mm Plpdf.SetPrintFont('Arial','I',10); -- set subtitle font: Arial 10, italic Plpdf.PrintCell(0,20,'Created date:' || TO_CHAR(SYSDATE,'DD-MM-YYYY'),'0',0,'C'); -- print out the subtitle: creation date Plpdf.LineBreak(20); -- line break with 20mm l_first := TRUE; FOR f_user IN c_user LOOP -- rows of table IF NOT(l_first) THEN Plpdf.NewPage; END IF; Plpdf.SetPrintFont('Arial','B',12); Plpdf.PrintCell(20,10,'User ID:'); Plpdf.PrintCell(20,10,TO_CHAR(f_user.user_id)); Plpdf.PrintCell(30,10,'Username:'); Plpdf.PrintCell(60,10,f_user.username); Plpdf.LineBreak; Plpdf.DrawLine(10,Plpdf.GetCurrentY,200,Plpdf.GetCurrentY); Plpdf.SetPrintFont('Arial','U',12); Plpdf.PrintCell(20,10,'Object ID'); Plpdf.PrintCell(80,10,'Object Name'); Plpdf.PrintCell(50,10,'Object Type'); Plpdf.PrintCell(20,10,'Created Date'); Plpdf.SetPrintFont('Arial','',12); Plpdf.LineBreak; FOR f_obj IN c_obj(f_user.username) LOOP -- OBJECT_ID, OBJECT_NAME, OBJECT_TYPE, CREATED IF Plpdf.CheckPageBreak(10) THEN Plpdf.SetPrintFont('Arial','U',12); Plpdf.PrintCell(20,10,'Object ID'); Plpdf.PrintCell(80,10,'Object Name'); Plpdf.PrintCell(50,10,'Object Type'); Plpdf.PrintCell(20,10,'Created Date'); Plpdf.LineBreak; Plpdf.SetPrintFont('Arial','',12); END IF; Plpdf.PrintCell(20,10,TO_CHAR(f_obj.object_id)); Plpdf.PrintCell(80,10,f_obj.object_name); Plpdf.PrintCell(50,10,f_obj.object_type); Plpdf.PrintCell(20,10,TO_CHAR(f_obj.created,'DD-MM-YYYY')); Plpdf.LineBreak; END LOOP; Plpdf.DrawLine(10,Plpdf.GetCurrentY,200,Plpdf.GetCurrentY); l_first := FALSE; END LOOP; Plpdf.LineBreak; -- line break with last cells height Plpdf.SetPrintFont('Arial','I',10); -- set print font: Arial 10, italic Plpdf.PrintCell(0,20,'----- End of Report -----','0',0,'C');-- print out closer string of table Plpdf.SendDoc(l_blob); -- create content -- store INSERT INTO STORE_BLOB (blob_file, created_date) VALUES (l_blob, SYSDATE); COMMIT; END; /