Home » Developer & Programmer » Forms » Basic trigger question
Basic trigger question [message #204736] Tue, 21 November 2006 22:46 Go to next message
toenie2
Messages: 7
Registered: November 2006
Junior Member
Hi,

I searched and looked and tried, but I can't figure out this one. It's basic, but I hope you can help.

I am trying to start a trigger which sends a mail to a new user in my webapplication.

Again, basic stuff:

CREATE OR REPLACE TRIGGER USER_T2
AFTER
insert on "USERTABLE"
for each row
DECLARE
MAIL VARCHAR2(32);
BEGIN
 MAIL :=:new.emailaddress;
 send_mail(:new:MAIL, 'Subject', 'Enter text here');
end;
/


What am I doing wrong here?

Thanks in advance.
Re: Basic trigger question [message #204737 is a reply to message #204736] Tue, 21 November 2006 22:50 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
What version of Oracle RDBMS are you using? What is send_mail? Is this really a forms question or are you really trying to run it from the server (in which case I will move your thread to another forum)? Does your Oracle database server have an email server on it? Have you searched this forum or this site for 'send_mail' or 'mail' or 'email'?

David
Re: Basic trigger question [message #204771 is a reply to message #204737] Wed, 22 November 2006 01:16 Go to previous messageGo to next message
toenie2
Messages: 7
Registered: November 2006
Junior Member
Thanks for your reaction, I understand that I gave little info, it was my first post, though.

I am using Oracle 10g on Windows XP. send_mail is a procedure which sends mail. It has 3 values, like this:

send_mail (emailaddress, subject, text)


My mailserver works, I tested send_mail with a fixed emailaddress, like this:

send_mail (toenie@hotmail.com, mysubject, mytext)


So that is not the point. What I try to achieve is that when someone in my webapplication opens an account (his login being his emailaddress), to confirm this by sending him (or her) an email. This is where the trigger comes in. The trigger needs to get the emailaddress column from the new row.

Is this a better description of my problem?
Re: Basic trigger question [message #204954 is a reply to message #204771] Wed, 22 November 2006 20:45 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have a look at http://www.orafaq.com/forum/m/186479/67467/?srch=send_mail#msg_186479

The problem with "send_mail(:new:MAIL, 'Subject', 'Enter text here');" is that it should be "send_mail(MAIL, 'Subject', 'Enter text here');". You don't need to use 'NEW' unless you are addressing the items in the record itself. You are using a local variable.

David
Previous Topic: Through Outlook send mail & Attachment
Next Topic: FRM-10142 The HTTP Listener is not running on server. Please start the listener or check your run ti
Goto Forum:
  


Current Time: Fri Sep 20 12:33:43 CDT 2024