select smspec.article,smspec.quantity,barcode from smspec,SMStoreUnits where docid='0266' and doctype='WO' and SMStoreUnits.article=smspec.article order by smspec.article
select t.article,t.quantity, (select barcode from smstoreunits b where b.article=t.article and rownum=1) barcode from smspec t where docid='0266' and doctype='WO' order by t.article
create or replace function barToStrcreate ( p_a in varchar2 ) return varchar2 is l_str varchar2(2000) default null; l_sep varchar2(1) default null; begin for x in ( select barcode from smstoreunits where article = p_a ) loop l_str := l_str || l_sep || x.barcode; l_sep := ','; end loop; return l_str; end;
select t.article,t.quantity, barToStrcreate(t.article) barcode from smspec t where docid='0266' and doctype='WO' order by t.article