Re: Trigger HELP
[email protected] Thu, 24 Apr 2003 10:19:30 +0100
| Newsgroups | gmane.comp.db.oracle.devel |
|---|---|
| Message-ID | <LYRIS-1796914-958249-2003.04.24-10.19.08--gcdod-oracle#[email protected]> |
Inserting sysdate into a date field will automatically insert the time =
too.
create table mydates ( mydate date )
/
insert into mydates values ( sysdate )
/
Just selecting the mydate will produce the following result ( depending=
on
the default date format of your instance )
select mydate from mydates
/
24-APR-2003
But if you explicitly define the required format on your select you can=
get
this
select to_char(mydate,'dd mon yyyy hh24:mi') from mydates
/
24 apr 2003 10:15
Regards
Chris Farmer
=
=20
"Leonard Anukam" =
=20
<leonardanukam@ho To: "Oracle" <orac=
[email protected]> =20
tmail.com> cc: =
=20
Subject: [oracle] Re: T=
rigger HELP =20
24/04/2003 10:04 =
=20
Please respond to =
=20
"Oracle" =
=20
=
=20
=
=20
Yes it works like this, but want it=A0 like to_char(sysdate, 'DD-MON-YY=
YY
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:=3Dsysdate; the it connects agai=
n to
the procedure page and inserts into the database.
HERE IS MY PROCEDURE
CREATE OR REPLACE PROCEDURE contactus(=A0 p_name varchar2 DEFAULT NULL,=
p_email varchar2 DEFAULT NULL) AS=A0 personal_infor varchar2(1000);=A0B=
EGINif
p_name IS NOT NULL and p_email IS NOT NULL and p_email LIKE '%@%.%' and=
length(p_email)>5then
=A0=A0=A0=A0 insert into visitors(name, email)=A0=A0=A0=A0 values(p_nam=
e, p_email);
=A0 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=3D"
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)=A0=A0=A0=A0=A0 OR (p_name I=
S NOT NULL and
p_email IS NULL )=A0=A0=A0=A0=A0 =A0=A0=A0=A0=A0 OR (p_email NOT LIKE '=
%@%.%' and
length(p_email) <5) then
htp.prn('<p><center><b><font color =3D "RED">Please NOTE! All fields ar=
e
required</font></b></center>');
end if;
=A0=A0=A0=A0 htp.formopen('chukws.contactus', 'GET');
htp.prn('<center><p><H1>Please fill the form
below</H1></center>=A0<html><head>
<body bgcolor=3D"#FFFFCC">
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <table border =3D 0 align=3Dcen=
ter>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <tr>
<p><td><b>Enter Your Name:</b></td></tr>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0 <tr><td><input type
=3D"text" size =3D 15 name=3D"p_name"><font
color=3D"red"><small>*Required</small></font></td></tr>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <p><tr><td><b>Enter Your Ema=
il Address:</b></td></tr>
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <tr><td><input type=3D"te=
xt" size=3D30 name=3D"p_email"><font
color=3D"red"><small>*Required</small></font></tr></table><br>');
=A0=A0 htp.formSubmit(NULL, 'Submit');=A0 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 s=
et
:new.date_created =3D 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 :=3D 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.unsub%%.=
=
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to [email protected].