Subject | Re: [firebird-support] Execute Statement and Date type |
---|---|
Author | Helen Borrie |
Post date | 2004-06-18T12:16:07Z |
At 10:52 AM 18/06/2004 +0000, you wrote:
|| mindate ||''' and '''||maxdate ||''' and '||additionalfilter;
i.e., to get an apostrophe treated as a literal, use two of them.
/hb
>In a stored procedure I need to use the Execute Statement feature ofsql='select orderdate, count(*) from orders where orderdate between '''
>FB 1.5. I do not know how I can join the date parameters (date type)
>with the text (varchar type) of the DSQL instruction into a Stored
>Procedure.
>
>I tried: 'where orderdate between '|| mindate ||'....
>
>Also: 'where orderdate between '|| cast(mindate as varchar(16))||'....
>
>But I get errors of conversion.
>
>The PSQL code is:
>
>-------
>
>CREATE PROCEDURE "OPENREASONS"
>(
> "MINDATE" DATE,
> "MAXDATE" DATE,
> "ADDITIONALFILTER" VARCHAR(300)
>)
>...
>declare variable sql varchar(1024);
>....
>sql='select orderdate, count(*) from orders where orderdate between '
> || mindate ||' and '||maxdate ||' and '||additionalfilter;
>
>for execute statement sql into :f1,:f2
>....
|| mindate ||''' and '''||maxdate ||''' and '||additionalfilter;
i.e., to get an apostrophe treated as a literal, use two of them.
/hb