|
Re: How column name of a database column can be changed at runtime [message #544264 is a reply to message #544240] |
Tue, 21 February 2012 00:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21818 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote:change the database column name of the item in the form for that block at run time.
I don't think that you can do that. If there was, it would be handled by SET_ITEM_PROPERTY. But, unless I'm wrong, there's no "DATABASE_ITEM" or similar property.
The simplest way would be to rename a column:SQL> desc test
Name Null? Type
----------------------------------------- -------- ----------------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOC VARCHAR2(13)
SQL> alter table test rename column loc to location;
Table altered.
SQL> desc test
Name Null? Type
----------------------------------------- -------- ----------------------------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14)
LOCATION VARCHAR2(13)
SQL>
That might be tricky if a table (and its column) is referenced elsewhere (in other forms, reports, stored procedures, etc.).
If that's not possible, perhaps you could create a view and unify column names, and then create a form on a view:
SQL> create or replace view view_form as
2 select 'ENV_1' environment, deptno, dname, loc
3 from dept
4 union
5 select 'ENV_2' environment, deptno, dname, location
6 from test;
View created.
SQL> select * from view_form
2 where environment = 'ENV_2';
ENVIR DEPTNO DNAME LOC
----- ---------- -------------- -------------
ENV_2 10 ACCOUNTING NEW YORK
ENV_2 20 RESEARCH DALLAS
ENV_2 30 SALES CHICAGO
ENV_2 40 OPERATIONS BOSTON
SQL>
Someone else might have a better idea, though.
|
|
|
|