Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"ORA-01427: Single-row subquery returns more than one row"

Nico van de KampJan 9 2013 — edited Jan 9 2013
Just a question, because I want to know if it is possible:
SELECT ...
,....
-- subquery
,(SELECT t1.val
FROM table 1 t1
,tabel 2 t2
,tabel 3 t3
WHERE t1.UIDxxxxx = t2.UIDUIDxxxxx
and etc
and lct.STARTTIME between to_date('01-01-2014 00:00:00', 'dd-mm-rrrr HH24:mi:ss') and to_date('31-12-2014 23:00:00', 'dd-mm-rrrr HH24:mi:ss')
) as result
FROM .....
WHERE main where clause

The subquery has a relation with the main query. But the subquery returns 12 value's and therefore I do get the error. I understand that

But I'm not so familiar with SQL, is it possible to do this with the construction as I wrote here before? (The values may al be returned in one field like seperated by a space or ';')

I know a (or the) workaround like repeat the subquery 12 times, for every month 1 time.
Another construction is off course to add in or another way to add this to the main query, but my main query already exist from 12 tables.

Nico
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2013
Added on Jan 9 2013
2 comments
1,033 views