Home » SQL & PL/SQL » SQL & PL/SQL » Right Text Alignment (Oracle 9i)
Right Text Alignment [message #424181] Wed, 30 September 2009 08:11 Go to next message
Messages: 22
Registered: September 2008
Location: Egypt
Junior Member
Please advice how to align the Arabic text to the right

Below is the Stored Procedure:
CREATE OR REPLACE procedure DMS.smail
from_name varchar2,
to_name varchar2,
subject varchar2,
message varchar2
l_mailhost VARCHAR2(64) := '';
l_from VARCHAR2(64) := from_name;
l_to VARCHAR2(64) := to_name;
l_subject VARCHAR2(64) := subject;
l_message varchar2(4000):='';
l_mail_conn UTL_SMTP.connection;
l_mail_conn := UTL_SMTP.open_connection(l_mailhost, 25);
UTL_SMTP.helo(l_mail_conn, l_mailhost);
UTL_SMTP.mail(l_mail_conn, l_from);
UTL_SMTP.rcpt(l_mail_conn, l_to);

select qarar into l_message from qarar where ref_no=447;
UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'From: ' || l_from || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || l_subject || Chr(13));
UTL_SMTP.write_data(l_mail_conn, 'To: ' || l_to || Chr(13));
UTL_SMTP.WRITE_DATA(l_mail_conn, 'MIME-Version: 1.0'|| UTL_TCP.CRLF);
UTL_SMTP.WRITE_DATA(l_mail_conn, 'Content-Type: text/html;charset=windows-1256;align=left'|| UTL_TCP.CRLF);

UTL_SMTP.write_data(l_mail_conn, '' || Chr(13));

-- FOR i IN 1 .. 10 LOOP
-- UTL_SMTP.write_data(l_mail_conn, 'This is a test message. Line ' || To_Char(i) || Chr(13));
-- select qarar into l_message from qarar;
-- UTL_SMTP.write_data(l_mail_conn, message|| Chr(13));
UTL_SMTP.write_raw_data(l_mail_conn, utl_raw.cast_to_raw(l_message||chr(13)));


Please find attached the output of this procedure that needs to be adjusted onto the right.
Many thanks
  • Attachment: email.jpg
    (Size: 451.14KB, Downloaded 170 times)
Re: Right Text Alignment [message #424182 is a reply to message #424181] Wed, 30 September 2009 08:18 Go to previous messageGo to next message
Michel Cadot
Messages: 64294
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is the problem of your mail reader not of Oracle.

Re: Right Text Alignment [message #424262 is a reply to message #424182] Thu, 01 October 2009 03:17 Go to previous message
Messages: 22
Registered: September 2008
Location: Egypt
Junior Member
Thanks for your reply.

But please note that there is a line in the procedure:

UTL_SMTP.WRITE_DATA(l_mail_conn, 'Content-Type: text/html;charset=windows-1256;align=left'|| UTL_TCP.CRLF);

Where the Arabic language is specified
and the alignment whether left or right-doesn't change the text alignment.

Is there anything I could add to this line of code that could align the Arabic content onto the right?

(Please note that my mail receives all Arabic email alignment to the right- the only emails that come from the called Stored procedure are placed onto the left)

[Updated on: Thu, 01 October 2009 03:20]

Report message to a moderator

Previous Topic: not sure what the nvl() function is replacing here...
Next Topic: My Simple query takes 30 min to run
Goto Forum:

Current Time: Tue Jan 24 01:14:24 CST 2017

Total time taken to generate the page: 0.06352 seconds