此处不允许使用列在多个列上使用Oracle SQL

问题描述:

我正在尝试将记录插入表中,并且在我插入此记录时,我的项目评分列"(在下面的示例中为"PG")出现此处不允许列"错误:

I'm trying to insert records into a table, and I'm getting a "column not allowed here" error on my "item rating column" ("PG" in the example below) when I'm inserting this record:

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"时,它会在"American Baseball Classic"上引发错误.
这是怎么回事?

But when I take out the "PG", it throws the error on the "American Baseball Classic".
What's going on here?

PG用双引号引起来,这意味着它不是字符串.字符串在SQL中用单引号分隔.但我建议将其写为:

PG is in double quotes, which means it is not a string. Strings are delimited by single quotes in SQL. But I would recommend writing this as:

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';