RE: CURRENT_TIMESTAMP question
James <[email protected]>
| Newsgroups | gmane.comp.db.mckoi |
|---|---|
| Message-ID | <[email protected]> |
In your example you are using a PreparedStatement and
are passing the string literal "CURRENT_TIMESTAMP" via
setString() on statement object.
"CURRENT_TIMESTAMP" is of java type String whereas the
column in table is of type DATE. You needed to pass a
Timestamp java type, ie
statement.setTimestamp(6,dateCreated)
CURRENT_TIMESTAMP is a scalar function call, ie
returns a single value. It can only be invoked in the
context of a sql statement, not as a string passed as
parameter to a JDBC statement.
The following should work:
insert into "APP"."parameter"
("parameter_id","parameter_key","parameter","comment","updater_person_id","date_created","date_updated")
values (?,?,?,?,?, CURRENT_TIMESTAMP,?)
However, I like your option 1, in conjunction with
defining a default for that column in table. Like so:
, date_created TIMESTAMP DEFAULT current_timestamp
NOT NULL
, next_column
Best Regards, Jim
---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]