SYS@orcl1>create table test_index as select * from dba_tables where rowNum<30;
Table created.
SYS@orcl1>insert into test_index select * from dba_tables where rowNum<28;
27 rows created.
SYS@orcl1>commit;
Commit complete.
SYS@orcl1> select TABLE_NAME ,count() from test_index group by TABLE_NAME having count(1) > 1 fetch first 10 rows only;
select TABLE_NAME ,count() from test_index group by TABLE_NAME having count(1) > 1 fetch first 10 rows only
*
ERROR at line 1:
ORA-00933: SQL command not properly ended
SYS@orcl1>select TABLE_NAME ,count(*) from test_index group by TABLE_NAME having count(1) > 1 ;
TABLE_NAME COUNT(*)
ICOL$ 2
TS$ 2
UNDO$ 2
FET$ 2
OBJ$ 2
USER$ 2
UET$ 2
SEG$ 2
CLU$ 2
IND$ 2
COL$ 2
TABLE_NAME COUNT(*)
PROXY_DATA$ 2
LOB$ 2
FILE$ 2
TSQ$ 2
COLTYPE$ 2
16 rows selected.
SYS@orcl1> alter table test_index add constraints pk_objname1 primary key (TABLE_NAME) novalidate;
alter table test_index add constraints pk_objname1 primary key (TABLE_NAME) novalidate
*
ERROR at line 1:
ORA-02437: cannot validate (SYS.PK_OBJNAME1) - primary key violated
SYS@orcl1>
执行不成功。报错的呀~