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 Charaters

Re: Truncating Certain Charaters

From: Daniel Fink <danielwfink_at_yahoo.com>
Date: 22 Sep 2005 07:44:09 -0700
Message-ID: <1127400249.515427.186230@f14g2000cwb.googlegroups.com>


If the rule is to return the STDNT_NUM without the S, regardless of where the S appears, you can use REPLACE.

SQL*Plus: Release 9.0.1.4.0 - Production on Thu Sep 22 08:38:07 2005

(c) Copyright 2001 Oracle Corporation. All rights reserved.

SQL> create table t1 (s_num varchar2(10));

Table created.

SQL> insert into t1 values ('12345');

1 row created.

SQL> c/12345/S1234
  1* insert into t1 values ('S1234')
SQL> / 1 row created.

SQL> c/1234/12345
  1* insert into t1 values ('S12345')
SQL> / 1 row created.

SQL> select * from t1;

S_NUM



12345
S1234
S12345

SQL> select replace(s_num, 'S')
  2 from t1;

REPLACE(S_



12345
1234
12345

Regards,
Daniel Fink Received on Thu Sep 22 2005 - 09:44:09 CDT

Original text of this message

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