Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Truncating Certain Characters

Re: Truncating Certain Characters

From: <chrishenn_at_gmail.com>
Date: 22 Sep 2005 11:49:00 -0700
Message-ID: <1127414940.087881.168280@g49g2000cwa.googlegroups.com>


This will work:

SQL> create table students(STDNT_NUM varchar(6));

Table created.

SQL> insert into students values('89187');

1 row created.

SQL> insert into students values('S56789');

1 row created.

SQL> insert into students values('s78900');

1 row created.

SQL> commit;

Commit complete.

SQL> select *
  2 from students;

STDNT_



89187
S56789
s78900

SQL> select replace(upper(stdnt_num), 'S', '')   2 from students;

REPLAC



89187
56789
78900

SQL> 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
> ******
Received on Thu Sep 22 2005 - 13:49:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US