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!

single row query returns more than one row

957183Mar 12 2013 — edited Mar 12 2013
hello,

this is my sql=
" SELECT  
 
	hpn.id AS id,
    hpn.psn_id, 
    hpn.last_name,
    hpn.person_code,
    hwe.pfn_code,
    hwe.pfn_name,
    hwe.scy_code,
    hwe.scy_name,
    hwe.hsy_name, 
    hwe.hin_id,
    hpn.first_name as FIRST_NAME1
    
    
  FROM
    persons hpn, 
  
    (SELECT
        w.hpn_id,
        s.name AS scy_name,
        s.code AS scy_code,
        p.name AS pfn_name,
        p.code AS pfn_code,
        i.name AS hsy_name,
    i.id as hin_id
      FROM workplaces w, specialities s, professions p, INSTITUTIONS i
      WHERE
        (w.scy_id=s.id)AND
        (w.pfn_id=p.id)AND
        (w.hin_id=i.id)AND
        (w.end_date IS NULL)AND
      
    ) hwe
  WHERE
    (hpn.id=hwe.hpn_id(+))
    
"
what i want is add subselect something like this (select card_number from REGISTRATION_CARDS x where (hpn.id=x.hpn_id(+)) )as card_number,

but it returns error single row query returns more than one row, because one people can have more that one card_number.

can some someone help me to write correct query please.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 9 2013
Added on Mar 12 2013
9 comments
239 views