Char to Int

From: "Rick Seeger" <rick(at)nettheory(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Char to Int
Date: 2003-10-14 21:10:05
Message-ID: HKEPLMBPEGFGAKDKKAEDMEJFFKAA.rick@nettheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I'm trying to convert a var char to an int. I tried a couple methods
described in the documentation, but can't seem to get it to work. Any
thoughts?

In this example, the field my_id is character varying(16):

rs=# insert into table2
rs=# select my_Id::INT
rs=# from table1;
ERROR: Cannot cast type character to integer

rs=#
rs=# insert into table2
rs=# select CASE(my_Id as integer)
rs=# from table1;
ERROR: Cannot cast type character to integer

Any help or links to appropriate documentation appreciated!

--Rick

In response to

  • Re: int1? at 2003-10-14 18:48:23 from Sean Chittenden

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Floyd Shackelford 2003-10-14 21:11:08 Table analyzer
Previous Message Jan Wieck 2003-10-14 21:07:05 Re: Virtual Machines and postgres