从Oracle表中选择所有列和常量值

时间:2022-05-05 03:33:14

How can I select all columns and add a column with a constant value in Oracle?

如何选择所有列并在Oracle中添加具有常量值的列?

With MS SQL Server, I can use:

使用MS SQL Server,我可以使用:

Select *,5 From TableA;

I will get this:

我会得到这个:

column1      column2    5
xx           xx         5
xx           xx         5

3 个解决方案

#1


10  

See this tutorial: Select constant as a Column

请参阅本教程:选择常量作为列

Select *,5 as "ConstColumn" From TableA;

#2


6  

Try,

Select TableA.*, 5 as "ColumnAlias" From TableA

#3


0  

For a string I was able to do this with 11g:

对于一个字符串,我能够用11g做到这一点:

SELECT A1.*, 'ActionType' as "OptionType"
FROM TableA A1;

#1


10  

See this tutorial: Select constant as a Column

请参阅本教程:选择常量作为列

Select *,5 as "ConstColumn" From TableA;

#2


6  

Try,

Select TableA.*, 5 as "ColumnAlias" From TableA

#3


0  

For a string I was able to do this with 11g:

对于一个字符串,我能够用11g做到这一点:

SELECT A1.*, 'ActionType' as "OptionType"
FROM TableA A1;