Re: Trigger HELP

"Leonard Anukam" <[email protected]> Thu, 24 Apr 2003 13:54:07 +0300
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-958351-2003.04.24-11.49.52--gcdod-oracle#[email protected]>
 Name                                      Null?    Type ----------------------------------------- -------- --------------------- ID                                        NOT NULL NUMBER NAME                                      NOT NULL VARCHAR2(50) EMAIL                                     NOT NULL VARCHAR2(1000) DATE_CREATED                              NOT NULL DATE
Here is the table. The date_created column has a date datatype. I think what happens is that at the PROCEDURE I codes something like this  "'You visited today '|| to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS'); which shows the the time he/she arrivals at that page and other info the user has entered. Please visit the site to see what I mean. when yo submit the for the PROCEDURE recall it self displaying to you the infomation that you supplied with date and time. put it only insert the date into the datebase. I what if possible to see the time when I query the database as well. I hope you understand me.As water reflects a face so do a man's heart reflects the man 



From: "Tony Andrews" 
Reply-To: "Oracle" 
To: "Oracle" 
Subject: [oracle] Re: Trigger HELP 
Date: Thu, 24 Apr 2003 10:41:41 

> Yes it works like this, but want it like to_char(sysdate, 'DD-MON-YYYY 
HH24:MI:SS') 

No, you don't. If you follow c.r.farmer's correct advice you WILL be 
storing the date and time that you want. By using TO_CHAR you are causing 
Oracle to convert the character string back to a DATE before assigning it 
to the column. Oracle will use the default format mask (probably DD-MON- 
RR) which does NOT have a time component and so will get an error like: 

ORA-01830: date format picture ends before converting entire input string 

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; 

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. 

--- 
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%. 
Help STOP 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].