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
What is not equal to in oracle?
How would you go about verifying the network name that the local_listener is currently using?
What is logical backup in oracle?
How translate command is different from replace?
Explain the use of control file?
How to divide query output into groups in oracle?
How to delete a user account in oracle?
What are the differences between date and timestamp in oracle?
Does oracle database need java?
I have a database backup file in .db (ext) form how to conver it into .dmp (ext.) for oracle database
Can group functions be used in the order by clause in oracle?
What are group functions in oracle?
How can I introduce multiple conditions in like operator?
What is meant by recursive hints in oracle?
How to select all columns of all rows from a table in oracle?