Oracle – Setting Up Variables for login.sql

oracle

I use this login.sql for my oracle session

select           'You are:          '||upper(user) "Welcome to Oracle on AIX 7.1" from dual
union all select 'Logged into:      '||upper(sys_context('userenv','db_name')) from dual
union all select 'Database Version: '||banner from v$version where rownum <= 2;

Instead of using AIX is possible to get some variable?
So when i connect on linux server it doesn't return AIX
I know variable is &variable,but how to set a variable using
sql command "select from..etc"?

Best Answer

Unless you absolutely have to have the platform as part of the alias, I would simply pull the platform from v$database:

select 'You are:          '||upper(user)  "Welcome" from dual union all
select 'Logged into:      '||upper(sys_context('userenv','db_name')) from dual union all
select 'Database Version: '||banner from v$version where rownum <= 2 union all
select 'On Platform:      '||platform_name from v$database;