0

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"?

0

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;
  • You might also want to set the prompt. This will get updated everytime you connect to a new database. set editfile "/tmp/_USER_CONNECT_IDENTIFIER_PRIVILEGE.buf" set sqlprompt "_USER'@'_CONNECT_IDENTIFIER _PRIVILEGE> " – Gandolf989 Nov 16 '15 at 18:18
  • @Gandolf989 I considered saying something about prompts, but it seemed to be outside the scope of the question. I use the following myself: SELECT LOWER(SYS_CONTEXT('USERENV','CURRENT_USER')) || '@' || LOWER(SYS_CONTEXT('USERENV','DB_UNIQUE_NAME')) as sqlprompt FROM DUAL; set SQLPROMPT '&sqlprompt> ' – Kris Johnston Nov 16 '15 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.