Ask Your Question
4

How can column names be set in Oracle PL/SQL by referring to another table?

asked 2023-06-25 12:22:53 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-25 12:25:02 +0000

plato gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-25 12:22:53 +0000

Seen: 10 times

Last updated: Jun 25 '23