plpgsql For SQLQuery Loop Flags Error
От | Puneet Paul |
---|---|
Тема | plpgsql For SQLQuery Loop Flags Error |
Дата | |
Msg-id | 20031218122136.65697.qmail@web14521.mail.yahoo.com обсуждение исходный текст |
Ответы |
Re: plpgsql For SQLQuery Loop Flags Error
Re: plpgsql For SQLQuery Loop Flags Error Re: plpgsql For SQLQuery Loop Flags Error |
Список | pgsql-bugs |
Hi All, I am compiling a function that uses the For Query loop....End Loop. I get error "missing ".." at end of SQL expression" I have read following Note: The PL/pgSQL parser presently distinguishes the two kinds of FOR loops (integer or query result) by checking whether the target variable mentioned just after FOR has been declared as a record or row variable. If not, it's presumed to be an integer FOR loop. This can cause rather nonintuitive error messages when the true problem is, say, that one has misspelled the variable name after the FOR. Typically the complaint will be something like missing ".." at end of SQL expression at http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-CONTROL-STRUCTURES-LOOPS Re checked the RECORD variable in function CREATE OR REPLACE FUNCTION slice(char(15),varchar, integer) RETURNS integer AS ' DECLARE curTrackList char(15) ALIAS for $1; sliceFile varchar ALIAS for $2; lmfpLimit integer ALIAS for $3 mTrackDet RECORD; lpmfSum integer := 0; Sliced CONSTANT integer := 2; curId varchar; counter integer :=1 ; BEGIN ----Build the curSliceId value curId := curTrackList; Insert into mysliceDetail values(''abcdef'',''Ghijkl'',0); FOR mTrackDet IN SELECT myrequest.trackId, lmfpsize from myrequest,track where trkfound <> Sliced and myRequest.trackid = track.trackId and lmfpsize > 0 order by volatility LOOP -- Now "mTrackDet" has one record from slice list --LOOP --WHILE lpmfSum < lpmfLimit LOOP --Insert into mysliceDetail values(curId, mTrackDet.trackId ,0); --Insert into curSliceDetail values(curId, mTrackDet.trackId ,0); --lmfpSum := mTrackDet.lmfpsize + lmfpSum ; --EXIT WHEN lpmfSum > lpmfLimit --END LOOP; insert into sliceToBuild values(curId, 0); copy curSliceDetail to sliceFile; counter := counter + 1; Truncate Table curSliceDetail; ---Generate next curSliceId curSliceId := curTrackList + counter; END LOOP; RETURN 1; END; ' LANGUAGE plpgsql; Can someone help please Regards Paul __________________________________ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree
В списке pgsql-bugs по дате отправления: