<div dir="ltr">i get the following error when i try and create the following function:<br /><br />Basically, i am
tryingto have two different dates compared and only the most recent returned to me. This seems pretty straight
forward,what I am doing wrong here?<br /><br /><span style="color: rgb(51, 51, 255);">create or replace function
fcn_pick_date(v_dtdate) <br />returns date as $$ <br /> DECLARE<br /> v_dt date; <br /> BEGIN<br /> for
v_recordin select last_periodic, last_boot<br /> from mediaportal<br /> loop<br /> if v_dt >=
v_record.last_bootthen<br /> v_dt := v_record.last_periodic;<br /> else<br /> v_dt :=
v_record.last_boot;<br/> end if;<br /> end loop;<br /> return (v_dt);<br /> END;<br />$$ LANGUAGE
'plpgsql';</span><br/><br /><br /><span style="color: rgb(204, 0, 0);">ERROR: loop variable of loop over rows must be
recordor row variable at or near "loop" at character 195<br /><br />********** Error **********<br /><br />ERROR: loop
variableof loop over rows must be record or row variable at or near "loop"<br />SQL state: 42601<br />Character: 195<br
/></span><br/><br /></div>