此处不允许使用列在多个列上使用Oracle SQL [英] Column not allowed here Oracle SQL on multiple columns

查看:61
本文介绍了此处不允许使用列在多个列上使用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';

这篇关于此处不允许使用列在多个列上使用Oracle SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆