我试图将记录插入表中,并且在插入此记录时,我的“项目评分列”(在下面的示例中为“ PG”)出现“此处不允许列”错误:
INSERT INTO ITEM VALUES ( item_s1.NEXTVAL , '786936161878' , (SELECT common_lookup_id FROM common_lookup WHERE common_lookup_type = 'DVD_WIDE_SCREEN') , "The Sandlot" , "American Baseball Classic" , "PG" , TO_DATE('1993/04/01 01:00:00', 'yyyy/mm/dd hh24:mi:ss') , 1 , SYSDATE , 1 , SYSDATE );
但是当我拿出“ PG”时,它在“美国棒球经典赛”上引发了错误。 这里发生了什么?
PG用双引号引起来,这意味着它不是字符串。字符串在SQL中用单引号分隔。但我建议将其编写为:
PG
INSERT INTO ITEM ( list the columns here) SELECT item_s1.NEXTVAL, '786936161878', common_lookup_id, 'The Sandlot', 'American Baseball Classic', 'PG', TO_DATE('1993/04/01 01:00:00', 'yyyy/mm/dd hh24:mi:ss'), 1, SYSDATE, 1, SYSDATE FROM common_lookup WHERE common_lookup_type = 'DVD_WIDE_SCREEN';