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 are the ansi data types supported in oracle?
What is oracle join syntax?
How can we force the database to use the user specified rollback segment?
what is meant by magic query
State and explain the different types of data models?
what is port in oracle? how is it related to database application.
Hi friends can u send the oracle 9i full version download link?????????????? please reply ?
HI, Please let me know the syllabus for Oracle OCA and OCP Certification
What are nested tables?
what's query optimization and without use of IN AND Exist can we get another way data from query
How to connect to a local oracle 10g xe server?
What is a select query statement in oracle?
How to use attributes of the implicit cursor in oracle?
Why is oracle used?
How do I manually uninstall oracle client?