测试join using遭遇ORA-25154

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

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




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值