problem with inserting a casted interval literal into a teradata 13.0 database using ODBCtest

StackOverflow https://stackoverflow.com/questions/6349551

  •  27-10-2019
  •  | 
  •  

Question

I am trying to execute this query:

INSERT INTO SEN.Interval_Day_Minute_Table VALUES('NegativeIntervalDay', CAST(INTERVAL -'200 5' DAY TO HOUR AS INTERVAL DAY (4) TO MINUTE))

into a teradata database using ODBCtest, and I get the following error:

SQLExecDirect:
                In:             Statementhandle = 0x000000000053C270, StatementText = "INSERT INTO SEN.Interval_Day_Minute_Table VALUES('...", Statementlength = 142
                Return: SQL_ERROR=-1
                stmt:       szSqlState = "37000", *pfNativeError = -3706,                       szErrorMsg = "[Teradata][ODBC Teradata Driver][Teradata Database] Syntax error: Invalid INTERVAL Literal. "

The table was created with:

CREATE TABLE SEN.Interval_Day_Minute_Table(
KeyColumn CHAR (255) CHARACTER SET UNICODE,
Column1 INTERVAL DAY (4) TO MINUTE)

I'm new to Teradata, but as far as I can tell, I'm using the correct syntax.

Was it helpful?

Solution

the problem was that the 'hours' portion of the string had to be two digits, so -'200 05' rather than -'200 5'.

whoops

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top