Re: Trigger HELP

"Leonard Anukam" <[email protected]> Thu, 24 Apr 2003 12:04:51 +0300
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-958227-2003.04.24-10.00.36--gcdod-oracle#[email protected]>
Yes it works like this, but want it  like to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS')
This also compiles, but fails to connect to the procedure page that has the link to the website, when i try to access the page. 
but when I revise to :new.date_created:=sysdate; the it connects again to the procedure page and inserts into the database.
HERE IS MY PROCEDURE
CREATE OR REPLACE PROCEDURE contactus(  p_name varchar2 DEFAULT NULL,   p_email varchar2 DEFAULT NULL) AS  personal_infor varchar2(1000); BEGINif p_name IS NOT NULL and p_email IS NOT NULL and p_email LIKE '%@%.%' and length(p_email)>5then
 
     insert into visitors(name, email)     values(p_name, p_email);
  htp.prn('<p>Hello ' || p_name ||'<br>'|| ' Your email address is ' || p_email || '.' ||'<br>'||' You visited today ' || to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') ||'<br>'|| '<a href="http://www.netikka.net/leo/Frameset.html">Click here to Continue</a>');
 
RETURN;END IF;
if (p_name IS NULL and p_email IS NOT NULL)      OR (p_name IS NOT NULL and p_email IS NULL )            OR (p_email NOT LIKE '%@%.%' and length(p_email) <5) then
 
htp.prn('<p><center><b><font color = "RED">Please NOTE! All fields are required</font></b></center>');
 
end if;
     htp.formopen('chukws.contactus', 'GET');     htp.prn('<center><p><H1>Please fill the form below</H1></center> <html><head>
 
 
<body bgcolor="#FFFFCC">
              <table border = 0 align=center>              <tr>              <p><td><b>Enter Your Name:</b></td></tr>              <tr><td><input type ="text" size = 15 name="p_name"><font color="red"><small>*Required</small></font></td></tr>
               <p><tr><td><b>Enter Your Email Address:</b></td></tr>
                <tr><td><input type="text" size=30 name="p_email"><font color="red"><small>*Required</small></font></tr></table><br>');
 
 
 
   htp.formSubmit(NULL, 'Submit');  htp.formClose;END;
put i will like to see also the time of the visit by the visitor.
 
As water reflects a face so do a man's heart reflects the man 



From: [email protected] 
Reply-To: "Oracle" 
To: "Oracle" 
Subject: [oracle] Re: Trigger HELP 
Date: Thu, 24 Apr 2003 09:44:39 +0100 


If you have defined date_created as a date then you should be able to set 

:new.date_created = sysdate; 

Regards 
Chris Farmer 




"leonard Anukam" 

tmail.com> cc: 
Subject: [oracle] Trigger HELP 
23/04/2003 20:40 
Please respond to 
"Oracle" 






I have a table in which I will want a date and time to be stored when a 
visitor visits my site and fills the form. I have a trigger that 
automatically inserts the date, but the time. 
http://www.netikka.net/leo 
Here is my code 

create or replace trigger visitor_date_created 
before insert on visitors 
for each row 
begin 
:new.date_created := to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS'); 
end; 

But this returns an error. 

Please give you solution 

thanks 

Leonard 

--- 
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%. 






--- 
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%. 
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*

---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].