Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Not able to receive email from Oracle

user12251389Feb 21 2017 — edited Feb 21 2017

I have created below Procedure for sending an email.

create or replace PROCEDURE send_mail_smtp

( sender IN VARCHAR2,

recipient IN VARCHAR2,

subject IN VARCHAR2,

message IN LONG

)

IS

mailhost VARCHAR2(30) := 'w010a893.k.com'; -- -- host mail address

mail_conn utl_smtp.connection ;

crlf VARCHAR2( 2 ):= CHR( 13 ) || CHR( 10 );

mesg long;

BEGIN

mail_conn := utl_smtp.open_connection(mailhost, 25);

mesg:= 'Date: ' || TO_CHAR( SYSDATE, 'dd Mon yy hh24:mi:ss' ) || crlf ||

      'From:  \<'||sender||'>' || crlf ||

      'Subject: '||subject || crlf ||

      'To: '||recipient || crlf ||

      '' || crlf || message;

utl_smtp.helo(mail_conn, mailhost);

utl_smtp.mail(mail_conn, sender);

utl_smtp.rcpt(mail_conn, recipient);

utl_smtp.data(mail_conn, mesg);

utl_smtp.quit(mail_conn);

END;

And when i am executing the procedure i am not getting any error but i am not receiving any email.

BEGIN

SEND_MAIL_SMTP(

'support@leot.com', --Sender

'r.des@leot.com', --Recipient

'Test Mail', --Subject

'Send From Oracle10g Database' --Message

);

END;

I have run the below alter command :

ALTER SYSTEM SET smtp_out_server='w010a893.k' SCOPE=both;

Also i have creatd ACL. When i ran the below sql statement i am getting records as:

SELECT * FROM dba_network_acls;

pastedImage_33.png

SELECT * FROM dba_network_acl_privileges where principal='RATOR_MONITORING';

pastedImage_38.png

I dont know for what reason i am not receiving an email: Below is the detail for my SMTP :

pastedImage_39.png

Comments

Pete_Scott

You say Variable C is refreshed - have you tried setting it instead?  On the Set Variable option of the package you could enter the two variables to combine - you need qualify the variables with the project name

Also are both A and B of the same data type?

3551278

It doesn't seem to work by setting variable C either.

I still get the error  "Variable has no value: PROJECT.VARIABLE_A"

Both variables are text.

The whole process works when I am setting the variable A and launching my package manually.

It doesn't work when i'm passing the variable A value with the startscen command.

Pavan8u

While generating Scenario, have you selected VAR A as startup parameter?

Regards,

Pavan

3551278

I think so, VAR A is INTERFACES.PAIE_XINT_MOIS in the screenshot below.

pastedImage_0.png

Pierre-Yves

Pavan8u

I tried it in my pc and it is working fine.

In Var_c I wrote query like

SELECT '#PAVAN.var_a'||'#PAVAN.var_b' from dual.

Please check whether you are using # before variable name or not. Please check Project name as well.

Regards,

Pavan

3551278

Sorry i was no specific enough.

I am encapsulating a scenario in another scenario.

In scenario 1 I declare VAR A (INTERFACES.PAIE_XINT_MOIS) and set VAR B (INTERFACES.PAIE_XINT_SOC_LIB)

Then I call scen 2 and refresh VAR C (INTERFACES.PAIE_XINT_CHEMIN) using the following query :

pastedImage_0.png

If I try refreshing VAR C in the first scenario, it works fine.

It is not working when doing it in scenario 2

Pierre-Yves

Pavan8u

If I am not wrong, you have one main scenario SCN1 and from SCN1 you are calling SCN2. You have var1 and var2 in SCN1 and var3 in SCN2.

In order to refresh VAR3 in SCN2 you need to pass var1 and var2 as additional parameters to SCN2.

Refer this blog for some insight-

http://odiexperts.com/passing-values-to-odi-variables-in-packagesscenarios/

Regards,

Pavan

3551278

You are right.

VAR A and B are declared in SCN2 before refreshing VAR C.

pastedImage_0.png

Therefore they are passed as startup parameters.

The whole thing works when VAR A is set manually in SCN1

But it doesn't work anymore when VAR A is passed with starscn command.

I think the solution might be to write the value of VAR A in a temporary table and use this table for queries.

Pierre-Yves

Pavan8u
Answer

In Package1, click on SCN2 and click on ADDITIONAL PARAMETERS, there you need to add VAR-A and VAR-B as additional parameters. Refer blog which mentioned in above thread.

Regards,

Pavan

Marked as Answer by 3551278 · Sep 27 2020
3551278

Thanks a lot Pavan, it did the trick, indeed.

Have a nice day.

Pierre-Yves

1 - 10
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 21 2017
Added on Feb 21 2017
7 comments
922 views