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: SQL and ORA-1722 error?? Seeking Your Help

Re: SQL and ORA-1722 error?? Seeking Your Help

From: Dave Wotton <Dave.Wotton_at_it.camcnty.gov.uk>
Date: 1997/07/31
Message-ID: <5rqeou$nu7@dns.camcnty.gov.uk>#1/1

Hi,

missed the original posting, just saw the reply from Fransisco Piragibe, so not sure of the original requirement. But, for what its worth ....

You could try the following

   select car.carid

     from ls_dba.car,
          ls_dba.bodytype
    where ls_dba.car.carid=ls_dba.bodytype.carid
      and car.car_type is NULL
      and bodytype.carfabricmethod =500
      and to_number( decode(translate(car.carid,'0123456789','XXXXXXXXX'),
                    'XXXXXXXXXX',car.carid,0))
          between 3000000
          and 40000000

The translate converts all digits to X's. The decode tests if the result is all X's, ie. the original was a number, and if so it returns car.carid to to_number. If the carid contains non-digits, the translate does not return all X's,so the decode returns 0 to to_number, and the row is rejected.

There are 10 X's in the first string. The second string of X's is as long as the number of characters in a carid field. If the carid field can contain a variable number of characters, replace the second string of X's by:

     substr('XXXXXXXXXXXX',1,length(car.carid))

Sorry, its messy and not efficient ( can't use an index on car.carid )

but hope it helps.

Dave. Received on Thu Jul 31 1997 - 00:00:00 CDT

Original text of this message

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