Re: Char to Int

From: "Rick Seeger" <rick(at)nettheory(dot)com>
To: "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Char to Int
Date: 2003-10-14 22:08:07
Message-ID: HKEPLMBPEGFGAKDKKAEDMEJIFKAA.rick@nettheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>
>> Oops, there was a typo in my second example. Still have the problem
>> tho...
>>
>> > rs=#
>> > rs=# insert into table2
>> > rs=# select CAST(my_Id as integer)
>> > ^^^^
>> > rs=# from table1;
>> > ERROR: Cannot cast type character to integer
>
> Try the function to_number().
>

rs=# select to_number(my_Id,'9999999999999999') from table1;

It worked nicely. Thanks.

--Rick

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Edmund Dengler 2003-10-14 22:11:10 Re: SET within a function?
Previous Message Peter Eisentraut 2003-10-14 21:55:04 Re: Char to Int