SQL> select * from tab1;
A B C
---------- ---------- ----------
1 2 3
2 2 3
3 2 3
4 4 3
SQL> select * from tab1 where a = (select a from tab1);
select * from tab1 where a = (select a from tab1)
*
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row
SQL> select * from tab1 where a = all (select a from tab1);
no rows selected
SQL> select * from tab1 where a = some (select a from tab1);
A B C
---------- ---------- ----------
1 2 3
2 2 3
3 2 3
4 4 3
SQL> select * from tab1 where a = all (select b from tab1);
no rows selected
SQL> select * from tab1 where a = some (select b from tab1);
A B C
---------- ---------- ----------
2 2 3
4 4 3
SQL> select * from tab1 where a = all (select c from tab1);
A B C
---------- ---------- ----------
3 2 3
SQL> select * from tab1 where a = some (select c from tab1);
A B C
---------- ---------- ----------
3 2 3
SQL> select * from tab1 where a = some (select b, c from tab1);
select * from tab1 where a = some (select b, c from tab1)
*
ERROR at line 1:
ORA-00913: too many values
Everything Changes
1 week ago
1 comment:
where a = ALL(1,2)
means: where a = 1 and a = 2
where a = SOME(1,2)
means: where a =1 or a = 2
Post a Comment