Sta: with Dates

Paul Mulroney pmulroney at logicaldevelopments.com.au
Thu Jul 21 01:44:08 UTC 2022


Hi Das,

Yes, that's correct - just use the bind variable notation @[varname] in the Sta:

Note: the variable should be in scope at the time you execute the query.  So, for example, you can't use local vars in the STA: if you execute the query in another method.  That's caught us in the past.

You can use bind vars for all data types. including dates.  However I did notice in our setup that @[#D] did not work for some reason which may be more to do with the database column than the bind var.

Typically we use bind vars for strings, normal square bracket notation for numbers, and we have a routine to format dates correctly for Postgres.

Regards,
Paul.


> On 21 Jul 2022, at 2:01 am, Das Goravani <goravanis at gmail.com> wrote:
> 
> 
> When doing statement preparation with the Sta: method
> And your code includes referencing fields or columns
> Can you use the @ for bind variables?
> What should you do with dates?
> 
> Sta: WHERE invoice_date>=@[iDateFrom]
> 
> Is that correct?
> 
> Can you use bind variables in a Sta: method like that?
> 
> Or should you just quote them
> 
> Specifically curious about dates, as text and numbers I know.
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


I was going to wear my camouflage shirt today, but I couldn't find it.
-- 
Paul W. Mulroney                                            We Don't Do Simple Pty Ltd 
pmulroney at logicaldevelopments.com.au       Trading as Logical Developments
www.logicaldevelopments.com.au                   ACN 161 009 374 
Ph: +61 8 9458 3889                                       86 Coolgardie Street
                                                                         BENTLEY  WA  6102





More information about the omnisdev-en mailing list