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

i want send my all duplicate record one tar and all uniq records one target how we will perfome explain example: input data eid 251 251 456 456 951 985 out put/target1 251 251 456 456 out put/target2 951 985 how we will bring

13 Answers   Bank Of America, IBM,


What are stage variables?

0 Answers  


Hi any one has datasatge 8.5 certication dump could you please provide your details i will contact you. send reply to my mail rajaadivi@gmail.com Thanks in Advance

2 Answers  


What is lookup table?

5 Answers  


if a column contains data like ram,rakesh,madhan,suraj,pradeep,bhaskar then I want to place names separated by commas in another columns how can we do?

5 Answers  






source 1123445 I WANT OUTPUT AS DUPLICATES TO TARGET1 LIKE TARGET1 1144 NON-DUPLICATES TO TARGET2 TARGET2 235

6 Answers   US Technology,


Can you explain how could anyone drop the index before loading the data in target in datastage?

0 Answers  


1.When did 8.1 parallel came into existence? 2.What is the difference between 7.5 and 8.1?

2 Answers   Mind Tree,


what is the differeces between hash and modulus partition methods

4 Answers   TCS,


Can you explain engine tier in information server?

0 Answers  


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,


How do you remove duplicate values in datastage?

0 Answers  


Categories