Subject Re: zip code distance calculation
Author emb_blaster
--- In firebird-support@yahoogroups.com, "irajoel2000"
<irajoel2000@...> wrote:
>
> As a followup to my previous posting:
>
> This works:
>
> q.sql = "SELECT 69.1 * LATITUDE - 40.7409 AS DISTANCE, NAME FROM
> WEBDATA"
>
> This does not work - give an -804 error
> q.sql = "SELECT 69.1 * LATITUDE - :lat1 AS DISTANCE, NAME FROM
> WEBDATA
> q.params["lat1"] := 40.7409
>

If i´m gettin all of this try:

q.sql = "SELECT 69.1 * LATITUDE - CAST(:lat1 AS DOUBLE PRECISION) AS
DISTANCE, NAME FROM WEBDATA
q.params["lat1"] := 40.7409

note: even if it work, maybe that "double precision" is not accurate
for your calcs try a numeric type instead ex.: CAST(:lat1 AS
NUMERIC(18,5))