I am trying to a add a custom title to my sql query result in APEX sql command, can't seem to find a solution how.
The title is something like this:
"My custom title on top of the columns"
Customer Name | Stock Number | Date Hired | Model Name
I am trying to a add a custom title to my sql query result in APEX sql command, can't seem to find a solution how.
The title is something like this:
"My custom title on top of the columns"
Customer Name | Stock Number | Date Hired | Model Name
You mean something like this?
SELECT [table_column1] as "Customer Name",
[table_column2] as "Stock Number",
[table_column3] as "Date Hired",
[table_column4] as "Model Name"
FROM [table_name];
From what you clarified in the comments it appears you are looking to set the title for an area.
That depends what area it is, probably either an interactive report or interactive grid. The attributes of those have a setting to set the title.
You can use Oracle alias including column and table aliases to make the heading of the output more meaningful and to improve readability of a query.
To instruct Oracle to use a column alias, you simply list the column alias next to the column name in the SELECT clause as shown below:
SELECT
first_name AS forename,
last_name AS surname
FROM
employees;
The AS keyword is used to distinguish between the column name and the column alias. Because the AS keyword is optional, you can skip it as follows:
SELECT
first_name forename,
last_name surname
FROM
employees;
By default, Oracle capitalizes the column heading in the query result. If you want to change the letter case of the column heading, you need to enclose it in quotation marks (“”).
SELECT
first_name "Forename",
last_name "Surname"
FROM
employees;
As shown in the output, the forename and surname column headings retain their letter cases.
If the column alias consists of only one word without special symbols like space, you don’t need to enclose it in quotation marks. Otherwise, you must enclose the column heading in quotation marks or you will get an error.
See the following query:
SELECT
first_name "First Name",
last_name "Family Name"
FROM
employees;