Home » SQL & PL/SQL » SQL & PL/SQL » Select from Dual (General)
Select from Dual [message #317023] Tue, 29 April 2008 03:56 Go to next message
kasanar@yahoo.com
Messages: 2
Registered: June 2005
Location: INDIA
Junior Member

Hi All,

please explain why below query gives error, when I am expecting to give result count as 4. please help

select count(
(select sysdate from dual
union all
select sysdate from dual
union all
select sysdate from dual
union all
select sysdate from dual)
)
from dual

Regards
Re: Select from Dual [message #317026 is a reply to message #317023] Tue, 29 April 2008 04:11 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Because COUNT counts a column (or *), not the resultset of a query.
Try this
select count(col_1)
from
(select sysdate col_1 from dual
union all
select sysdate from dual
union all
select sysdate from dual
union all
select sysdate from dual)
;
Previous Topic: Bulk insert and commit
Next Topic: Oracle Number Data type
Goto Forum:
  


Current Time: Wed Dec 07 18:31:41 CST 2016

Total time taken to generate the page: 0.13384 seconds