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.
Answers were Sorted based on User's Feedback
Answer / garv
SELECT DECODE (EEE,'A','B','B','C','A') EEE
FROM EMP
--EEE IS COLUMN NAME OF TABLE EMP
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / eswar reddy
declare one cursor ,PL/SQL TABLE
IN DBMS MENTIONED PRIOR,LAST,FIRST
Is This Answer Correct ? | 0 Yes | 0 No |
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 |
Query to get max and second max in oracle in one query ?
34 Answers CTS, Keane India Ltd, TCS, Wipro,
How do you find out from the RMAN catalog if a particular archive log has been backed-up?
HI, Please let me know the syllabus for Oracle OCA and OCP Certification
How does propagation differ between Advanced Replication and Snapshot Replication (read-only)?
How to connect to a remote server?
How to divide query output into groups in oracle?
What is the exact use of Collections?
what is mean by prmary key and foreign key and how can we diffrentiate that? Please answer me. Advance thanks.
What is the difference between a user and a schema in oracle?
If server is in US and client is in india there is timezone is diffrence, How can we display date in indian time when data is displayed from US server timezone?
How can return max date row A b c d e 1 2 1-mar-09 5 10 1 2 10-mar-09 5 10 Only using oracle predefined function. Not user defined. Output:-- A b c d e 1 2 10-mar-09 5 10
What is a cursor variable?