Re: [SQL] Casting

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Thomas SMETS <tsmets(at)altern(dot)org>
Cc: psql novice <pgsql-novice(at)postgresql(dot)org>, psql sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] Casting
Date: 2001-01-05 18:42:38
Message-ID: Pine.LNX.4.30.0101051940280.979-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

Thomas SMETS writes:

> I'm removing charaters from a String which should be numbers.
> I then want to make calculations on these numbers (calculate the ISBN
> number).

(You might want to look into contrib/isbn_issn for an isbn type.)

> Do I have to cast the char into int's before I can do the calulations.

Depends on the calculation. I'd just try to see if it works. When in
doubt add casts.

> Also I looked in the User manual but could not find the modulo function
> where is it ?

5 % 4
mod(5, 4)

--
Peter Eisentraut peter_e(at)gmx(dot)net http://yi.org/peter-e/

In response to

  • Casting at 2001-01-05 00:31:26 from Thomas SMETS

Browse pgsql-novice by date

  From Date Subject
Next Message Andrew McMillan 2001-01-05 23:41:52 Re: MSSQL to PgSQL
Previous Message Paul Skinner 2001-01-05 17:43:02 Determining parent.

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-01-05 19:02:31 Re: pqReadData()
Previous Message Marcos Aurélio S. da Silva 2001-01-05 18:32:02 Postgresql database access