vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Dear All, How I can check a substring is a valid number in postgresql ? example: I have a query select max(substring(code,2,length(code))::INT) from emp where substring(code,0,2) = 'A'; code ======== A0001 A0002 ABC005 S0002 This query fails because of ABC002, how I can avoid this error , if there is a any way to check substring(code,1,length(code)) is a number ,then i can correct the query by put it in where condition. I want to get the result as 2(ie want to avoid checking ABC005 is there is any built in function to check the substring is a number in postgresql? Iam using postgres 8.1.8 pls help me thanks in advance: Anoop |
| ||||
| On Thu, 24 Apr 2008, "Anoop G" <anoopmadavoor@gmail.com> writes: > How I can check a substring is a valid number in postgresql ? SELECT col ~ '[0-9]+'; Regards. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql |