cust id,cust quty like 1,101;1,102;1,103 i want output like
cust id,cust quty 1 101,102,103 in oracle please write a
query in oracle

Answers were Sorted based on User's Feedback



cust id,cust quty like 1,101;1,102;1,103 i want output like cust id,cust quty 1 101,102,103 in ora..

Answer / subhash

PIVOT finction available from ORCLE 11g Onwards:

SELECT *
FROM (SELECT customer_id, customer_quantity
FROM pivot_test)
PIVOT (customer_quantity FOR (customer_quantity
) IN (101, 102, 103))
ORDER BY customer_id;


Output:
1 101 102 103

Is This Answer Correct ?    2 Yes 0 No

cust id,cust quty like 1,101;1,102;1,103 i want output like cust id,cust quty 1 101,102,103 in ora..

Answer / subhash

SELECT
CUST_ID,
DECODE(CUST_ID,'101',CUST_QUTY) AS CUST_QUTY1,
DECODE(CUST_ID,'102',CUST_QUTY) AS CUST_QUTY2,
DECODE(CUST_ID,'103',CUST_QUTY) AS CUST_QUTY3
FROM TABLE_NAME
GROUP BY CUST_ID;

Is This Answer Correct ?    1 Yes 1 No

cust id,cust quty like 1,101;1,102;1,103 i want output like cust id,cust quty 1 101,102,103 in ora..

Answer / srinu

select translate('1,101;1,102;1,103','1,101;1,102;1,103',1
101,102,103) from dual;

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More Data Stage Interview Questions

How to Remove Duplicate using SQL?

0 Answers   CTS,


Have you used Unstructured data?

0 Answers   CTS,


I have 2 Files like fileA fileB Output1 Output2 Output3 1 6 1 6 11 2 7 2 7 12 3 8 3 8 13 4 9 4 9 14 5 10 5 10 15 6 11 7 12 8 13 9 14 10 15 please let know

6 Answers  


can we half project in parallel jobs and half project in server jobs?

4 Answers   Infosys, L&T,


1)i put Pharma Project in my Resume..whar are the sources used in my project Generally? 2)how many fact and dimensional tables used? 3)Have u used any Datamarts and measues in fact table? ....plz give the answers...

2 Answers   iGate,






iam new to datastage...now i want to know what are fact tables, dimension tables in bank domain...if any body knows plz tell me asap..

4 Answers   Wipro,


How many number of reject links merge stage can have?

7 Answers   TCS,


Source contains the metadata source ----- hyderabad,chennai,bangalore by using nested loop sequence select source as hyderabad in target just run target as hyderabad only not others please give me answer thanks in advance(give reply how to wrote logic using nested loop sequence)

1 Answers   IBM,


What is Cleanup Resources and when do you use it?

2 Answers  


What are the types of hashed files in data stage

0 Answers  


how can you generate sequence number using only the sequential file stage?

3 Answers   TIAA CREF,


What are the steps needed to create a simple basic datastage job?

0 Answers  


Categories