<div xmlns="http://www.w3.org/1999/xhtml">Merhabalar,</div><div xmlns="http://www.w3.org/1999/xhtml"> </div><div xmlns="http://www.w3.org/1999/xhtml">Tabloların (tbl_detay ve tbl_std_yer) kolon yapılarını (create cümlecikleri de olur), birkaç satırlık örnek veri ve kullandığınız PostgreSQL versiyonunu da ekler misiniz.</div><div xmlns="http://www.w3.org/1999/xhtml"> </div><div xmlns="http://www.w3.org/1999/xhtml">İyi çalışmalar.</div><div xmlns="http://www.w3.org/1999/xhtml">Samed YILDIRIM</div><div xmlns="http://www.w3.org/1999/xhtml"> </div><div xmlns="http://www.w3.org/1999/xhtml"> </div><div xmlns="http://www.w3.org/1999/xhtml"> </div><div xmlns="http://www.w3.org/1999/xhtml">27.11.2018, 19:56, "Java Notlarım" <javanotlarim(at)gmail(dot)com>:</div><blockquote xmlns="http://www.w3.org/1999/xhtml" type="cite"><div>Merhaba. <div>Tablomda smallint array tipinde bir alanım mevcut. Bu alandaki verileri çekerken, smallint değerleri yerine, bu smallint değerlerin string karşılıkları ile çekmek için, JOIN kullanarak bir sorgu yazdım. Bu sorgu normalde sorunsuz çalışırken, sorguyu function (Stored Procedure) olarak yazmaya çalıştığımda </div><div> </div><div><strong>"ERROR: HATA: record dönüşlü bildirilmiş işlevde return deyimin tipi uyumsuz AYRINTI: Son ifade 3 sütununda text[] yerine text döndürüyor."</strong></div><div>şeklinde bir hata alıyorum. Aldığım hata ile ilgili çözüm öneriniz olursa çok memnun olurum.</div><div>Functionum aşağıdaki gibi</div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">CREATE OR REPLACE FUNCTION sp_list_abc(</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">IN sp_master_id integer,</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">OUT sp_id bigint,</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">OUT sp_evrakno text,<span style="white-space:pre;"> </span></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">OUT sp_yer_adi_array text[])</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"> RETURNS SETOF record </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"> LANGUAGE 'sql'</blockquote></blockquote><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"> COST 100</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"> VOLATILE </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"> </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">AS $BODY$</blockquote> <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">select <a rel="noopener noreferrer" href="http://ed.id/">ed.id</a>, ed.evrak_no,STRING_AGG(syer.yer_adi, ', ') </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">from tbl_detay ed</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">LEFT JOIN tbl_std_yer syer on <a rel="noopener noreferrer" href="http://syer.id/">syer.id</a>=ANY(ed.yer_id_array)</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">where ed.master_id=$1 </blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">GROUP BY <a rel="noopener noreferrer" href="http://ed.id/">ed.id</a>, syer.yer_adi</blockquote> <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;">$BODY$;</blockquote></blockquote></div></blockquote>