Home » SQL & PL/SQL » SQL & PL/SQL » Is it possible top create a database-wide Table Column Alias?
Is it possible top create a database-wide Table Column Alias? [message #211603] Fri, 29 December 2006 16:22 Go to next message
jasonennor
Messages: 1
Registered: December 2006
Junior Member
I have two groups of users, each wants a different name for a column in a particular Table.

For example:

One group wishes to SELECT surname FROM employee;
The other would like to SELECT last_name FROM employee;

Using a Column alias in every SELECT statement is not satisfactory
Using a View means having to use a different 'Table' (View) name for each SELECT statement.
Re: Is it possible top create a database-wide Table Column Alias? [message #211609 is a reply to message #211603] Fri, 29 December 2006 22:38 Go to previous messageGo to next message
amul
Messages: 252
Registered: April 2001
Location: Chennai
Senior Member
no
Re: Is it possible top create a database-wide Table Column Alias? [message #211638 is a reply to message #211603] Sat, 30 December 2006 04:36 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
jasonennor
Using a View means having to use a different 'Table' (View) name for each SELECT statement.


Says who?
SQL> create view v_emp as
  2    select deptno, empno, ename surname, ename last_name
  3    from emp;

View created.

SQL> select empno, surname from v_emp where deptno = 10;

     EMPNO SURNAME
---------- ----------
      7782 CLARK
      7839 KING
      7934 MILLER

SQL> select empno, last_name from v_emp where deptno = 10;

     EMPNO LAST_NAME
---------- ----------
      7782 CLARK
      7839 KING
      7934 MILLER

SQL>


Re: Is it possible top create a database-wide Table Column Alias? [message #211640 is a reply to message #211603] Sat, 30 December 2006 05:41 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
jasonennor wrote on Fri, 29 December 2006 23:22
I have two groups of users, each wants a different name for a column in a particular Table.



Before you lose yourself in all kinds of strange constructions, I think you should ask WHY your users want this.
Who are these users anyway? End-users or developers?
If they are end-users, it is not uncommon to not give them access to the actual tables anyway, but create a set of views, combining 'logical' elements from different tables.
If they are developers, well too bad for them, they have to stop whining and get a life Wink
Previous Topic: Some typical questions
Next Topic: check status of database via dblink?
Goto Forum:
  


Current Time: Sat Dec 10 01:27:40 CST 2016

Total time taken to generate the page: 0.08381 seconds