Re: Char to Int - Mailing list pgsql-general

From Rick Seeger
Subject Re: Char to Int
Date
Msg-id HKEPLMBPEGFGAKDKKAEDMEJIFKAA.rick@nettheory.com
Whole thread Raw
In response to Re: Char to Int  (Peter Eisentraut <peter_e@gmx.net>)
List 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



pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Char to Int
Next
From: Edmund Dengler
Date:
Subject: Re: SET within a function?