Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jdbc error - [NCR] : Syntax error: Invalid TimeStamp Literal.

Status
Not open for further replies.

ritayung

Programmer
Apr 27, 2001
2
US
Can anyone help?
The following syntax works against Sybase, Oracle..MSSQL but I'm getting the following error against Teradata.

[NCR] : Syntax error: Invalid TimeStamp Literal.



static String insert_bf_query = "INSERT INTO bf_query " +
"(query_name, source, product, description, sql_text, last_update_date) " +
"VALUES " +
"(?,?,?,?,?,?)";

Date dateNow = new Date();
Calendar cal = Calendar.getInstance();

cal.setTime(dateNow);
long millis = cal.getTime().getTime();
System.out.println("millis "+ millis);
try
{
System.out.println("Creating the table");
// stmt.executeUpdate (query1);
stmt.close();
}
catch (SQLException ex)
{
SQLHandler(ex);
}
try
{
PreparedStatement pstmt = con.prepareStatement(insert_bf_query);
pstmt.setString(1, "query_name1");
pstmt.setString(2, "Q");
pstmt.setString(3, "product");
pstmt.setString(4, "description");
pstmt.setString(5, "local_sql_text");
pstmt.setTimestamp(6, new java.sql.Timestamp();


int rows_inserted = pstmt.executeUpdate();
}
 
Hi,
What is the definition if the BASE table field? Maybe the JDBC Timestamp isn't compatable with the Teradata Field.

Is it a timestamp(0), timestamp(6), date, time?
 
Hi,
this is a duplicate POST. I didn't realize the answer had already been given Here is the note from the other Thread.

seidub (TechnicalUser) May 18, 2001
Check the Teradata manuals for date datatype.
In teradata the format and precision for current_timestamp is different from the Oracle timestamp.
For example on Teradata
(1) Select current_timestamp; yields something like
2001-05-18 08:49:42.3+00:00
and in Oracle,
Select sysdate from dual; displays
2001-05-18 08:38:59
try ... select cast(current_timestamp as timestamp)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top