Hi Frnds this que is recently asked at IBM
there are two rows like aa6588fhfhf,gru282vbvv.
Question is howcan we retrive the first number from two
rows.
Can any one help

thanks in advance

Answers were Sorted based on User's Feedback



Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Questi..

Answer / tdguy

I hope substr function can be used but somewhat lengthy.
But UDF would make task easy.

SEL SIX
FROM
(
SEL
CASE
WHEN SUBSTR(COLUMN,1,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN '1' ELSE '' END AS ONE,
CASE
WHEN SUBSTR(COLUMN,2,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN '2' ELSE '' END AS TWO,
CASE
WHEN SUBSTR(COLUMN,3,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN '3' ELSE '' END AS THREE,
CASE
WHEN SUBSTR(COLUMN,4,1) IN
('1','2','3','4','5','6','7','8','9','0')
THEN '4' ELSE '' END AS FOUR,
SUBSTR(TRIM(ONE||TWO||THREE||FOUR),1,1) AS FIVE,
SUBSTR(COLUMN,FIVE,1) AS SIX
FROM TABLE
) A

Is This Answer Correct ?    4 Yes 0 No

Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Questi..

Answer / rkraju

Hi,gautam nice 2 see ur answer can u show me that output in
one sql.,
thanks in advance

Is This Answer Correct ?    1 Yes 0 No

Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Questi..

Answer / pavan

sel (case
when position('1' in name)>0 then substring(name from position('1' in name) for 1)
when position('2' in name)>0 then substring(name from position('2' in name) for 1)
when position('3' in name)>0 then substring(name from position('3' in name) for 1)
when position('4' in name)>0 then substring(name from position('4' in name) for 1)
when position('5' in name)>0 then substring(name from position('5' in name) for 1)
when position('6' in name)>0 then substring(name from position('6' in name) for 1)
when position('7' in name)>0 then substring(name from position('7' in name) for 1)
when position('8' in name)>0 then substring(name from position('8' in name) for 1)
when position('9' in name)>0 then substring(name from position('9' in name) for 1)
when position('0' in name)>0 then substring(name from position('0' in name) for 1)
else substring(name from 0 for 1)
end),name from ttemp.t2sel (case
when position('1' in name)>0 then substring(name from position('1' in name) for 1)
when position('2' in name)>0 then substring(name from position('2' in name) for 1)
when position('3' in name)>0 then substring(name from position('3' in name) for 1)
when position('4' in name)>0 then substring(name from position('4' in name) for 1)
when position('5' in name)>0 then substring(name from position('5' in name) for 1)
when position('6' in name)>0 then substring(name from position('6' in name) for 1)
when position('7' in name)>0 then substring(name from position('7' in name) for 1)
when position('8' in name)>0 then substring(name from position('8' in name) for 1)
when position('9' in name)>0 then substring(name from position('9' in name) for 1)
when position('0' in name)>0 then substring(name from position('0' in name) for 1)
else substring(name from 0 for 1)
end),name from ttemp.t2;

Is This Answer Correct ?    1 Yes 0 No

Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Questi..

Answer / santosh

sel regexp_substr('aa6588fhfhf','[[:digit:]]+')
Ans:6588

Is This Answer Correct ?    0 Yes 0 No

Hi Frnds this que is recently asked at IBM there are two rows like aa6588fhfhf,gru282vbvv. Questi..

Answer / ashutosh gautam

Use DIGITS("aa6588fhfhf") in transform it will return only
digit as 6588.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Teradata Interview Questions

In BTEQ, how are the session-mode parameters being set?

0 Answers  


What is differnce between Error code and Error Level in Bteq

6 Answers   IBM,


Does anyone got Latest TERADATA V12 Certification Dumps for the below? TE0-121 , TE0-122 , TE0-123 , TE0-124 , TE0-125 , TE0-126 TE0-127 , TE0-12Q

45 Answers  


Why do Hash joins usually perform better than Merge Joins?

1 Answers  


What do you mean by parsing?

0 Answers  






How many types of joins are there in teradata?

0 Answers  


Describe the set operators in teradata.

0 Answers  


Can you fastexport a field, which is primary key by putting equality on that key?

0 Answers  


How does indexing improve query performance?

4 Answers   Satyam,


i learn teradata,it is so intersting,now i want teradata certifications ,so any 1 help me to get teradata certifications TD 12 ? email:kdcrazyy@gmail.com

0 Answers  


What's the difference between timestamp (0) and timestamp (6)?

0 Answers  


What are the primary characteristics of the Teradata.

0 Answers  


Categories