Oracle 新建数据表 第 2 行出现错误: ORA-00907: 缺失右括号
auto_increment是mysql中的参数,oracle中没有这个参数的。 如果你的oracle版本是12c,那么可以用GENERATED XXXXX AS IDENTITY(XXXX的内容根据自己的需要填写,比如always或者by default等) 如果不是版本12c,那么就没有直接的这个参数,你要建立序列和触发器,来解决。

oracle 缺失右括号
select *from t_portal_xzxkorder by publish_date desc where company_name=${query}这个地方,首先,oracle子查询不支持排序,另外,你语法没学好,排序应该在语句的最后,你放到where前是啥意思?

ORACLE右括号缺失
deptno NUMBER(2) 因为这一行的错误,应该是:deptno NUMBER(2) references dept 或者 deptno NUMBER(2) references dept(deptno) 你仅写了foreign key,就不知道你想参考哪个表(主键)了还有另外一种写法,你将foreign key去掉,在最后一行的右括号前 constraint fk_emp_deptno foreign key (deptno) references dept(或者dept(deptno),这个deptno可以省略,因为一个表只能有一个主键)
CREATE TABLE emp( empno NUMBER(4) PRIMARY KEY, ename VARCHAR2(10), job VARCHAR2(9), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), mgr NUMBER(4), deptno NUMBER(2), FOREIGN KEY(deptno) REFERENCES user_dept(deptno), photo VARCHAR2(100), note CLOB, lockflag NUMBER(2) DEFAULT 1);emp表建外键要关联user_dept 表的主键,并且user_dept 表应该先存在。例如:CREATE TABLE emp( empno NUMBER(4) PRIMARY KEY, ename VARCHAR2(10), job VARCHAR2(9), hiredate DATE, sal NUMBER(7,2), comm NUMBER(7,2), mgr NUMBER(4), deptno NUMBER(2), FOREIGN KEY(deptno) REFERENCES user_dept(deptno), photo VARCHAR2(100), note CLOB, lockflag NUMBER(2) DEFAULT 1);create table user_dept(deptno number primary key,name varchar2(20),salary number(10,2),record varchar2(10),higher varchar(10)); 如果可以请采纳!

oracle提示缺失右括号,我这个语句有什么问题
且不说你那里都是问号,你问号前后也不用加括号啊select ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? from dual UNION ALL select ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? from dual UNION ALL select ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? from dual所有的括号去掉

oracle里执行后总是出现缺失右括号的提示
--1、oracle的int类型是不需要标注大小的,所以int(4),变成int即可 --2、不能通过定义表时定义自增字段,不支持auto_increment,--可以通过创建sequence和trigger来实现字段id的自增功能create table student(id int not null ,name varchar(20),myclass varchar(20) ,score int default 0,primary key(id));2,--自动生成序列create sequence seq_studentminvalue 1maxvalue 999999999999999999999start with 1increment by 1nocache;3,--创建触发器create or replace trigger trg_student_seq_idbefore insert on studentfor each rowdeclare-- local variables herebeginif(:new.id is null or :new.id =0) thenbeginselect seq_student.nextval into :new.id from dual;end;end if; end trg_student_seq_id;
AUTO_INCREMENT是MYSQL的 自动递增的关键字。 你这个建表语句, 是 mysql数据库的, 使用了 mysql 特有的东西。拿到 Oracle 上面跑, 自然是不行的了。下面是 mysql 里面AUTO_INCREMENT的使用的例子:mysql> CREATE TABLE test_create_tab2 (-> id INTAUTO_INCREMENT,-> valVARCHAR(10),-> PRIMARY KEY (id)-> );Query OK, 0 rows affected (0.09 sec)mysql> INSERT INTO test_create_tab2(val) VALUES ('NO id');Query OK, 1 row affected (0.03 sec)mysql> select last_insert_id() as id;+----+| id |+----+|1 |+----+1 row in set (0.00 sec)mysql> INSERT INTO test_create_tab2(val) VALUES ('NO id 2');Query OK, 1 row affected (0.03 sec)mysql> select last_insert_id() as id;+----+| id |+----+|2 |+----+1 row in set (0.00 sec)mysql> select * from test_create_tab2;+----+---------+| id | val |+----+---------+|1 | NO id ||2 | NO id 2 |+----+---------+ 2 rows in set (0.00 sec)
---建表 create table student(id int not null,name varchar(20),myclass varchar(20) ,score int default 0,primary key(id))SELECT * FROM student;---建立序列CREATE SEQUENCE s_studentMINVALUE 1MAXVALUE 999999999999999999999999999INCREMENT BY 1NOCYCLENOORDERCACHE 10/---触发器CREATE OR REPLACE TRIGGER t_student before insert on student for each rowbegin select s_student.nextval into:new.id from dual;end t_student;/oracle建表能这样写吗?没有那几个关键字! oracle 里面没有auto_increment 另外 int 不能指定位数 ,如果想指定可以使用number(位数)。
你用的Oracle版本是12C?11G,10G我都用过,但是没这个关键字。Oracle自增列都是用序列的。可能是我用的少吧。
score int(3)后面有个逗号

本文由 在线网速测试 整理编辑,转载请注明出处。