hi
sql gurus, here is my question 4 u.
i wanna use triggers for sending reminder mail to all users
who are registered to the site. if any one knws the code plz
send me ans here : chayabs3@gmail.com
thnx advance
Answer / gourvendra singh
Hi,
this can be done, i can not send u the exact code but
following steps can help you out.
-- Create a procedure with following code in mailhost you
have to enter the IP of the mail server :
CREATE OR REPLACE PROCEDURE LEAMIGR_BAFLAF.email(p_target
IN VARCHAR2, p_subj IN VARCHAR2, p_message IN VARCHAR2) IS
--PURPOSE: SEND p_message TO p_target VIA EMAIL.
v_eol VARCHAR2(2) := chr(13)||chr(10); -- EOL CHARACTERS
v_sender VARCHAR2(50) := 'sender@mail.com';
mailhost VARCHAR2(35) := 'mail@mail.com';
mail_connection utl_smtp.connection;
BEGIN
-- ESTABLISH CONNECTION AND PERFORM HANDSHAKING
mail_connection := utl_smtp.open_connection(mailhost,25);
utl_smtp.helo(mail_connection,mailhost);
utl_smtp.mail(mail_connection,v_sender);
utl_smtp.rcpt(mail_connection,p_target);
-- BUILD THE MAIL MESSAGE AND SEND IT OUT
utl_smtp.mail_connection
('Subj:'||p_subj||v_eol||v_eol||p_message||v_eol);
-- SEVER THE CONNECTION
utl_smtp.quit(mail_connection);
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20002,'ERROR IN EMAIL
=> '||SQLCODE||':
'||SQLERRM);
END;
-- Now create a trigger on the table where the insert
operation is happining and on post insertion call the
procedure with the mail id of the user to whom you want to
send a mail.
I think this will work.
for any query can contact at:
raviindian2114@gmail.com
Is This Answer Correct ? | 4 Yes | 0 No |
Is full outer join same as cross join?
Explain what is a column in a table?
what are the tunnig tables you used for tuning a query and tell me some of coloumns in that tuning tables?
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
difference between anonymous blocks and sub-programs.
What are all the different types of indexes?
How do you update a table in sql?
how can we write a column values horizontal by using sql stmt; ex: select name from table_name;(actual output) a b c d require output is a b c d
5 Answers Honeywell, Interact,
What is the difference between join and union.
27 Answers 3i Infotech, ABC, Oracle, Polaris, TCS, XT Global,
How do I add a primary key to a table?
Practice 1: Changes to data will only be allowed on tables during normal office hours of 8.45 in the morning until 5.30 in the afternoon, MONDAY through FRIDAY. A. Create a procedure called SECURE_DML that prevents the DML statement from executing outside of normal office hours, returning the message: “you may only make changes during normal office hours” b. Create a statement trigger on the PRODUCT table which calls the above procedure. c. Test it by inserting a new record in the PRODUCT table.
What is scalar function?