Home » SQL & PL/SQL » SQL & PL/SQL » Hide a column in Select clause ( 9.2.0.1.0 )
|
|
Re: Hide a column in Select clause [message #519338 is a reply to message #519333] |
Thu, 11 August 2011 02:48   |
 |
OraFerro
Messages: 433 Registered: July 2011
|
Senior Member |
|
|
Hi Michel,
I guess I asked the wrong question. I need to shows all company departments. But I need to sort them in a way that does not follow a specific criterion (for example: CEO then IT, then Sales then the rest in alphabetical order).
create table try_departement (dep_id number(2), dep_name varchar2(30));
INSERT ALL
INTO try_departement VALUES (1, 'SALES')
INTO try_departement VALUES (2, 'CEO')
INTO try_departement VALUES (3, 'MARKETING')
INTO try_departement VALUES (4, 'IT')
INTO try_departement VALUES (5, 'SECURITY')
INTO try_departement VALUES (6, 'HR')
SELECT * FROM DUAL;
How can I do that?
Thanks
|
|
|
Re: Hide a column in Select clause [message #519339 is a reply to message #519338] |
Thu, 11 August 2011 02:57   |
 |
Michel Cadot
Messages: 68758 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
SQL> select * from try_departement
2 order by decode(dep_name, 'CEO', 1, 'IT', 2, 'SALES', 3, 4), dep_name
3 /
DEP_ID DEP_NAME
---------- ------------------------------
2 CEO
4 IT
1 SALES
6 HR
3 MARKETING
5 SECURITY
Regards
Michel
|
|
|
|
|
|
Goto Forum:
Current Time: Wed May 28 03:11:26 CDT 2025
|