Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Truncating Certain Charaters
tobhamlet wrote:
> Is there any way in Oracle to only extract a certain number of
> charaters from a field.
>
> For example, I have a student number field (STDNT_NUM), and some
> student numbers start with an S, such as
>
> 89187
> S56789
> S78900
>
> I want a query that can either exclude the S, or that can extract the
> last 5 digits from the STDNT_NUM field. So, the data will look like
> this,
>
> 56789
> 78900
>
> Is there a way to do this in Oracle?
>
> Marcus
> ******
>
Try using a combination of INSTR and SUBSTR.
You can read it up here:
http://www.psoug.org/reference/substr_instr.html
Amogh Received on Thu Sep 22 2005 - 09:34:22 CDT