ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Databases  >>  SQL PLSQL
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
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

 Question Submitted By :: Chayadornal
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
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 ?    2 Yes 0 No
Gourvendra Singh
 

 
 
 
Other SQL PLSQL Interview Questions
 
  Question Asked @ Answers
 
What is magic table?  5
What is a Procedure ?  2
use of IN/ANY/ALL Ramco4
what is the difference between to_char and to_date functions? Infosys3
Please let me know if UNION ALL and Natural Join does the same operation and are same... iGate3
what is the need of the cursor attribute notfound..(because using found attribute we can complete the task......found + negation operator = not found ) Tech-Mahindra1
If I have a table T with 4 rows & 2 columns A & B. A has values 1,2,3,4. and B has 10,20,30,40. Write an Update SQL query which can Swap the values of A & B for all records. (Do not use a sub-query)  2
What is normalization ? BirlaSoft6
What is an Integrity Constraint?  4
if we give update table_name set column_name= default. what will happen? iFlex3
how to debugg a procedure or package using dbms_output.put_line in plsql Polaris1
what is the difference between union and union all Oracle11
What are the data types allowed in a table?  2
what is bulk bind TCS4
Can a table have two primary keys? HCL25
select 1,col1,col2 from table1. output? Ramco3
Explain Connect by Prior?  2
how a reference cursor works?what all adnvantages are gained with it..specify the situation? TCS3
What is the main difference between a UNION statement and a UNION ALL statement? 1. A UNION statement eliminates duplicate rows; a UNION ALL statement includes duplicate rows. 2. A UNION statement can be used to combine any number of queries; a UNION ALL statement can be used to combine a maximum of two queries. 3. A UNION statement can only combine queries that have parallel fields in the SELECT list; a UNION ALL statement can combine queries with differing SELECT list structures. 4. A UNION statement cannot be used with aggregate functions; a UNION ALL statement can be used with aggregate functions. 5. There is no difference between the two statements; they are interchangeable. Sonata2
what is the difernece between named and anonymous pl/sql blocks?? TCS8
 
For more SQL PLSQL Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com