Oracle SQL:不允许使用列 [英] Oracle SQL: Column not allowed

查看:88
本文介绍了Oracle SQL:不允许使用列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个表:

CREATE TABLE AIRLINE (
    airline_code        NUMBER(4) PRIMARY KEY NOT NULL,
    airline_name        VARCHAR(29) NOT NULL,
    airline_address1    VARCHAR(29) NOT NULL,
    airline_address2    VARCHAR(29),
    airline_postcode    VARCHAR(29),
    airline_city        VARCHAR(29) NOT NULL,
    airline_country     VARCHAR(29) NOT NULL
);

当我插入此Insert语句时:

And when I insert this Insert statement:

INSERT INTO AIRLINE (airline_code, airline_name, airline_address1, airline_address2, airline_postcode, airline_city, airline_country)
VALUES ("BA07", "British Airways PLC", "Waterside", "PO Box 365, Harmondsworth", "UB7 0GB", "London", "United Kingdom");

据我所知,有一个错误指向英国,说此处不允许使用列",据我所知,表中插入的列数与表中插入的数据相同.

I get an error pointing to United Kingdom saying 'column not allowed here', as far as I'm aware there's the same number of columns as there is data being inserted into the table.

推荐答案

双引号通常用于对象名称(例如,列名"First name").这是SQL-92标准的一部分.

Double quotes are usually used to object names (e.g. column name "First name"). That is part of SQL-92 standard.

在ANSI SQL中,双引号引起了对象名称(例如表)的引用,这使它们可以包含其他不允许的字符,或者与保留字相同(实际上避免使用此字符).

In ANSI SQL, double quotes quote object names (e.g. tables) which allows them to contain characters not otherwise permitted, or be the same as reserved words (Avoid this, really).

单引号用于字符串.

INSERT INTO AIRLINE (airline_code, airline_name, airline_address1, 
airline_address2, airline_postcode, airline_city, airline_country)
VALUES ('BA07', 'British Airways PLC', 'Waterside', 'PO Box 365, 
Harmondsworth', 'UB7 0GB', 'London', 'United Kingdom');

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

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