Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get next value of characters field

Status
Not open for further replies.

nouf

Programmer
Oct 8, 2003
26
QA
hi,
i have the following table:

b_no
-------
9
10
11_A
11_B
12
13_A

the b_no is varchar2(7),
i want to get the next item (wich is alaways the number only)
in this example i want to get 14.

regards,,,
 
select max(to_number(substr(b_no,1, length(b_no)- length(ltrim(b_no,'0123456789')))))+1 from <table>

But you'd better redesign your table, say split b_no field by number and modifier.

Regards, Dima
 
to sem,,,,
thank you very much, it is working..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top