当前位置:Gxlcms > mysql > 测试joinusing遭遇ORA-25154

测试joinusing遭遇ORA-25154

时间:2021-07-01 10:21:17 帮助过:35人阅读

SQLgt; create table aa(a number,b number);Table created.SQLgt; create table bb(b number,c number);Table created.SQLgt

SQL> create table aa(a number,b number);

Table created.

SQL> create table bb(b number,c number);

Table created.

SQL> insert into aa values(1,2);

1 row created.

SQL> insert into aa values(2,3);

1 row created.

SQL> insert into bb values(2,4);

1 row created.

SQL> insert into bb values(5,6);

1 row created.

SQL> commit;

Commit complete.

SQL> select aa.a,aa.b,bb.c from
2 aa join bb using(b);
select aa.a,aa.b,bb.c from
*
ERROR at line 1:
ORA-25154: column part of USING clause cannot have qualifier

SQL> !oerr ora 25154
25154, 00000, "column part of USING clause cannot have qualifier"
// *Cause: Columns that are used for a named-join (either a NATURAL join
// or a join with a USING clause) cannot have an explicit qualifier.
// *Action: Remove the qualifier.

SQL> select aa.a,b,bb.c from
2 aa join bb using(b);

A B C
---------- ---------- ----------

1 2 4

看来连接条件出现在查询中,不能带表名,测试别名是否可行。


SQL> select x.a,x.b,y.c from
2 aa x join bb y using(b);
select x.a,x.b,y.c from
*
ERROR at line 1:
ORA-25154: column part of USING clause cannot have qualifier

如果表名采用别名,,看来也不行。

linux

人气教程排行