Re: LTRIM

From: Werner Fangmeier <werner.fangmeier_at_esn-bochum.de>
Date: 30 Apr 2003 05:49:40 -0700
Message-ID: <a1a0416b.0304300449.71daf4f6_at_posting.google.com>


gelangov_at_hotmail.com (Geetha) wrote in message news:<4b40e20a.0304290739.112d174a_at_posting.google.com>...
> I ran the following sql statement:
> SELECT CONSTRAINT_NAME
>
> FROM user_constraints
> WHERE trim (constraint_name) LIKE
> 'NN\_DIAGAXIS1\_ID$%' escape '\'
> and I got these results
> NN_DIAGAXIS1_ID$1
> NN_DIAGAXIS1_ID$2
> But when I run this:
> SELECT constraint_name, LTRIM (constraint_name,
> 'NN_DIAGAXIS1_ID$') as trimmed_result
> FROM user_constraints WHERE trim (constraint_name) LIKE
> 'NN\_DIAGAXIS1\_ID$%' escape '\'
> I get the following:
> CONSTRAINT_NAME TRIMMED_RESULT
> ------------------------------ ------------------------------
> NN_DIAGAXIS1_ID$1
> NN_DIAGAXIS1_ID$2 2
> My question is why do I NOT get anything for the Trimmed_Result for
> the constraint_name
> NN_DIAGAXIS1_ID$1?
I assume you misinterpret the usage of the 2nd argument of LTRIM()! It's a SET of characters, and not a string! Since '1' is part of the "set" 'NN_DIAGAXIS1_ID$', it is trimmed away, since removing all characters in the set {'N', '_', 'D', 'I', 'A', 'G', 'X', 'S', '1'} (duplicates removed, since it is a set, not a sequence) from the beginning of the string 'NN_DIAGAXIS1_ID$1' leaves nothing!

HTH Received on Wed Apr 30 2003 - 14:49:40 CEST

Original text of this message