break char into segments

Need help with your code? Post it here and we'll try our best to help.
User avatar
Is Gettin' Pwned
Joined:Tue Jul 17, 2007 11:01 pm
break char into segments

Postby Kamasabi » Thu Apr 17, 2008 2:28 am


Anyone have some experience with SQL and triggers? Attempt:

I have a table, for instance tutor, that has a TutorID that I want to auto increment, however, it is a char string, in this case, t001, t002, etc. If it were simply a number, it wouldn't be an issue. So, what I want to do....

I want to make a trigger or stored function that breaks that char into 2 segments: the character and the numbers, then increment the numeric part, and then piece the two back together.

Any ideas? Working in Oracle DB.


User avatar
Fist of the eskimo
Canadian Ambassador
Joined:Tue Nov 27, 2007 1:11 pm
Location:Edmonton, AB

Postby Fist of the eskimo » Thu Apr 17, 2008 7:07 pm

I remember seeing an article on this in one of the forums, but I can't remember where. Just search for lludium-Q36 and it should be the first or second link in google.

Return to “Code Monkeys”

Who is online

Users browsing this forum: No registered users and 1 guest