scalar subquery?
armaniNov 13 2010 — edited Nov 13 2010I have three tables,
SQL> desc store_inventory;
Name Null? Type
----------------------- -------- ----------------
NUM NOT NULL NUMBER
AISLE VARCHAR2(7)
PRODUCT VARCHAR2(15)
LAST_ORDER DATE
SQL> desc furnishings;
Name Null? Type
----------------------- -------- ----------------
CAT# NOT NULL NUMBER
ITEM_NAME VARCHAR2(15)
ADDED DATE
CESTION VARCHAR2(10)
SQL> desc online_subscribers;
Name Null? Type
----------------------- -------- ----------------
ONLINE_SUBSCRIBER_ID NOT NULL NUMBER
SUB_DATE DATE
EMAIL VARCHAR2(120)
FIRST_NAME VARCHAR2(30)
LAST_NAME VARCHAR2(30)
COMPANY VARCHAR2(30)
SQL>SQL> select *from store_inventory;
NUM AISLE PRODUCT LAST_ORDE
---------- ------- --------------- ---------
1 mami tati 13-NOV-10
2 buc tim 13-NOV-10
3 eie mei 13-NOV-10
SQL> select *from furnishings;
CAT# ITEM_NAME ADDED CESTION
---------- --------------- --------- ----------
5 kytie 01-JUN-55 versace
89 kytie 22-SEP-44 reaction
36 kytie 22-DEC-76 bibicu
SQL>SQL> select *from online_subscribers;
ONLINE_SUBSCRIBER_ID SUB_DATE EMAIL FIRST_NAME
-------------------- --------- ----------------------------------- -----------------------
1 22-DEC-76 hei@yahoo.com aha
3 06-MAY-83 mei@yahoo.com aha
60 14-DEC-83 mei@yahoo.com aha
How can I found out that here outer query wait for a scalar subsquery?
SQL> select (select last_order from store_inventory
2 union
3 select added "Date Added" from furnishings)
4 from online_subscribers
5 order by 1;
select (select last_order from store_inventory
*
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row