Job SQL Script using UTL_Mail.send fails
Hello worldIt comes to 10.2.0.4 on Windows
I have configured UTL_Mail and it works when I send mails via sqlplus.
Now, just trying to get my work very simple SQL Script to send an email.
That's all that is in the control box (I use control of the database to create the job)
exec UTL_MAIL.send (sender = > '[email protected]',)
recipients = > "[email protected]"
CC = > '[email protected] ',.
BCC = > '[email protected] ',.
subject = > "UTL_MAIL Test."
message = > "Job ULTRAPRD INTEGER BKUP Email on PNCLULTRAPRD has successfully completed");
Natural logarithm of output
SQL * more: Release 10.2.0.4.0 - Production on Fri Jul 17 09:36:32 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
SQL > SQL > SQL > SQL > connect.
SQL > SQL > START UTL_MAIL.send(sender => '[email protected]',;) END;
*
ERROR on line 1:
ORA-06550: line 1, column 53:
PLS-00103: encountered the symbol ";" when expecting one of the following values:
(- + new case mod not null other < an ID >)
< between double quote delimited identifiers of > < a variable binding > avg
current account is min max sql stddev sum variance prior
execute forall time timestamp interval date fusion
< a literal string with character set specification >
< a > < a SQL string between single quotes > hose
< a literal character in string quoted also defined specifications >
< an alternatively-q
SQL > SP2-0734: order unknown beginning "recipients...". "- rest of the ignored line.
SQL > SP2-0734: order unknown beginning 'cc... '. "- rest of line is ignored.
SQL > SP2-0734: order unknown beginning «bcc...» "- rest of line is ignored.
SQL > SP2-0734: beginning of unknown command "subject...". "- rest of the ignored line.
SP2-0044: for a list of known commands type HELP
and to let EXIT.
SQL > SP2-0734: order unknown start "message...". »
Thanks for all the ideas. John
Published by: user629010 on July 17, 2009 17:11
Published by: user629010 on July 17, 2009 17:13
Why the output does not say:
Procedure completed successfully
????
What about -
END;
/
as the last 2 lines.
Tags: Database
Similar Questions
-
How to run SQL scripts using OWB process flows?
Hello
I have a few SQL Scripts. I run them using process flow OWB.
Can I get a document or a link that helps me to achieve this?
Thanks in advance,
SriGPHi SriGP,
You can call SQLPLUS using the external process activity.
Order: Give the full path of the SQLPLUS executable
Script: specify what you want to do in SQLPLUSThank you
Fati -
Maximum size of the message body when you use utl_mail.send
I'm looking to get the documentation on the subject, but so far without success.
By looking at the interface, I expect the max size to 32 KB (varchar2 in Pl/Sql),
and when sending ascii using the value default mime_type ("text/plain; charset = us-ascii').
I can almost send this amount.
However when sending utf8 using the mime_type ' text/plain; Charset = UTF - 8',
I send about 7970 characters / 12650 bytes before I started getting errors
(ORA-06502: PL/SQL: digital error or value: raw variable length too long)
Although it is beyond my current needs, I would avoid having to test this on all versions,
customers could be going to use.
Testicular above were made on:
Oracle Database 11 g Release 11.2.0.2.0 - 64 bit Production running windows.
The database character set is AL32UTF8The code which fails in UTL_MAIL seems to be the following:
FUNCTION ENCODE_VARCHAR2(DATA IN VARCHAR2 CHARACTER SET ANY_CS) RETURN VARCHAR2 IS BEGIN RETURN UTL_RAW.CAST_TO_VARCHAR2( UTL_ENCODE.QUOTED_PRINTABLE_ENCODE( UTL_RAW.CAST_TO_RAW(DATA))); END;
The DATA received as a parameter is your body of the email ( messageparameter). The following test case goes directly to these data in the code above:
SQL> create or replace function FunkyString return varchar2 is 2 msg varchar2(32767 char); 3 line varchar2(32767 char); 4 begin 5 line := ''; 6 for j in 1..10 loop 7 line := line || '123æøåÆØÅ '; 8 end loop; 9 10 msg := 'Start_'; 11 for i in 1..80 loop 12 msg := msg || line || chr(13) || chr(10); 13 end loop; 14 msg := msg || '__end'; 15 16 return( msg ); 17 end; 18 / Function created. SQL> SQL> declare 2 r raw(32767); 3 begin 4 dbms_output.put_line( 'size='||length(FunkyString) ); 5 6 r := utl_raw.cast_to_raw( FunkyString ); 7 r := utl_encode.quoted_printable_encode( r ); 8 end; 9 / size=12971 declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: raw variable length too long ORA-06512: at "SYS.UTL_ENCODE", line 277 ORA-06512: at line 7
If utl_encode.quoted_printable_encode () throws an exception. I think that the issue is that encoding special characters in your message string, drastically increases storage required as 3 tanks are used by the single character special for coding, correct?
-
call a batch file in the sql scripts
Hi friends,
I'm looking for a way to call any batch file in sql scripts. I avoid using the DBMS_SCHEDULER package because my application server and database server are deparaments.
I use the sql script using the server.plz application.
Ah, I see. Of course, this explains everything.
Now to be serious: there is no way to run a batch SQL script. The Tools that present SQL statements to the database are often able to do; host in SQL * Plus may issue commands to the OS, the host of builtin forms is it too and with dbms_scheduler , you can run a shell script on the database server.
So depending on the tools you use, there are several ways to run the OS commands. So far you didn't tell us what you want to do with what tools in the version you want to do. So to only answer is: it is not possible. You cannot run a simple SQL command script.
see you soon
-
Cannot send mail when using UTL_MAIL. Send
Hello, I want to send a mail to oracle to yahoo, gmail...
I had prvtmail.sql, utlmail.sql install and config alter system set smtp_out_server = 'MY PUBLIC IP' SCOPE = both;
This is my code
Start
but it shows the error messageUTL_MAIL.SEND ( sender => '[email protected]' , recipients => '[email protected]' , cc => null , subject => 'test' , message => 'this is a test'); end;
Please help meError report: ORA-29278: SMTP transient error: 421 Service not available ORA-06512: at "SYS.UTL_SMTP", line 20 ORA-06512: at "SYS.UTL_SMTP", line 96 ORA-06512: at "SYS.UTL_SMTP", line 138 ORA-06512: at "SYS.UTL_MAIL", line 386 ORA-06512: at "SYS.UTL_MAIL", line 599 ORA-06512: at line 2 29278. 00000 - "SMTP transient error: %s" *Cause: A SMTP transient error occurred. *Action: Correct the error and retry the SMTP operation.
Thank youPort 21 is FTP control port. The client and the server use a second tcp port to send data. If you open only port, the FTP client and server can communicate commands - but will be unable to send data (so downloading files and downloads will fail).
Read this http://slacksite.com/other/ftp.html and pay particular attention to the functioning of the Passive and Active means and how do you determine the 2nd port (the data port used to send the data).
-
Unable to send mail via SMTP Server authenticated using UTL_MAIL
Hello world...
I tried to send an e-mail message using UTL_MAIL on Oracle 10 g (10.2.0.1.0), but get the error:
ORA-29279: permanent SMTP error: 550 must be authenticated
I have run utlmail.sql and prvtmail.plb connected in SYSDBA and set SMTP_OUT_SERVER.
We have recently changed our email provider and a new requires authentication for the outgoing SMTP server, where the message that I get, but so far I have not found something on how to send the user name password to the procedure of 'send', in documentation or in previous discussions or other resources.
Could someone help me solve this problem?
Thanks in advance.Not possible using UTL_MAIL, but if you roll your own using UTL_SMTP (which is what UTL_MAIL is written on the top) you can use the code fragment in Metalink Note 201639.1 to connect to a SMTP server using AUTH LOGIN.
-
Create jobs and positions via PL/SQL script
Hi, it is recommended to insert new jobs and positions via PL/SQL Script?
I know it's possible, I'm not sure if it is recommended. especially when it's via a direct insertion.
Is there an API for it?
I have about 200 + positions I need to set in our Instance of the EBS Test.
Thank you!
The APIs are the best way to do it in batches of charges-
Job: HR_JOB_API
Position: HR_POSITION_API
To know that all the seeds API, add the responsibility of integrated SOA gateway
-
passage OEM "SQL Script" job name in lowercase as proxy database
Hello
I have a SQL script that requires the name of the database in lower case to be passed when running - she uses it as a substitution variable to create database directories that point to the UNIX file system (which is why they are case sensitive). I want to be able to configure this script as work in OEM (12 c version 3) so that I can run on several databases (11.2.0.3), but at the creation of employment, the % DBName parameter returns only the name of the database uppercase. I tried to change the % DBName parameter and run the script in a PL/SQL block, but the variable I spend it is interpreted as a literal string. I also tried to run in a shell script, but because of the way the user operating system is set up that I can't get that to work either.
Does anyone have any ideas how this can be done? Ideally, I wish I could just run @script lower (%DBName%) or something similar.
Thanks in advance,
Robin
In case anyone else has trouble with this, I worked on that I was able to use a PL/SQL block to convert the variable substitution for lower case, then create the directory with the variable:
DECLARE
v_lowerSID varchar2;
BEGIN
Select lower ('& 1') in the double v_lowerSID;
run immediately ' create the db_dir as directory "/ [path] /' | v_lowerSID | '/' || v_lowerSID | ' _directory1 "';
END;
/
-
Backingup database using SQL script
Hello
Let me start by saying I am new to Oracle and I'm learning how to do a project where I have to write a SQL script that allows you to back up all data files (i.e. control, redo log and data files). Assuming that all the files are stored in a folder, the source locations and the destination of these files must be provided as 'substitution variables. The script must implement the following tasks (directions)
- Log in as the SYS user with SYSDBA role
- Closing the database
- Copy the files to the location of the source database and store it in the destination location
- Restart the database
- Log in the user SCOTT
In addition, the script must use the "HOST" command to publish the operating system command to perform the copy task.
* Since this is just a learning project and not a real scenario, I can't run my script in SQLplus to verify if it is correct. That's why I ask for professional advice. I am currently working with Oracle 11 g Enterprise running on a client Windows XP OS.
Here's what I decided, it's a cold backup, please let me know if what I do is correct so far, and if not can you please steer me in the right direction.
connect SYS / < password > have SYSDBA
Shutdown;
Copy of HOST of & source_file to & destination_file; -It is the line that confuses me.
connect SYS / < password > have SYSDBA
start-up;
Connect scott/tiger
Thanks in advance for your time and input.
I currently have the free version of 11g Oracle Enterprise downloaded on my computer, running on VB with the client Windows XP OS. But being new to this that I find myself afraid of bad script execution that can break my DB. I know that I can just reload and try again, but I try to approach the question as carefully as possible. Although the error codes help me understand what I am doing wrong much of the time.
Break things (and their fixation) is how to learn. Because you are running in VBox, simply take a snapshot of vbox system before testing. So if it is irrevocably broken, you just restore the snapshot system.
But give what you're trying to do, what do you think might happen this may break your db? As far as the db is concerned, everything you do connect, stop and commissioning. Nothing can go off of the truth of that.
-
sending e-mail using utl_mail
Hi all
I am able to send successfully from the database (11.2.0.1) using the utl_mail package.
but the obligation is such that I have to send the electronic trigger to those employees that a contract ends in a week, how do I dynamically put enamel of the employee in the recipients tag in utl_mail.send.exec utl_mail.send(sender=>'[email protected]', recipients=> '[email protected]', message=>'YOU HAVE ONE MONTH TO RENEW CONTRACT', subject=>'YOU HAVE ONE MONTH TO RENEW CONTRACT') ;
ex:-something as below, I know that the code is not right but kindly guide me
Thank youexec utl_mail.send(sender=>'[email protected]', recipients=> 'select email from emp where contract_exp between sysdate and sysdate+7 ' , message=>'YOU HAVE ONE MONTH TO RENEW CONTRACT', subject=>'YOU HAVE ONE MONTH TO RENEW CONTRACT') ;
user10243788 wrote:
Hi allI am able to send successfully from the database (11.2.0.1) using the utl_mail package.
exec utl_mail.send(sender=>'[email protected]', recipients=> '[email protected]', message=>'YOU HAVE ONE MONTH TO RENEW CONTRACT', subject=>'YOU HAVE ONE MONTH TO RENEW CONTRACT') ;
but the obligation is such that I have to send the electronic trigger to those employees that a contract ends in a week, how do I dynamically put enamel of the employee in the recipients tag in utl_mail.send.
ex:-something as below, I know that the code is not right but kindly guide me
exec utl_mail.send(sender=>'[email protected]', recipients=> 'select email from emp where contract_exp between sysdate and sysdate+7 ' , message=>'YOU HAVE ONE MONTH TO RENEW CONTRACT', subject=>'YOU HAVE ONE MONTH TO RENEW CONTRACT') ;
Thank you
move the SELECTION upwards within the LOOP
-
Hi friends,
I started this thread yesterday, but for some reason that I'm not able to answer/continue on this old thread. Here are the details from the old thread
I need help with a sql script to update sid_no_new column with values based on sid_no for about 6000 + records.
Here is an example below...
SQL > select * from test1;
SID_NO SID_NO_NEW UNIT_NO
-------------------- -------------------- --------------------
2000 unit1
2000 unit3
2000 unit4
2002 unit16
4500 unit22
In the example above, there are 3 sid_no consecutive '2000'. Sid_no_new must be 2000_1, 2000_2, 2000_3, respectively.
It should be like:
SQL > select * from test1;
SID_NO SID_NO_NEW UNIT_NO
-------------------- -------------------- --------------------
2000 2000_1 unit1
2000 2000_2 unit3
unit4 2000_3 2000
2002 2002 unit16
4500 4500 unit22
I ran the script (thanks to the experts who have contributed to) below, it works very well for the above documents, but I get ORA-30926 error when I run on the table with 6000 records...
Fusion IN test1 tgt USING
(SELECT sid_no,
sid_no_new,
unit_no,
Count (sid_no) over (partition BY sid_no) cnt,
ROW_NUMBER() over (partition BY order of sid_no to unit_no) rn
OF test1
) CBC ON(tgt.sid_no=src.sid_no AND tgt.unit_no=src.unit_no)
WHEN matched THEN
UPDATE SET Sid_no_new = CASE WHEN cnt > 1 THEN sid_no |' _'. RN ELSE sid_no END;
ERROR on line 1:
ORA-30926: failed to get a stable set of rows in the source tables
Please give your suggestions... Thank you very much
In fact, this could be done easier:
SQL > select *.
test1 2
3.
SID_ SID_NO UNIT_N
---- ------ ------
2000 2000_1 unit1
2000 2000_2 unit3
unit4 2000_3 2000
2002 2002 unit16
4500 4500 unit22
SQL > select *.
2 of test4
3.
UID_NO TYP RULE_DUE
---------- --- ----------
RAF 2000 90
3140 TH 100
6712 JUL 21
233 12 H6
SQL > fusion
2 in d of test4
3 use)
4 with as t4)
5. Select uid_no,
6 type,
7 rule_due,
8 rowid RID,
9 uid_no || '_' || ROW_NUMBER() over (partition by uid_no by 1 order) sid_no_new
10 of test4
11 )
12. Select t1.sid_no_new,
T4.type 13,
T4.rule_due 14,
15 cases
16 when t1.sid_no = t1.sid_no_new then t4.rid
17 when t4.sid_no_new = t1.sid_no_new then t4.rid
18 end rid
19 of t4,
Test1 20 t1
21 where t1.sid_no = t4.uid_no
22 ) s
23 on)
24 d.rowid = s.rid
25 )
26 when matched
27 then
Update 28
29 set d.uid_no = s.sid_no_new
30 when no match
31 then
32 insert
33 values)
s.sid_no_new 34,
s.type 35,
36 s.rule_due
37 )
38.
3 lines merged.
SQL > select *.
2 of test4
3.
UID_NO TYP RULE_DUE
---------- --- ----------
2000_1 RAF 90
3140 TH 100
6712 JUL 21
233 12 H6
2000_3 RAF 90
2000_2 RAF 90
6 selected lines.
SQL >
SY.
-
Error Utl_Mail.Send
Hello
I tried this code in sqldeveloper: any help is appreciated...
/ * starting code * /.
BEGIN
exec (Utl_Mail.Send)
sender = > ' [email protected] ',
recipients = > ' [email protected] ',
subject = > 'Oracle-Mail. "
message = > 'Oracle');
END;
/ * end code * /.
/ * output beginning * /.
Error starting line: 1 at the controls.
BEGIN
exec (Utl_Mail.Send)
sender = > ' [email protected] ',
recipients = > ' [email protected] ',
subject = > 'Oracle-Mail. "
message = > 'Oracle');
END;
Error report-
ORA-06550: line 2, column 6:
PLS-00103: encountered the symbol "UTL_MAIL" during the expected in the following way:
:= . ( @ % ;
The symbol ': = ' was replaced by "UTL_MAIL" continue.
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
/ * output end * /.
BEGIN
Exec Utl_Mail.send (...)
Exec is not an element of PL/SQL language. It is frequently used by the client tools (such as SQL * more) however.
Clean and give it a try.
-
Excerpt from SQL script Planner
Hello
Developer SQL version 3.2.10.09
Is there a way to extract the SQL of a scheduler job script? I put in place a work in my enviromnent of test using the Wizard SQL Developer that worked extremely well, but my dba insists on having a SQL script to deploy in the active database.
Thank you
Nick.Try this:
select dbms_metadata.get_ddl('PROCOBJ', 'your_job_name') from dual;
-------
You can also create new 'DDL' tab for jobs in SQL Developer yourself in less than 5 minutes:
b save the XML in a file - for example 'JobEditDDL.xml '.b to the SQL Developer open: Tools-> preferences-> database-> user defined extensions
(c) click thebutton. Select EDITOR (type), and then add the full path of the xml file.
d click "OK" and restart SQL DeveloperEdited by: dz_r 2012-11-21 23:12
-
Effect of NLS_LANG in the SQL scripts
DB version: 11.2.0.2
Platform: RHEL 5.6
We have a software provider who occasionally sends SQL scripts to deploy.
The scripts contain usually few CFDS and many LMD
Textpad, I can see, the LMD (inserts, updates) in the SQL Script. It usually contains some non-English characters (Dutch, German, French) as
They always ask us set NLS_LANG as follows.'Übersicht Buchungssätze' . 'Fehler beim Löschen der zugeordneten Referenzen!'
After INSERTION, I questioned the inserted values of PL/SQL Developer. Values appear exactly as it appears in the SQL Script text file as shown above.export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P15"
So, what was the effect of the NLS_LANG setting? What would have happened if I had not set NLS_LANG?
NLS in the DB InfoSQL > select * from nls_Database_parameters; PARAMETER VALUE ------------------------------ ---------------------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY UNITED KINGDOM NLS_CURRENCY # NLS_ISO_CURRENCY UNITED KINGDOM NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET AL32UTF8 NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH24.MI.SSXFF NLS_TIMESTAMP_FORMAT DD-MON-RR HH24.MI.SSXFF NLS_TIME_TZ_FORMAT HH24.MI.SSXFF TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH24.MI.SSXFF TZR NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_DUAL_CURRENCY ? NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_RDBMS_VERSION 11.2.0.2.0 20 rows selected.
If our supplier had chosen to save the script with the UTF-8 encoding, then, we have set NLS_LANG. Right?
Evil. You need to AMERICAN_AMERICA. AL32UTF8. If you don't set NLS_LANG, it uses default AMERICAN_AMERICA. US7ASCII. Therefore, only pure ASCII 7-bit scripts can be executed in such environment. The Oracle Client does not use the default database character. It uses the platform default (usually US7ASCII) or UTF-16 in the case of JDBC, ODBC (Unicode mode) and ODP .NET pilots.
-Sergiusz
-
Generate the HTML Emails using UTL_MAIL instead of UTL_SMTP
Hi all
We use a server Oracle 11 GR 2.
I want to know if we can produce HTML emails using UTL_MAIL instead of UTL_SMTP package.
I searched the Internet but found most of the research showing the UTL_SMTP package.
So here the expert opinion on this before proceeding with the UTL_SMTP package.
Thank you
Madhu K.Maldini says:
I want to know if we can produce HTML emails using UTL_MAIL instead of UTL_SMTP package.
Yes. "You set the Mime_Type setting" + text / html + ' and the value of the parameter to the HTML email Message .
I searched the Internet but found most of the research showing the UTL_SMTP package.
UTL_SMTP is an interface for the use of the SMTP application protocol. She in turn runs on the package UTL_TCP which provide an interface to communicate using the TCP network protocol.
UTL_MAIL working above UTL_SMTP. It provides a simple interface to sending an e-mail without the caller having to deal with the actual construction of the e-mail itself. Binary attachments should be coded. MIME limits must be defined and Mime header created. Etc.
UTL_MAIL does most to build an e-mail and then deliver using UTL_SMTP. But he did a job very basic and a bit primitive. This means that if you want complex structures of e-mail, you must create that yourself and then use UTL_SMTP of to deliver.
Note that UTL_SMTP is the e-mail delivery truck. He does not care and does not know what the cargo contains it delivers. If it is an HTML email with 20 attachments, or just a plain text email or an invitation to a meeting to recognized and on demand by the customer mail reader receives. Construction of an e-mail is processed through the form of MIME (Multipurpose Internet Mail Extensions). It has NOTHING to do with the SMTP application protocol.
UTL_MAIL is an implementation of skeleton Mime. You need more than that - look somewhere else (3rd party) or write your own code. UTL_SMTP is irrelevant somehow when it comes to build emails.
Maybe you are looking for
-
ICloud newbie: download photos from the iPod touch 4th generation to iCloud
Trying to save photos from an older device. I activated iCloud on the iPod and it says "Download xxx photos" but when I open my iCloud account on my laptop, the photos are not there. (It works great with my iPhone). Any suggestions?
-
Satellite Pro L300D PSLC9E - failed to update BIOS
Hi all I got a Toshiba Satellite Pro L300D Windows Vista Business, this isn't that four months, recently, he began to break up and whenever he did, I got a message to upgrade the BIOS.So I went to the Toshiba Site and I downloaded an updated BIOS yes
-
Satalite 1110: Screen dimming because of the cover button
I have a portable Satalite 1110. It's old but works great but the small switch that is there to detect the lid being closed cheek upward... It the screen keeps going dim (almost extinct) trying to save energy when the lid is closed... but of course t
-
LAN - installation of an Ethernet controller
Hi all I know, this issue has already been discussed, but after all, my attempts to make my card Ethernet works correctly, I decided to ask someone who had the same problem and actually reached the happy end. ;) So, I reinstalled Windows XP on my lap
-
keyboard and touchpad not working not
Hello I hava a HP pavilion touchsmart sleekbook 14-b133tx laptop running windows 8 and is still under warranty because of a defective touchscreen. A few days ago my touchpad does not work correctly. When I tap the touchpad, it's a richt click and whe