To get the last x characters from the end of a string you can pass a negative value to SUBSTR e.g. -1. To get the first x characters from the beginning of a string pass a positive value. SUBSTR ('HELLO',1,2) would return 'HE'.

Not got Oracle with me, so can't give you a working example. If nobody has replied by the time I'm back in the office I'll post something that works.

HTH

Austin