I am quering a firebird 2.5 database using php (ibase). Simple queries are working fine, but when I try to use the following procedural query I get a "token unknown" error at line 1, column 5 - ie when "TERM" is encountered. I feel I am missing something very basic here!
$query = <<<X
SET TERM #;
EXECUTE BLOCK
RETURNS (product INT, minPrice FLOAT, maxPrice FLOAT)
AS
DECLARE transID INT = 8733;
BEGIN
FOR
SELECT "Product", MIN("CurrencyRate" * "UnitPrice"), MAX("CurrencyRate" * "UnitPrice")
FROM "CustomerStockInDetail"
HAVING "Product" = :transID
INTO :product, :minPrice, :maxPrice
DO
SUSPEND;
END#
SET TERM ;#
X;