我试图将数据插入到现有表中,并不断收到错误.

INSERT INTO Patient  
(
  PatientNo,
  PatientFirstName,
  PatientLastName,
  PatientStreetAddress,
  PatientTown,
  PatientCounty,
  PatientPostcode,
  DOB,
  Gender,
  PatientHomeTelephoneNumber,
  PatientMobileTelephoneNumber
)
VALUES 
(
  121, 
  'Miles', 
  'Malone', 
  '64 Zoo Lane', 
  'Clapham', 
  'United Kingdom',
  'SW4 9LP',
  '1989-12-09',
  'M',
  02086950291,
  07498635200
);

错误:

Error starting at line : 1 in command -
INSERT INTO Patient (PatientNo,PatientFirstName,PatientLastName,PatientStreetAddress,PatientTown,PatientCounty,PatientPostcode,DOB,Gender,PatientHomeTelephoneNumber,PatientMobileTelephoneNumber)
VALUES (121, 'Miles', 'Malone', '64 Zoo Lane', 'Clapham', 'United Kingdom','SW4 9LP','1989-12-09','M',02086950291,07498635200)
Error report -
SQL 错误: ORA-01861: literal does not match format string
01861. 00000 -  "literal does not match format string"
*Cause:    Literals in the input must be the same length as literals in
           the format string (with the exception of leading whitespace).  If the
           "FX" modifier has been toggled on, the literal must match exactly,
           with no extra whitespace.
*Action:   Correct the format string to match the literal.

只是不知道为什么会发生这种情况我正在学习SQL,任何帮助都将不胜感激!

推荐答案

try 将日期'1989-12-09'的字符串文字替换为TO_DATE('1989-12-09','YYYY-MM-DD')

Sql相关问答推荐

数据子集的左连接

需要解决办法通过传递过程参数而不是声明表行类型来声明表类型

Oracle SQL对列进行汇总并在列表底部显示总计

Android房间fts4匹配语法AND OR

如何利用单列历史SQLsnowflake获得合并结果

SQL:如何将相应位置的两个数组中的元素组合在一起

如何根据行状态设置正确的标志

将FLOAT转换为VARBINARY,然后再转换回FLOAT

同一表的Oracle SQL更新(含YTD合计)

当 ansible 变量未定义或为空时,跳过 sql.j2 模板中的 DELETE FROM 查询

如何在Hive SQL中分别按多列进行分组?

POSTGRES to_timestamp() 假定 UTC 字符串为本地时间

如何在 SQL Server 中解决这个复杂的窗口查询?

获取上个月和上一年的值

如何从postgresql中的项目映射(关联数组)设置值?

snowflake中的动态文件名生成

强制 SQL 始终通过 R 从视图中返回至少一行

T-SQL 查询计算日期在其他列中定义的日期之间绑定的行数

SQL Server Where 条件

使用一组值进行分组和计数