Subject | Re: zip code distance calculation |
---|---|
Author | emb_blaster |
Post date | 2009-01-10T11:41:42Z |
--- In firebird-support@yahoogroups.com, "irajoel2000"
<irajoel2000@...> wrote:
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))
<irajoel2000@...> wrote:
>If i´m gettin all of this try:
> 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
>
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))