my query is as follows:
SELECT DISTINCT *
FROM (SELECT depts."ID", depts.arabic_description
FROM sng_v_org_unit_departments depts
INNER JOIN (SELECT "ID", arabic_description, ouh_id
FROM sng_v_org_unit_headers
START WITH "ID" =
(SELECT headid
FROM emppirmesion per
inner join empldabdetail empinfo
on per.emprecid = empinfo.recid
where lower(empinfo.shortname) = lower('ibmadmin') and
per.headid > 0 and
per.clasisymbolicname = 'SoHiring')
CONNECT BY PRIOR "ID" = ouh_id) heads
ON depts.ouh_id = heads."ID"
UNION
SELECT per.depid, depts.arabic_description
FROM emppirmesion per
inner join empldabdetail empinfo on per.emprecid = empinfo.recid
inner join sng_v_org_unit_departments depts on per.depid = depts."ID"
where lower(empinfo.shortname) = lower('ibmadmin') and
per.depid > 0 and
per.clasisymbolicname = 'SoHiring')
I am getting an exception ORA-01427: single-row subquery returns more than one row if i have more than one row in the emppirmesion that have the same clasisymbolicname although they have differnet headid values and this exception shouldn't occur in this case, please advise about that.
emppirmesion
with the sameclassisymbolicname
, would you get differentheadid
values? What should happen with your query in this case, should it justSTART WITH
a random one, or the first one? - beny23START WITH = single value
but your query is providing it withSTART WITH = multiple values
, so you would have to redesign your query, but without knowing what you are trying to achieve, that's a bit difficult... - beny23