![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am usint 10g. I know that you can put a decode in the order by section. But I tried to see if it is possible to put a case statement in the order by section. My little experiment did not work. Has anyone in this forum successfully put a case statement in the order by section? If so, how did you do it. Below is a sample of what I tried to do. CREATE OR REPLACE PROCEDURE TestOrderBy ( *User_Choice * * * * * * *IN * * VARCHAR, *TestCur * * * *IN OUT Test_OrderBy.TEstCur ) IS Begin Open TestCur For * select object_name, User_Choice * from all_objects * Order by * * Case * * * * When User_Choice = 'A' Then object_name * * * Else Object_Name desc * * End; END TestOrderBy; |
#3
| |||
| |||
|
|
I am usint 10g. I know that you can put a decode in the order by section. But I tried to see if it is possible to put a case statement in the order by section. My little experiment did not work. Has anyone in this forum successfully put a case statement in the order by section? If so, how did you do it. Below is a sample of what I tried to do. CREATE OR REPLACE PROCEDURE TestOrderBy ( *User_Choice * * * * * * *IN * * VARCHAR, *TestCur * * * *IN OUT Test_OrderBy.TEstCur ) IS Begin Open TestCur For * select object_name, User_Choice * from all_objects * Order by * * Case * * * * When User_Choice = 'A' Then object_name * * * Else Object_Name desc * * End; END TestOrderBy; |
#4
| |||
| |||
|
|
I am usint 10g. I know that you can put a decode in the order by section. But I tried to see if it is possible to put a case statement in the order by section. My little experiment did not work. Has anyone in this forum successfully put a case statement in the order by section? If so, how did you do it. Below is a sample of what I tried to do. CREATE OR REPLACE PROCEDURE TestOrderBy ( *User_Choice * * * * * * *IN * * VARCHAR, *TestCur * * * *IN OUT Test_OrderBy.TEstCur ) IS Begin Open TestCur For * select object_name, User_Choice * from all_objects * Order by * * Case * * * * When User_Choice = 'A' Then object_name * * * Else Object_Name desc * * End; END TestOrderBy; |
#5
| |||
| |||
|
|
I am usint 10g. I know that you can put a decode in the order by section. But I tried to see if it is possible to put a case statement in the order by section. My little experiment did not work. Has anyone in this forum successfully put a case statement in the order by section? If so, how did you do it. Below is a sample of what I tried to do. CREATE OR REPLACE PROCEDURE TestOrderBy ( *User_Choice * * * * * * *IN * * VARCHAR, *TestCur * * * *IN OUT Test_OrderBy.TEstCur ) IS Begin Open TestCur For * select object_name, User_Choice * from all_objects * Order by * * Case * * * * When User_Choice = 'A' Then object_name * * * Else Object_Name desc * * End; END TestOrderBy; |
![]() |
| Thread Tools | |
| Display Modes | |
| |