Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Column names cannot be set dynamically in Oracle PL/SQL by referring to another table. Column names are part of the table structure and must be explicitly defined when the table is created. However, you can use aliases to rename columns when selecting data from tables. Aliases are created using the AS keyword followed by the new column name. Here's an example:

SELECT t1.column1 AS newcolumnname FROM table1 t1 INNER JOIN table2 t2 ON t1.column2 = t2.column3;

In this example, the column name "column1" from "table1" is given the alias "newcolumnname" which can be used in subsequent references to the column.