2

test_table:

id   f_name     l_name  age  
--  --------- --------   ------ 

I am new to oracle, but if I want to select all the columns I should use

select * from test_table

however if I want to select all the columns except age I should write

select id, f_name, l_name from test_table

Is there a way I can select all the columns but disgarding a column or two?

Because in my work busninse there alot of columns and sometimes I don't need to select them all.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Moudiz
  • 7,211
  • 22
  • 78
  • 156

2 Answers2

6

You can't.

The only thing that comes into my mind is to create a VIEW for your SELECT statement.

CREATE VIEW employeeList
AS
SELECT id, f_name, l_name -- <<== select only the column you want to project
FROM  test_table;

once your VIEW is created, you can now use * against the view,

SELECT * FROM employeeList
John Woo
  • 258,903
  • 69
  • 498
  • 492
  • i have different tables , every time i write a procedure or a querry i have to use different table or column to get specific data or result, so view doenst help me all the time – Moudiz Apr 26 '13 at 09:16
0

It's not possible. Either you can SELECT * or you can define which columns you want to select. There is no such SELECT clause in oracle that allows you to return all columns except some automatically. Reference

Hanky Panky
  • 46,730
  • 8
  • 72
  • 95