Nouf, haven't it be answered in thread186-692778 ? Just think a little bit. Do you find it to be polite to ask how to extract number part of that field after obtaining an answer about how to extract it and add 1 to it?
Since your post did not mention other non-numeric characters besides "A", I didn't solve for characters for which I was not aware. Of course, you should add to the TRANSLATE character list any characters that are non-numeric so that you do not receive the "ORA-01722: invalid number" error. I have modified both statements to handle all characters of which I am aware: "_" plus all alphabetic characters, both upper and lower case:
1) select b_no from tab order by to_number(translate(upper(b_no),'^_ABCDEFGHIJKLMNOPQRSTUVWXYZ','^'));
2) select max(to_number(translate(upper(b_no),'^_ABCDEFGHIJKLMNOPQRSTUVWXYZ','^')))+1 from tab;
Let me know if this solves your need.
Dave
Sandy, Utah, USA @ 18:19 GMT, 11:19 Mountain Time
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.