“命令行出错:1列:698错误报告 - SQL错误:ORA-00984:此处不允许列

时间:2016-08-29 18:38:05

标签: oracle

INSERT INTO 
FLAG ("OPT_FLAG_KEY","H_KEY","FIRST_NAME","LAST_NAME", 
      "MIDDLE_NAME","TITLE","CREDENTIALS","ADDRESS_LINE_1",
      "ADDRESS_LINE_2","ADDRESS_LINE_3","CITY","STATE",
      "POSTAL_CODE","PHONE_NUMBER","BUSIN_PHONE","DECEASED",
      "OPT_FLAG","OPT_FLAG_DATE","SOU_KEY","SOU_FILE_ID",
      "SOU_FILE_ID_TEXT","BAT_ID","PHONE_NUMBER_SOURCE","BIRTH_DATE")
VALUES(37009326,4,'Daniel','Boyle',NULL,NULL,NULL,'368  Road',
       NULL,NULL,'Doylown','BVBV',1801,NULL,NULL,'NO','OUT',
       TO_CHAR('10-AUG-16','DD/MM/YYYY'),201,
       TO_DATE(SUBSTR('vhic_pavir_20160810.txt',12,8),YYYYMMDD),
       '2016-08-10',598441,NULL,TO_DATE('03-FEB-1952',DD-MM-YYYY));

我在我的数据库中运行此查询时遇到如下错误

  

命令行错误:1列:698
  错误报告
  SQL错误:ORA-00984:此处不允许列
  00984. 00000 - “这里不允许列”   *原因:
  *行动:“

编辑:这是我对桌子的描述:

Name                Null Type          
------------------- ---- ------------- 
OPT_FLAG_KEY             NUMBER(14)    
H_KEY                    NUMBER(14)    
FIRST_NAME               VARCHAR2(50)  
LAST_NAME                VARCHAR2(50)  
MIDDLE_NAME              VARCHAR2(50)  
TITLE                    VARCHAR2(50)  
CREDENTIALS              VARCHAR2(50)  
ADDRESS_LINE_1           VARCHAR2(100) 
ADDRESS_LINE_2           VARCHAR2(100) 
ADDRESS_LINE_3           VARCHAR2(100) 
CITY                     VARCHAR2(50)  
STATE                    VARCHAR2(20)  
POSTAL_CODE              VARCHAR2(20)  
PHONE_NUMBER             VARCHAR2(100) 
BUSIN_PHONE              VARCHAR2(100) 
DECEASED                 VARCHAR2(5)   
OPT_FLAG                 VARCHAR2(10)  
OPT_FLAG_DATE            DATE          
SOU_KEY                  NUMBER(14)    
SOU_FILE_ID              DATE          
SOU_FILE_ID_TEXT         VARCHAR2(20)  
BATCH_ID                 NUMBER(14)    
PHONE_NUMBER_SOURCE      VARCHAR2(100) 
BIRTH_DATE               DATE   

1 个答案:

答案 0 :(得分:1)

您的陈述有几个问题。首先,列名称不需要双引号(除非你有混合的情况或空格),删除它们。

  • , - > TO_CHAR('10-AUG-16','DD/MM/YYYY')字符串,而非日期。因此,将字符串转换为字符串

  • 没有任何意义
  • 10-AUG-16 - >格式必须是单引号,即TO_DATE(SUBSTR('vhic_pavir_20160810.txt',12,8),YYYYMMDD)

  • '2016-08-10' - >你想插入TO_DATE(SUBSTR('vhic_pavir_20160810.txt',12,8),'YYYYMMDD')值或字符串吗?你提供了一个字符串,而不是日期。

  • DATE - >格式必须是单引号,见上文。 TO_DATE('03-FEB-1952',DD-MM-YYYY))表示月份编号,而不是月份名称。