我将一个insert语句传递给我的db,如下所示
INSERT INTO W_GL_BALANCE_FS(BUSN_AREA_ORG_ID,GL_ACCOUNT_ID,BALANCE_DATE,DB_CR_IND,BALANCE_ACCT_AMT,BALANCE_LOC_AMT,ACTIVITY_ACCT_AMT,ACTIVITY_LOC_AMT,ACCT_CURR_CODE,LOC_CURR_CODE,INTEGRATION_ID,DATASOURCE_NUM_ID,TENANT_ID,X_CUSTOM,ADJUSTMENT_FLAG,BALANCE_TYPE_FLAG,TRANSLATED_FLAG,SUMMARY_ACCOUNT_FLAG,LAST_UPDATE_DATE,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,LEDGER_ID)
VALUES ( "-1"
,"1004",
"07/31/2013 00:00:00.000000000",
"DEBIT",
"0.00000000000000",
"1.68195141463052e+18",
"0.00000000000000",
"0.00000000000000",
"NULL",
"AED",
"GL~1002~1004~JUL-13~DEBIT~A~N~AED~NULL~",
"90.00000000000000",
"DEFAULT",
"(NULL)",
"N",
"A",
"N",
"N",
"08/12/2013 11:14:06.000000000",
"10/15/2013 00:00:00.000000000",
"07/05/2012 15:04:22.000000000",
"1002")
但显示错误
Error starting at line 1 in command:
INSERT INTO W_GL_BALANCE_FS(BUSN_AREA_ORG_ID,GL_ACCOUNT_ID,BALANCE_DATE,DB_CR_IND,BALANCE_ACCT_AMT,BALANCE_LOC_AMT,ACTIVITY_ACCT_AMT,ACTIVITY_LOC_AMT,ACCT_CURR_CODE,LOC_CURR_CODE,INTEGRATION_ID,DATASOURCE_NUM_ID,TENANT_ID,X_CUSTOM,ADJUSTMENT_FLAG,BALANCE_TYPE_FLAG,TRANSLATED_FLAG,SUMMARY_ACCOUNT_FLAG,LAST_UPDATE_DATE,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,LEDGER_ID)
VALUES ( "-1"
,"1004",
"07/31/2013 00:00:00.000000000",
"DEBIT",
"0.00000000000000",
"1.68195141463052e+18",
"0.00000000000000",
"0.00000000000000",
"NULL",
"AED",
"GL~1002~1004~JUL-13~DEBIT",
"90.00000000000000",
"DEFAULT",
"(NULL)",
"N",
"A",
"N",
"N",
"08/12/2013 11:14:06.000000000",
"10/15/2013 00:00:00.000000000",
"07/05/2012 15:04:22.000000000",
"1002")
Error at Command Line:23 Column:1
Error report:
SQL Error: ORA-00984: column not allowed here
00984. 00000 - "column not allowed here"
*Cause:
*Action:
Error starting at line 1 in command:
INSERT INTO W_GL_BALANCE_FS(BUSN_AREA_ORG_ID,GL_ACCOUNT_ID,BALANCE_DATE,DB_CR_IND,BALANCE_ACCT_AMT,BALANCE_LOC_AMT,ACTIVITY_ACCT_AMT,ACTIVITY_LOC_AMT,ACCT_CURR_CODE,LOC_CURR_CODE,INTEGRATION_ID,DATASOURCE_NUM_ID,TENANT_ID,X_CUSTOM,ADJUSTMENT_FLAG,BALANCE_TYPE_FLAG,TRANSLATED_FLAG,SUMMARY_ACCOUNT_FLAG,LAST_UPDATE_DATE,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,LEDGER_ID)
VALUES ( "-1"
,"1004",
"07/31/2013 00:00:00.000000000",
"DEBIT",
"0.00000000000000",
"1.68195141463052e+18",
"0.00000000000000",
"0.00000000000000",
"NULL",
"AED",
"GL~1002~1004~JUL-13~DEBIT~A~N~AED~NULL~",
"90.00000000000000",
"DEFAULT",
"(NULL)",
"N",
"A",
"N",
"N",
"08/12/2013 11:14:06.000000000",
"10/15/2013 00:00:00.000000000",
"07/05/2012 15:04:22.000000000",
"1002")
Error at Command Line:12 Column:1
Error report:
SQL Error: ORA-00972: identifier is too long
00972. 00000 - "identifier is too long"
*Cause: An identifier with more than 30 characters was specified.
*Action: Specify at most 30 characters.
我的桌子的desc如下
desc w_gl_balance_fs
Name Null Type
-------------------- -------- ------------------
COMPANY_ORG_ID VARCHAR2(80 CHAR)
BUSN_AREA_ORG_ID NOT NULL VARCHAR2(80 CHAR)
GL_ACCOUNT_ID NOT NULL VARCHAR2(240 CHAR)
BALANCE_DATE DATE
DB_CR_IND VARCHAR2(10 CHAR)
BALANCE_ACCT_AMT NUMBER(28,10)
BALANCE_LOC_AMT NUMBER(28,10)
ACTIVITY_ACCT_AMT NUMBER(28,10)
ACTIVITY_LOC_AMT NUMBER(28,10)
ACCT_CURR_CODE NOT NULL VARCHAR2(30 CHAR)
LOC_CURR_CODE NOT NULL VARCHAR2(30 CHAR)
INTEGRATION_ID NOT NULL VARCHAR2(150 CHAR)
DATASOURCE_NUM_ID NOT NULL NUMBER(10)
ETL_PROC_WID NUMBER(10)
TENANT_ID VARCHAR2(80 CHAR)
X_CUSTOM VARCHAR2(10 CHAR)
ADJUSTMENT_FLAG VARCHAR2(1 CHAR)
BALANCE_TYPE_FLAG VARCHAR2(1 CHAR)
TRANSLATED_FLAG VARCHAR2(1 CHAR)
SUMMARY_ACCOUNT_FLAG VARCHAR2(1 CHAR)
CREATED_ON_DT DATE
LAST_UPDATE_DATE DATE
AUX1_CHANGED_ON_DT DATE
AUX2_CHANGED_ON_DT DATE
AUX3_CHANGED_ON_DT DATE
AUX4_CHANGED_ON_DT DATE
LEDGER_ID VARCHAR2(80 CHAR)
PROFIT_CENTER_ID VARCHAR2(80 CHAR)
BALANCE_ID VARCHAR2(240 CHAR)
答案 0 :(得分:2)
使用单引号而不是双引号。您还应该使用to_date
来插入日期值:
INSERT INTO W_GL_BALANCE_FS (BUSN_AREA_ORG_ID,GL_ACCOUNT_ID,BALANCE_DATE,DB_CR_IND,BALANCE_ACCT_AMT,BALANCE_LOC_AMT,ACTIVITY_ACCT_AMT,ACTIVITY_LOC_AMT,ACCT_CURR_CODE,LOC_CURR_CODE,INTEGRATION_ID,DATASOURCE_NUM_ID,TENANT_ID,X_CUSTOM,ADJUSTMENT_FLAG,BALANCE_TYPE_FLAG,TRANSLATED_FLAG,SUMMARY_ACCOUNT_FLAG,LAST_UPDATE_DATE,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,LEDGER_ID)
VALUES ( '-1'
,'1004',
to_date('07/31/2013','dd/mm/yyyy hh24:mi:ss'),
'DEBIT',
'0.00000000000000',
'1.68195141463052e+18',
'0.00000000000000',
'0.00000000000000',
'NULL',
'AED',
'GL~1002~1004~JUL-13~DEBIT~A~N~AED~NULL~',
'90.00000000000000',
'DEFAULT',
'(NULL)',
'N',
'A',
'N',
'N',
to_date('08/12/2013 11:14:06','dd/mm/yyyy hh24:mi:ss'),
to_date('10/15/2013','dd/mm/yyyy'),
to_date('07/05/2012 15:04:22','dd/mm/yyyy hh24:mi:ss'),
'1002')
答案 1 :(得分:0)
您需要将字符串值括在single quote('')
示例:
INSERT INTO mytable(column1) values('col1 value');