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

Home -> Community -> Usenet -> comp.databases.oracle -> Re: basic plsql question

Re: basic plsql question

From: Wario <r0cky_at_insightbb.com>
Date: 30 Aug 2004 12:36:11 -0700
Message-ID: <9204a53e.0408301136.51b33314@posting.google.com>


This procedure is better. You could use the translate function alone, but the string parameters would make your code long and unwieldy.

create function word_fmt (word varchar2) return varchar2 is begin

    return translate(word,

        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
        'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9999999999'
    );
end;

if word_fmt('a52132') = 'X99999' then

    .....
end if;

or

if translate(word, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9999999999') =
'X99999' then

    ....
end if; Received on Mon Aug 30 2004 - 14:36:11 CDT

Original text of this message

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