I am trying to send output of an query through mail. I am using following command.
FOR i IN emp_cur LOOP
e_fullname := i.full_name;
UTL_SMTP.WRITE_DATA(v_connection_handle,
e_fullname || ' - ' || i.ID ||' - ' || i.location_city ||' - ' || i.job ||' - ' || i.supervisor_name || UTL_TCP.CRLF|| UTL_TCP.CRLF);
END LOOP;
Output looks like this:
Pandyan - 12312 - Williamsburg - Developer - Pieterson
Bowaris - 98615 - Ohio - Spec - Pieterson
Perry, Steven W (Steve) - 11111 - Ohio - Analyst - Pieterson
Praveerarajan - 44444 - Williamsburg - Engineer - Pieterson
Now, how can I make my output look good(streamlined). So that all emp names have right spacing and IDs are displayed one below the other in a straight line, and the same for the other columns.
Thanks
venkat
Use the RPAD and LPAD functions to make the columns take up the same amount of space, regardless of the length of the content. Use RPAD to align strings on the left-hand side, and LPAD to align numbers on the right.
Eg.
The default padding character is space, which is probably what you want in this case.
Of course, this is only going to make things line up nicely in a fixed size font (like Courier New). If your email is going to use some easy reading font like Arial you’ve got problems.