string surch problum
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


string surch problum Expand / Collapse
Author
Message
Posted 11/8/2007 3:18:59 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 10/21/2008 12:23:18 PM
Posts: 13, Visits: 53
hi
i have a requirement like as
column1
---------
ADJEIW
adfrrt
12i#()
e fttg
213233

and i want to select all the rows which are not having A to Z any where in the attribute, spaces special char numbers can come
i am using substr and retriving each char and checking with a NOT IN ('A','B','C',.....,'Z') condation

is there any short cut to do


Regards,

Rahul

Win Win

Post #9659
Posted 11/8/2007 7:17:15 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 4:54:41 PM
Posts: 534, Visits: 285
Hi Rahul,
you could use
where col not like any ('%A%','%B%','%C%',...),
but this is quite ugly, too.

If there's the Oracle Translate function installed on your system, it's easy:
compare the string with the length of the string when A to Z characters are removed:

where str = otranslate(str, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', '')

Dieter
Post #9663
Posted 11/9/2007 11:35:02 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 11/27/2008 9:25:22 AM
Posts: 43, Visits: 51
Rahul,

Maybe the following helps you to accomplish what you are looking for:

create table test (id char(20));

insert test values ('ADJEIW');
insert test values ('adfrrt');
insert test values ('12i#()');
insert test values ('e fttg');
insert test values ('213233');

SELECT
CASE WHEN SUBSTRING(id FROM 1 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
AND SUBSTRING(id FROM 2 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
AND SUBSTRING(id FROM 3 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
AND SUBSTRING(id FROM 4 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
AND SUBSTRING(id FROM 5 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
AND SUBSTRING(id FROM 6 FOR 1) IN ('0','1','2','3','4','5','6','7','8','9')
THEN id
END as column1
FROM test
WHERE column1 IS NOT NULL;

Good luck.
Post #9671
Posted 11/9/2007 1:01:56 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 10/21/2008 12:23:18 PM
Posts: 13, Visits: 53
thank u ppl a lot

Regards,

Rahul

Win Win

Post #9674
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 1 ( 1 guest, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 5:06pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.047. 7 queries. Compression Disabled.