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

Is rowid unique in oracle?

538


What is a cursor and what are the steps need to be taken?

605


How will you differentiate between varchar & varchar2?

596


What is partitioned table in Oracle?

650


What is a system tablespace and when it is created?

569






Explain the use of parfile option in exp command.

536


Define the SGA and: How you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA?

1866


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

556


If any one has information regarding interview of NIC (National Informatics Centre),it would be of great help...

1741


What are the types of trigger in oracle?

585


Explain the different normalization forms?

603


How to calculate date and time differences in oracle?

542


How to use subqueries with the exists operator in oracle?

612


what is the scenario where you take the database to NoArchivelog mode?

1852


Can a formula column be obtained through a select statement ?

1853