Subject Re: [IBO] Execute block usage
Author Robert Martin
Apologies

There is a mistake in the SQL (it should be DO BEGIN). It should now work !

Thanks
Rob


On 22/06/2011 1:55 p.m., Robert Martin wrote:
> Hi
>
> I want to run the following from an IBOQuery but get issues I guess are
> related to the ; is that right? If so do I need to it as a script or
> can I use it in a TIBOQuery?
>
> execute block(sourceControlRef bigint = :ControlRef)
> as
> declare slRef int;
> begin
> FOR
> SELECT sl2.StockLevelRef
> FROM WorkRegionTransfer wrt
> JOIN StockLevel sl2 ON sl2.ItemRef = wrt.ItemRef
> LEFT JOIN StockTransferLine stl ON (stl.StocktfRef =
> wrt.StockTfRef AND stl.ItemRef = wrt.ItemRef)
> WHERE wrt.ControlRef = sourceControlRef
> AND (stl.StocktfRef IS NULL OR stl.ReceivedQty IS NOT NULL)
> INTO :slRef
> DO
> UPDATE StockLevel sl SET sl.Transferin = sl.Transferin
> WHERE StocklevelRef = :slRef;
> END
> end
>
>
> Thanks
> Rob
>
>
>
> ------------------------------------
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more ! Yahoo! Groups Links
>
>
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1382 / Virus Database: 1513/3718 - Release Date: 06/21/11
>
>