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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the things to be considered while creating secondary index?

726


Discuss the advantages of using partitioned primary index in a query?

616


Can we have an unconnected lkp to lookup a db2 record against a teradata record? Doesnt seem to work. I could be wrong

736


Comment whether bottleneck is an error or not.

699


What is the use of fallback?

639






How do you verify a complicated sql?

737


What is a node in teradata?

660


Explain the advantages of partitioned primary index in a query?

674


how can we analyze the locks ?

1779


Describe the between keyword in teradata?

710


What are the various etl tools in the market?

679


Backup Script was blocked then you are unable to archive the data. how do you analyze it and where do you identify ?

1595


How many sessions of MAX is PE capable of handling at a particular time?

693


Let us say there is a file that consists of 100 records out of which we need to skip the first and the last 20 records. What will the code snippet?

817


If I wanted to run a TPump job only once per day - basically working on a file that is produced once per day - how would you set up the parameters for that sort of job ?

2007