Home » SQL & PL/SQL » SQL & PL/SQL » Hide a column in Select clause ( 9.2.0.1.0 )
- Hide a column in Select clause [message #519329] Thu, 11 August 2011 02:12 Go to next message
OraFerro
Messages: 433
Registered: July 2011
Senior Member
Hi All,

I need to know if it is possible to hide one or more of the columns in my SELECT statement as I only need them in there where clause.

Thanks,
- Re: Hide a column in Select clause [message #519333 is a reply to message #519329] Thu, 11 August 2011 02:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68758
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You don't need to select a column you don't need to see, even if you use it in a where clause.
This restriction was in version 1 of ODBC, almost 20 years ago.

Regards
Michel

[Updated on: Thu, 11 August 2011 02:39]

Report message to a moderator

- Re: Hide a column in Select clause [message #519338 is a reply to message #519333] Thu, 11 August 2011 02:48 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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
- Re: Hide a column in Select clause [message #519342 is a reply to message #519339] Thu, 11 August 2011 03:28 Go to previous messageGo to next message
OraFerro
Messages: 433
Registered: July 2011
Senior Member
Thanks a lot and sorry for the inconvenience
- Re: Hide a column in Select clause [message #519455 is a reply to message #519339] Fri, 12 August 2011 05:29 Go to previous messageGo to next message
yabhi_22
Messages: 7
Registered: August 2011
Location: India
Junior Member
Michel,

Thanks for sharing this.
- Re: Hide a column in Select clause [message #519457 is a reply to message #519455] Fri, 12 August 2011 05:32 Go to previous message
yabhi_22
Messages: 7
Registered: August 2011
Location: India
Junior Member
yabhi_22 wrote on Fri, 12 August 2011 15:59
Michel,

Thanks for sharing this.


Forgot to add...since I am part of operations team in my company I was losing all touch with oracle pl/sql coding and was missing it like hell.
When I joined this forum I had no idea how much wonderful things will be shared here.
And looking at all the different posts Man...I like it.
Thanks to All for making such a quality forum
Previous Topic: write log when procedure execution is successful
Next Topic: Pipeline Function -- no rows returned
Goto Forum:
  


Current Time: Wed May 28 03:11:26 CDT 2025