Hi Cezar,
The SYSDATE function is Oracle specific. To do something similar with just JDBC try:
String sql = "insert into emp (id, name, createdate) values (?,?,?)";
PreparedStatement s = con.prepareStatement(sql);
s.setInt(1, 15);
s.setString(2, "Cezar");
s.setDate(3, new java.sql.Date());
s.execute();
Regards,
Bob
-------------------------------------------------------------------------------------------
Bob Withers Two things are infinite: the universe
and
[EMAIL PROTECTED] human stupidity, and I'm not sure about
http://www.pobox.com/~bwit the universe. - Albert Einstein
-------------------------------------------------------------------------------------------
----- BEGIN GEEK CODE BLOCK -----
Version 3.1 http://www.geekcode.com
GCS d- s: a+ C++ UO++ P L++ E--- W++ N++ o-- w++
O M V- PS PE Y+ PGP t+ 5 X++ r* tv+ b++ DI++ D--- G
e++ h--- r+++ y+++
----- END GEEK CODE BLOCK -----
On Monday, July 19, 1999 3:53 AM, Cezar Totth [SMTP:[EMAIL PROTECTED]] wrote:
> Hi,
>
> I need to know, is this example standard SQL or is it Oracle specific.
> (e.g. "SYSDATE" function ?)
>
> Thanks,
> Cezar.
>
> On Mon, 12 Jul 1999, Chris Pratt wrote:
>
> > When you create or alter the table, use DEFAULT SYSDATE something like this:
> >
> > CREATE TABLE EMPLOYEES
> > (
> > ID CHARACTER VARYING(21) NOT NULL,
> > NAME CHARACTER VARYING NOT NULL,
> > CREATIONTIME DATE DEFAULT SYSDATE
> > );
> >
> > Then you don't have to do anything in the java program, simply use a
> > statement like
> >
> > INSERT INTO EMPLOYEES (ID, NAME) VALUES ('E15','Wilson P');
> > (*Chris*)
> >
> > ----- Original Message -----
> > From: Wilson. P <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, July 12, 1999 11:37 PM
> > Subject: Re: How do I set the current date thru JDBC.
> >
> >
> > > I'm using 'Prepared statement' only. But, I how to set the default date?..
> > >
> > > wilson
> > >
> > > Chris Pratt wrote:
> > >
> > > > The easiest way is to use a PreparedStatement and the setDate method.
> > > > (*Chris*)
> > > >
> > > > ----- Original Message -----
> > > > From: Wilson. P <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, July 12, 1999 9:00 PM
> > > > Subject: How do I set the current date thru JDBC.
> > > >
> > > > > Hi all
> > > > >
> > > > > I have setTime() function. But, I don't know how to get the current
> > date
> > > > > to set into the Oracle database.
> > > > >
> > > > > bye
> > > > > wilson
> > > > >
> > > > > --
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > ___________________________________________________________________________
> > > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > > > of the message "signoff SERVLET-INTEREST".
> > > >
> > > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> > >
> > > --
> > >
> > >
> > >
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html