通过 SQL 命令行创建表,标识符无效

Creating table via SQL Command Line, invalid identifier(通过 SQL 命令行创建表,标识符无效)
本文介绍了通过 SQL 命令行创建表,标识符无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在学习 SQL,并且我已经在我的系统上安装了 oracle 11g express.我正在尝试创建一个表,但是当我尝试运行以下命令时,我收到以下错误消息:

I'm currently learning SQL and I've installed oracle 11g express on my system. I'm trying to create a table however when I try to run the below command I get the following Error Message:

第 3 行的错误:ORA-00904 : 无效标识符

ERROR at line 3: ORA-00904 : invalid identifier

CREATE TABLE PROJECTS (
    proID       NUMBER(4) NOT NULL,
    Desc        CHAR(20),
    sDate       DATE,
    eDate       DATE,
    Budget      NUMBER(7,2),
    maxStaff    NUMBER(2)
);

谁能告诉我我做错了什么?

Can anybody please tell me what I'm doing wrong?

感谢大家的回复,我成功运行了这个命令:

Thanks for all the replies, I ran this command succesfully:

CREATE TABLE PROJECTS (
    proID       NUMBER(4) NOT NULL,
    description CHAR(20),
    sDate       DATE,
    eDate       DATE,
    Budget      NUMBER(7,2),
    maxStaff    NUMBER(2)
);

真的很感谢快速回复!

克里斯

推荐答案

您将 DESC 作为列名.虽然您可以使用它,但您必须将其括在引号中:

You have DESC in as a column name. While you can use it you will have to encompass it in quotes:

CREATE TABLE PROJECTS (
    proID       NUMBER(4) NOT NULL,
    "Desc"        CHAR(20),
    sDate       DATE,
    eDate       DATE,
    Budget      NUMBER(7,2),
    maxStaff    NUMBER(2)
);

每次在查询中调用它时都必须使用引号.我建议将该列更改为其他内容(也许是 DESCRIPTION?)

You will also have to use quotes every time you call it in a query. I recommend just changing that column to something else (maybe DESCRIPTION?)

这篇关于通过 SQL 命令行创建表,标识符无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)