Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

Answers were Sorted based on User's Feedback

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

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

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

select wm_concat(rel)
from UPDATE_TEST

 Is This Answer Correct ? 0 Yes 0 No

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

it will need a cursor.

begin
for cur1 in (select a from Name) loop
dbms_output.put(cur1.a);
end loop;
end;

dbms_output.put -> displays a chr without putting a new line

 Is This Answer Correct ? 0 Yes 1 No

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

column can be convert in row by using PIVOT function in ORACLE

for eg:

 Is This Answer Correct ? 0 Yes 3 No

More Oracle General Interview Questions

What are the limitations of check constraint?

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

What are the differences between char and varchar2 in oracle?

what is dynamic SGA and static SGA

What are the composite date types in oracle?

Explain the use of analyse option in exp command.

How to concatenate two text values in oracle?

How to invoke the data pump import utility?

Table1- have two column filename data AFGDFD-20112011 hi how r u bsdasd-23042011 name shoud be in bold Now i want output like filename data AFGDFD hi how r u bsdasd name shoud be in bold Kindly answer this

what is primary key and foreign key when and where have to use

Can we connect to ORACLE db using Windows Authentication?

How do you recover a datafile that has not been physically been backed up since its creation and has been deleted. Provide syntax example.

Categories
• Oracle General (1789)
• Oracle DBA (Database Administration) (261)
• Oracle Call Interface (OCI) (10)
• Oracle Architecture (90)
• Oracle Security (38)
• Oracle Forms Reports (509)
• Oracle Data Integrator (ODI) (120)
• Oracle ETL (15)
• Oracle RAC (93)
• Oracle D2K (72)
• Oracle AllOther (241)