oracle SQL 无效的 ALTER TABLE 选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30764774/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:54:10  来源:igfitidea点击:

SQL Invalid ALTER TABLE option

sqloracledatetimeaddalter-table

提问by Sean

With the following SQL statement:

使用以下 SQL 语句:

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.

我一生都无法理解为什么 SQLDeveloper 不喜欢我相当简单的 alter table 命令的 fromatting。

采纳答案by Mr. Llama

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

DATETIME不是有效的列数据类型。如果您尝试添加默认值,则需要指定一个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 DATEformat stores year, month, day, hour, minutes, and seconds.

如果您尝试使用日期格式,请使用日期时间或间隔数据类型之一。如果需要存储日期和时间,标准DATE格式存储年、月、日、小时、分钟和秒。