ORA-00957: duplicate column name 建表报错,但是列名没有问题

一根飘逸的胸毛 2014-12-12 02:26:36
create table student
(
学号 varchar2(15),
姓名 varchar2(15) not null,
性别 varchar2(5) not null,
年龄 number,
种族 varchar2(20) default '汉族' not null,
出生日期 date not null,
入学日期 date not null,
constraint idnum_pk primary key(学号)
)
本人用的是PL/SQL,这是在新建的用户中,执行建表语句,SQL应该没有错误吧,不知道问什么老是报错:

ORA-00957: duplicate column name

请各位牛大哥解决下,急急急!!
小弟在此谢过了
...全文
2370 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
huangdh12 2014-12-12
  • 打赏
  • 举报
回复
建议像字段名,过程等名字 都还是用英文吧。 不然很多时候都会要用双引号。
  • 打赏
  • 举报
回复
字段换成英文就好了

  • 打赏
  • 举报
回复
我试试,谢谢啦
CT_LXL 2014-12-12
  • 打赏
  • 举报
回复
我的数据库就不支持中文字符的:

SQL> create table student
  2   (
  3  "学号" varchar2(15),
  4  "姓名" varchar2(15) not null,
  5  "性别" varchar2(5) not null,
  6  "年龄" number,
  7  "种族" varchar2(20) default '汉族' not null,
  8  "出生日期" date not null,
  9  "入学日期" date not null,
 10   constraint idnum_pk primary key("学号")
 11   )
 12  ;
create table student
 (
"??" varchar2(15),
"??" varchar2(15) not null,
"??" varchar2(5) not null,
"??" number,
"??" varchar2(20) default '??' not null,
"????" date not null,
"????" date not null,
 constraint idnum_pk primary key("??")
 )
ORA-00957: duplicate column name

SQL> 
CT_LXL 2014-12-12
  • 打赏
  • 举报
回复
引用 楼主 w458068305 的回复:
小弟在此谢过了
很有可能是你数据库不支持中文字符,你把列名改成英文字符吧
bw555 2014-12-12
  • 打赏
  • 举报
回复
语句没问题啊
SQL> create table student
  2  (
  3  学号 varchar2(15),
  4  姓名 varchar2(15) not null,
  5  性别 varchar2(5) not null,
  6  年龄 number,
  7  种族 varchar2(20) default '汉族' not null,
  8  出生日期 date not null,
  9  入学日期 date not null,
 10  constraint idnum_pk primary key(学号)
 11  );

表已创建。

SQL>
Oracle SQL Developer, v1.5.0.54.40 Release Notes 完整版下载:http://www.oracle.com/technology/global/cn/software/products/sql/index.html 1. Known Issues 1.1 General - Print prints only one page that is a truncation of the current tab. - Can't invoke SQL*Plus on Windows 2003. - The menu item, and right-click off a Connection node, for invoking SQL*Plus does not work with connections whose passwords are not persisted. 1.2 Connections - Cannot connect to remote database as OPS$ account. 1.3 Browse - If connected as sys with sysdba role, Types node displays built in data-types (e.g. BLOB, DATE, DECIMAL, etc.) If clicked on, will only see "create or replace". 1.4 Creating and Modifying Objects - Editing Triggers - If you have comments before the 'BEGIN' they will be lost if you edit. You will see when you click edit that they will not be there. To preserve them, they need to be below the BEGIN or you will need to edit via the SQL Worksheet. 1.5 Table > Data - Tables > Your_Table > Data - PageUp and PageDown buttons not working correctly if cursor is in the rownum column. 1.6 Export - Cannot export if result set contains duplicate column names. 2. Workarounds 2.1 To disable Code Insight Run SQL Developer from a command line using the following statement: Windows : sqldeveloper -J-Dsdev.insight=false Linux or Mac: Run sh sqldeveloper -J-Dsdev.insight=false or edit sqldeveloper.conf and add "AddVMOption -J-Dsdev.insight=false" 2.2 If DDL tab is null for all objects in a Connection Your dbms_metadata might be loaded incorrectly. If this statement fails when executed in a SQL Worksheet against the Connection select dbms_metadata.get_ddl('TABLE',table_name , user ) from user_tables; You need to reload $ORACLE_HOME/rdbms/admin/catmeta.sql 2.3 If Snippets are not accessible You may have not done a clean install. SQL Developer needs to be installed into a clean directory, not over a previous release. 3. Accessibility Issues The following is a li

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧