Aggregator | Books | Industry News | Firefox Plugins | Social | Links

Comments

Email From Oracle PL/SQL (UTL_SMTP) - Email from PL/SQL using UTL_SMTP rather than using external procedures or Java.



Yogesh Kamath said...

Thanks you very much, it helped me a lot.

Is there any way to send text in MAIL BODY, this example describes about sending data/message in subject line.

Gr8 work..

Cheers
Yogesh

Jonathan Sanchez said...

I have a problem. in the line " UTL_SMTP.write_data(l_mail_conn, UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(DBMS_LOB.substr(p_attach_blob, l_step, i * l_step + 1))));" return this error : "ORA-06502: PL/SQL: error : longitud de variable raw demasiado grande numérico o de valor"

Thanks

Tim... said...

Hi.

I'm guessing you are using a multibyte character set so the buffer is too small to hold the raw data. If this is the case, you will need to reduce the step size.

If you have any more problems, please ask questions in the forum.

Cheers

Tim...

Sunil said...

Nice article! simple and useful!

Chukwuma Imegwu said...

My scenario is this, send an alert using UTL_SMTP.

#!/bin/bash

if [ $# -ne 2 ]; then
echo "Usage: $0 SID threshold"
exit 1
fi
ORACLE_SID=SITA
ORACLE_HOME=/u01/app/oracle/SITA/db/tech_st/11.2.0
PATH=$ORACLE_HOME/bin:$PATH
crit_var=$(
sqlplus -s < apps/usneg01d14
SET HEAD OFF TERM OFF FEED OFF VERIFY OFF
COL pct_free FORMAT 999

Tim... said...

Questions in the forum please!

Cheers

Tim...

sanjeev said...

in clob attachment mail, why you using l_step?

Tim... said...

Hi.

The WRITE_DATA procedure only accepts VARCHAR2, so we have to process the CLOB in chunks. The step is used in the division of the CLOB into suitable chunks.

If WRITE_DATA accepted CLOBs, or your CLOBs were always under 32K in size, this would not be necessary.

Cheers

Tim...

DO NOT ask technical questions here, that's what my forum is for!

These comments should relate to the contents of a specific article. Constructive criticism is good. Advertising and offensive comments are bad and will be deleted!

Add your comments here.
Name
Comment
(max 400 chars - plain text)