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: Quiz

Re: Quiz

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Sat, 25 Oct 2003 09:06:48 -0700
Message-ID: <1067098024.763166@yasure>


Kenneth wrote:

>Comments below.
>On Sat, 25 Oct 2003 05:20:33 GMT, "nobody" <nobody_at_nowhere.com> wrote:
>
>
>
>>must be bored or unemployed
>>
>>1)
>>select *
>>from test a
>>where date_out in (select min(date_out)
>>from test where location=a.location)
>>
>>
>>
>>
>
>
>
>>ok I cheated and should spell out the elements instead of *
>>
>>2) Unless there is some new function in 9i that I am unaware of. I dont see
>>how to do this without using a function that returns the locations of a
>>character within a string to ensure
>>that the brackets and space are in the correct place . without using
>>instring or substring.
>>
>>
>>
>
>Hmm...but you could use SUBSTR and INSTR...INSTRING and SUBSTRING are
>not even present in Oracle...a trick question, I guess....
>
>But even without SUBSTR and INSTR, you can do it :
>
>The number must be of length 14. It must start with a '(', the fifth
>character must be ')',
>the 7th character must be a '-', the 6th and 8th must be spaces. The
>rest are digits So :
>
>create or replace function check_number(number in varchar2)
>is
>begin
> return (
>
> number like '(___) ___-____'
> and ltrim(translate(number,'()- 0123456789',' ')) is null;
> );
>end check_number;
>
>

Very close to the solution I used in class. I like it.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Sat Oct 25 2003 - 11:06:48 CDT

Original text of this message

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