Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

I have a table emp. There is only one column in the table.
In that , there are only three rows in that column.
The value in the first row is 'A' and the value in the
second row is 'B' and the third row is 'C'. Now, my question
is ,

How will you write a select query to display the output as
B
C
A

Note: order by cannot be used coz it gives us output as CBA.
But the output should be BCA.

Answer Posted / ajitnayak

declare
type samp_type is table of VARCHAR2(20)
index by binary_integer;

table_type samp_type;

cursor c1 is
select Colum-Name from Table_name;

begin
open c1;

fetch c1 bulk collect into table_type;

close c1;

for i in reverse 1..4 loop
dbms_output.put_line(table_type(i));
end loop;
end;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between open_form and call_form in oracle.

1220


Explain the dml?

1043


What is memory advisor in Oracle?

1131


How to define a data source name (dsn) in odbc manager?

1079


What happens if the update subquery returns multiple rows?

1166


What is blob data type in oracle?

1205


How would you change old and new values in an insert, delete and update triggers?

1075


What are the limitations oracle database 10g xe?

1091


What exactly do quotation marks around the table name do?

1024


How to invoke the original export import utilities?

1132


How many types of auditing in Oracle?

1086


What is a tns service name?

1056


What is the difference between pre-select and pre-query?

1299


how the Oracle Prepares the Execution Plan and how it chooses the Optimal one?

2408


How do you find current date and time in oracle?

1099