Subject | Re: execute statement problems (was options after where statement) |
---|---|
Author | emb_blaster |
Post date | 2008-10-16T14:28:57Z |
try cast your params.
example:
'select(...)' || cast(:fromdate as varchar(20)) || '(...)
or
'select(...)' || cast(:fromdate as date) || '(...)
best regards
example:
'select(...)' || cast(:fromdate as varchar(20)) || '(...)
or
'select(...)' || cast(:fromdate as date) || '(...)
best regards
--- In firebird-support@yahoogroups.com, Alan.Davies@... wrote:
>
> Hi, this is a follow-up to a previous post about options after Where.
> I have tried this - FB 2.1 - as a first attempt (taken from an
> existing, working sp) and it is a cut-down version for clarity.
> I get the following errors when it gets to actually running the
> execute statement with the line # and column # of the 'for execute...'
> line
> expression evaluation not supported
> expression evaluation not supported
> Same error if I change to
> where a.date_in >='||:fromdate||
> ' and a.date_in<='||:uptodate;
>
> I think its "nearly there" but would appreciate a little help, thanks.
>
> CREATE PROCEDURE HAULIERCHARGES_TEST (
> print_all_one integer,
> haulcode integer,
> fromdate date,
> uptodate date)
> returns (
> code integer,
> name char(40),
> special_charge numeric(9,2),
> special_detail varchar(100),
> date_in date)
> as
> declare variable qry_clause varchar(500);
> declare variable and_clause varchar(100);
> declare variable order_clause varchar(100);
> begin
> qry_clause='select h.haul_code,h.haul_name,
> a.details,a.amount,a.date_in
> from haulier h
> join account_charges a
> on a.code=h.haul_code
> where a.date_in between '||:fromdate||' and '||:uptodate;
>
> and_clause=' and h.haul_code='||:haulcode;
>
> order_clause=' order by h.haul_name';
>
> if (print_all_one=0) then
> begin /* one - :haulcode */
> qry_clause=qry_clause||and_clause||order_clause;
> end
> else if (print_all_one=1) then
> begin /* all */
> qry_clause=qry_clause||order_clause;
> end
>
> for execute statement qry_clause
> into :code,:name,
> :special_detail,:special_charge,:date_in
> do
> suspend;
> end
> --
> Alan J Davies
> Aldis
>