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

what are actual and formal parameters?

596


What is literal?

589


How to set up autotrace for a user account?

594


What are the differences between char and varchar2 in oracle?

563


How to define a record variable to store a table row?

577






How to invoke the data pump export utility?

561


What is the difference between view and materialized view in Oracle?

607


How to connect to a remote server?

554


How is it different from a normal table?

580


What is an oracle?

577


Name the three major set of files on disk that compose a database in Oracle?

633


what are bitmap indexes? How does they work?

1716


Explain a data segment?

648


what is the use of system.effective.date variable in oracle?

671


How to delete a column in an existing table?

593