Link to home
Start Free TrialLog in
Avatar of Becky Edwards
Becky EdwardsFlag for United States of America

asked on

How to truncate a string

This may sound simple to you, but not to me.  I need to create a formula in Oracle Crystal that removes the first 4 characters in a field and leaves me with the rest of the field to show.  Then I want to be able to use this new formula/field to evaluate the contents and provide a select statement from it.

Example:  "ICD-401.01"  This is the contents of the field.  I need a new field with just 401.01 in it and then reference that field in a select statement that says {field} = [401.01, 401.02, 401.11, 456.24]
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

I'm not a Crystal person but can help with the SQL.

Turning ICD-401.01 into 401.01 is easy:
select substr('ICD-401.01',5) from dual;

I have no idea what you mean by:
reference that field in a select statement that says {field} = [401.01, 401.02, 401.11, 456.24]

Maybe:
select 'Found it' from dual where substr('ICD-401.01',5) in (401.01, 401.02, 401.11, 456.24);
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi, do you need it in oracle or some other ?
Avatar of Becky Edwards

ASKER

This worked perfectly.  Thank you.