摘要:多列資料串結為一筆的Funcion
create or replace function Get_grant (tpnumber IN NUMBER) RETURN VARCHAR2 IS factory_rev VARCHAR2(400); BEGIN factory_rev := ''; FOR x IN (SELECT tpfactory FROM tpatent_grant WHERE tpatentid = tpnumber) LOOP factory_rev := factory_rev ||x.tpfactory || chr(10); END LOOP; RETURN (factory_rev); END;
串起來之後,針對1點多的資料就可在單一表內呈現了!
用法:
Select t.*, Get_grant from tpatent t