SQL Invalid ALTER TABLE option

14.6k views Asked by At

With the following SQL statement:

ALTER TABLE USERS
    ADD LAST_LOGIN DATETIME() 

I am receiving the error below:

Error report -
SQL Error: ORA-01735: invalid ALTER TABLE option
01735. 00000 -  "invalid ALTER TABLE option"
*Cause:    
*Action:

I cannot for the life of me understand why SQLDeveloper does not like the fromatting of my rather simple alter table command.

1

There are 1 answers

0
Mr. Llama On BEST ANSWER

DATETIME is not a valid column data type. If you're trying to add a default value, you need to specify a DEFAULT.

If you are trying to use a date format, please use one of the datetime or interval data types. If you need to store date and time, the standard DATE format stores year, month, day, hour, minutes, and seconds.