ex. one table is having 1 column with 10 records ,
then how to display all the values in row wise ?

Answer Posted / dinesh a.

create table x (col1 number(4));
insert into x value(1);
....
...
insert into x value(10); /* upto 10 rows

then

select
substr(max(decode(rownum,1,col1,0)),1,2),
substr(max(decode(rownum,2,col1,0)),1,2),
substr(max(decode(rownum,3,col1,0)),1,2),
substr(max(decode(rownum,4,col1,0)),1,2),
substr(max(decode(rownum,5,col1,0)),1,2),
substr(max(decode(rownum,6,col1,0)),1,2),
substr(max(decode(rownum,7,col1,0)),1,2),
substr(max(decode(rownum,8,col1,0)),1,2),
substr(max(decode(rownum,9,col1,0)),1,2),
substr(max(decode(rownum,10,col1,0)),1,2)
from x

(where substr only to reduce display size )

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to define an anonymous procedure without variables?

752


When system tablespace is created?

789


Explain integrity constraint?

877


What is null value in oracle?

834


Is there any way to find out when one specific table/view/M-view is used last time. i.e. when one specific object is used in any SELECT statement.

1075


Explain about your project and its relation to the current job position you are applying to?

762


What are the different editions of oracle?

827


How to check the server version in oracle?

820


Is java required for oracle client?

730


Explain a data segment?

843


How can we delete duplicate rows in a table?

740


Differentiate between post-database commit and post-form commit?

777


How to insert multiple rows with one insert statement in oracle?

788


How does propagation differ between Advanced Replication and Snapshot Replication (read-only)?

2041


What is MTTR advisor in Oracle?

829