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: Oracle For Fun

Re: Oracle For Fun

From: Jeff <jeff_at_work.com>
Date: Mon, 02 Feb 2004 14:58:57 GMT
Message-ID: <bvlojh$mti$1@cronkite.cc.uga.edu>


In article <1075682270.753428_at_yasure>, Daniel Morgan <damorgan_at_x.washington.edu> wrote:

>The contestants and results can be found at:
>http://www.psoug.org/sql_fun.html
>
>One lesson comes through very clearly from the results ... test, test,
>test. Don't be too quick to think you know what's best just by looking
>at the code you've written.

Now, here I thought the object was to be as concise as possible.

Of the four solutions, I think translate3 comes closest to winning the "most elegant" award. Translate2 should be disqualified because it doesn't handle null values... but it does offer a refinement to translate3:

create or replace function translate3(p_code varchar2) return boolean is

begin
  return translate(nvl(p_code,'x'),'0123456789','9999999999')='999-999-9999'; end translate3; Received on Mon Feb 02 2004 - 08:58:57 CST

Original text of this message

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