Subject | Re: RES: [firebird-support] SELECT INTO :var gives Unkown Token INTO error |
---|---|
Author | Peter Welch |
Post date | 2004-12-17T17:32:17Z |
Thank you, Gerson.
I should have mentioned that I'm using the Firebird .Net Provider
which may explain some of the inconsistency that I'm encountering.
But, Luc's syntax correction got me over the hump. Your examples are
good and will be retained for future reference.
Pete
--- In firebird-support@yahoogroups.com, "Gerson Machado - Yahoo"
<gersonamach@y...> wrote:
I should have mentioned that I'm using the Firebird .Net Provider
which may explain some of the inconsistency that I'm encountering.
But, Luc's syntax correction got me over the hump. Your examples are
good and will be retained for future reference.
Pete
--- In firebird-support@yahoogroups.com, "Gerson Machado - Yahoo"
<gersonamach@y...> wrote:
> Peter,
>
> If you are using a stored procedure... see this example:
> CREATE PROCEDURE DEPT_BUDGET (
> DNO CHAR (3))
> RETURNS (
> TOT DECIMAL (12, 2))
> AS
> DECLARE VARIABLE sumb DECIMAL(12, 2);
> DECLARE VARIABLE rdno CHAR(3);
> DECLARE VARIABLE cnt INTEGER;
> BEGIN
> tot = 0;
>
> SELECT budget FROM department WHERE dept_no = :dno INTO :tot;
>
> SELECT count(budget) FROM department WHERE head_dept = :dno INTO :cnt;
>
> IF (cnt = 0) THEN
> SUSPEND;
>
> FOR SELECT dept_no
> FROM department
> WHERE head_dept = :dno
> INTO :rdno
> DO
> BEGIN
> EXECUTE PROCEDURE dept_budget :rdno RETURNING_VALUES :sumb;
> tot = tot + sumb;
> END
>
> SUSPEND;
> END
>
> Gerson
>
>
>
>
> Here is the SQL that fails in IB_SQL's DSQL applied to a Firebird 1.5
> table - dialect 3, I believe:
>
> SELECT min(id) from trays where tray_no = :aTray INTO :Id;
>
> Doesn't matter where I place the INTO.
>
> 'id' is the primary key but substituting a different field yields the
> same results.
>
> Very puzzled since this is an equivalent (syntax-wise) SQL statement
> from an Interbase book.
>
> Thank you for any interest in this matter.
>
> Pete
>
>