我正在尝试将记录插入表中,当我插入此记录时,我的“项目评级列”(下例中的“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”时,它会在“美国棒球经典赛”中引发错误。
这是怎么回事?
答案 0 :(得分:3)
PG
是双引号,表示它不是字符串。字符串由SQL中的单引号分隔。但我建议将其写成:
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';