Select * from the table and still perform some functions in one column with the name

I would like to be able to return all columns in the table or in the resulting join table, and still be able to convert the date to a string by name.

for example

Select ID, DESCRIPTION, TO_CHAR (CHANGE_DATE, "YYYY-MM-DD HH24: MI: SS") AS FORMATED_DATE FROM MY_TABLE;

This is all good and useful only for these three columns. But the table will actually have many more columns and can be combined with other tables. I would like to be able to use a wildcard to get all the columns and still be able to do the TO_CHAR conversion.

Something like: SELECT *, (CHANGE_DATE, 'YYYY-MM-DD HH24: MI: SS') AS FORMATED_DATE FROM MY_TABLE;

As you would guess from TO_CHAR, I use Oracle, so I use PLSQL.

So my specific question is: is there any syntax that would allow me to select all columns (via *) and still be able to call the function in one column inside these columns.

+3
source share
5 answers

Closest you can do something like:

SELECT 
     MY_TABLE.*, 
     (CHANGE_DATE, 'YYYY-MM-DD HH24:MI:SS') AS FORMATED_DATE 
FROM MY_TABLE;
+4
source

Instead of lecturing, here. Oracle is a bit confusing than MSSQL, but it worked for me.

SELECT GENERAL.GOREMAL. *, ROWNUM, current date from GENERAL.GOREMAL

+2
source

:

SELECT T1.*, T2.*, x + y as some_Z

, ,

SELECT compute_foo() as aColumn, *

- - , .

+1

SQL Server , , , , Oracle. , .

FYI SELECT * , : -)

0

FYI, , *, , , , . , "select *", , , . , SQL Server , , ORacle - .

, select * , . , .

0

Source: https://habr.com/ru/post/1704663/


All Articles