pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: José Soares <jose@sferacarta.com>
To: JT Kirkpatrick <jt-kirkpatrick@mpsllc.com>
Cc: 'pgsql-sql@hub.org' <pgsql-sql@hub.org>
Subject: Re: [SQL] convert text to number or number to text
Date: Thu, 22 Apr 1999 14:29:56 +0200
Message-ID: <371F1644.2B73C65C@sferacarta.com> (raw)
References: <01BE8C04.0A52A9E0.jt-kirkpatrick@mpsllc.com>

This should work:

select cast('123' as int), cast(123 as text);

José


JT Kirkpatrick ha scritto:

> I'm trying to do an update query that compares an int4 field to a variable
> which I think contains a string (it was passed in through cgi.pm).  can I
> convert that string to an integer? - it will always be a number passing
> through.  I vaguely remember oracle having a to_number function - does
> postgres have something similar?
>
> jt




view thread (3+ messages)

Message-ID: <371F1644.2B73C65C@sferacarta.com>
Permalink:  ../371F1644.2B73C65C@sferacarta.com/
Also on:    postgresql.org/message-id/371F1644.2B73C65C@sferacarta.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jose@sferacarta.com, jt-kirkpatrick@mpsllc.com, pgsql-sql@hub.org
  Subject: Re: [SQL] convert text to number or number to text
  In-Reply-To: <371F1644.2B73C65C@sferacarta.com>
  References: <01BE8C04.0A52A9E0.jt-kirkpatrick@mpsllc.com> <371F1644.2B73C65C@sferacarta.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox