title: How to send the result of a select query to a message body of a mail in oracle 10G
body: <pre><code>CREATE OR REPLACE PROCEDURE STATUS_MAIL(FROM_MAIL IN VARCHAR2, TO_MAIL IN VARCHAR2)
  is
    v_From      VARCHAR2(80) := FROM_MAIL;
    v_Recipient VARCHAR2(80) := TO_MAIL;
    v_Subject   VARCHAR2(80) := 'EMPLOYEE STATUS';
    v_Mail_Host VARCHAR2(30) := 'xx.xx.xxx.xxx';
    v_Mail_Conn utl_smtp.Connection;
    v_msg_body VARCHAR2(5000);
    v_output VARCHAR2(5000);
  
  BEGIN 
   /*Result always returns 42 rows*/
   v_output := 'select empid,ename,mobile,dept from employee';
   EXECUTE IMMEDIATE v_output into v_msg_body;
  
   v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, xx);
   utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
   utl_smtp.Mail(v_Mail_Conn, v_From);
   utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
   utl_smtp.Data(v_Mail_Conn,
     'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || UTL_TCP.crlf ||
     'From: '   || v_From || UTL_TCP.crlf ||
     'Subject: '|| v_Subject || UTL_TCP.crlf ||
     'To: '     || v_Recipient || UTL_TCP.crlf ||
     UTL_TCP.crlf || v_msg_body );
   utl_smtp.Quit(v_mail_conn);
  EXCEPTION
   WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
   raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
  END;
  </code></pre>
  
  <p>Getting an error inconsistent datatypes 
  @ EXECUTE IMMEDIATE v_output into v_msg_body
  while executing the above procedure, please help me....</p>