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 have a project manager round on sat this week can you post what are the main question i have to check.if you have any idea regular question on project pls send me. thanks in advance

2 Answers   IBM,


what is Audit table?Have u use audit table in ur project?

3 Answers   Accenture, Wipro,


A job is having only 2 stages I/p dataset and target table.Job is taking very long time to load 50 million records.How to improve performance of this job.

3 Answers   IBM,


i have flat file and using unix how can i generate sequence number into targer?

1 Answers   Cap Gemini,


on how many columns we can perform aggregation in the aggregator stage?

2 Answers   Reliance,






what is the use of surogate key in datastage

3 Answers  


can a fact table contains textual information

6 Answers   HCL, HCL BSERV, IBM,


wt is the difference between swith and filter stage

6 Answers   IBM,


What all are the different way to run a job?

0 Answers  


What is apt_config in datastage?

0 Answers  


what is the use of surogate key in datastage

0 Answers   TCS,


What are the components of ascential data stage?

0 Answers  


Categories