View/Edit View dropping column aliases

nmajdan

Member²
I am not sure what is causing this issue. We have a few views that have been given different aliases for columns, but, when we right-click on the view and choose "View" or "Edit", the aliases are being left off. Obviously, this can be dangerous because if we reuse this generated code, it will change the column names and throw off anything that hits the view.

However, I have not been able to reproduce the problem. I tried creating a view like:

Code:
CREATE OR REPLACE view plsql_example AS SELECT log_mode modelog, platform_id platid FROM v$database;

But when I tried to View or Edit the source, it came out fine.

Here are some screenshots of what I see in the application:http://imgur.com/Ik3MH

Again, I have been unable to reproduce this issue with a new view; it just appears on our existing views. Any insight into this would be appreciated.
 
This can happen if you use a separate alias list when creating the view. If you subsequently retrieve the DLL for this view and are connected as a user that does not have privileges on the objects of the select statement of the view, then the alias list cannot be determined. For example:

Code:
create or replace view dept_sal
  (deptno, sal_total)
as
  select deptno, sum(sal)
  from scott.emp
  group by deptno

If you retrieve the DDL for this view, but you don't have privileges on scott.emp, then the alias list will be gone.

Using inline aliases prevents these issues:

Code:
create or replace view dept_sal as
  select deptno, sum(sal) as sal_total
  from scott.emp
  group by deptno

 
Back
Top