plsql - PL/SQL return record in procedure -
i have procedure called "gps_coord". takes 2 parameter , must return record . don't know how can . in advance ;)
create or replace procedure gps_coord(v_x in float, v_y in float, v_result out result_type) type result_type record( v_km varchar2(50), v_objid varchar2(50) ); v_out result_type; begin select p.km , p.objectid v_out sde.points p sde.st_intersects(p.shape,sde.st_buffer(sde.st_transform( sde.st_point(v_y,v_x,4326),32639) ,5000))=1; dbms_output.put_line('km: ' || v_out.v_km || 'objid: ' || v_out.v_objid ); end;
try this. hope helps.
--object type creation create or replace type result_type object ( v_km varchar2(50), v_objid varchar2(50) ); --table type create or replace type result_tab table of result_type; --procedure creation , out collection create or replace procedure gps_coord( v_x in float, v_y in float, v_result out result_tab) v_out result_tab; begin select result_type(p.km , p.objectid) bulk collect v_out sde.points p sde.st_intersects(p.shape,sde.st_buffer(sde.st_transform( sde.st_point(v_y,v_x,4326),32639) ,5000))=1; in v_out.first..v_out.last loop dbms_output.put_line(v_out(i).v_km||' '||v_out(i).v_objid); end loop; end;
Comments
Post a Comment