The following bug has been logged on the website:

Bug reference:      6609
Logged by:          biju george
Email address:      biju.geo...@ust-global.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Linux
Description:        

I have a text column which have values like
'01abcd','012345','abcde',etc...
Now I am trying to take the first 2 characters of the column and pass into a
function which takes only integer values and returns an integer. So, I need
to check before I input into the function whether the substring is integer
or not. If integer then the return value else default value say 99.
select my_function(case when substr(my_column,1,2) like '[0-9][0-9]' then
substr(my_column,1,2) else 99 end) from my_table;
I tried like, =, ~. Nothing seems to work. Tried ::text, ::integer and
all...

It always throws error --
ERROR:  CASE types integer and text cannot be matched

The darn thing just don't work... :mad:


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to