This document contains SQL commands and queries to customize the SQL prompt and display current connection details. It sets variables like the database name, SQL prompt, and output formatting. It then runs queries to output the current date, language, session ID, database user, database name, server host, and displays the execution plan.
This document contains SQL commands and queries to customize the SQL prompt and display current connection details. It sets variables like the database name, SQL prompt, and output formatting. It then runs queries to output the current date, language, session ID, database user, database name, server host, and displays the execution plan.
This document contains SQL commands and queries to customize the SQL prompt and display current connection details. It sets variables like the database name, SQL prompt, and output formatting. It then runs queries to output the current date, language, session ID, database user, database name, server host, and displays the execution plan.
set tab off set trim off col db_name new_value db_name define db_name = 'SQL>' /***PLS MODIFY THE BELOW SQL AS PER YOUR REQUIREMENT OF VARIABLES AND COLOR ***/ select chr(27)||'[49m'||chr(27)||'[1m'||chr(27)||'[34m'|| upper(sys_context('USERENV','CURRENT_SCHEMA'))||chr(27)||'[39m'||'@'|| chr(27)||'['||decode(sys_context('USERENV','DB_NAME'), 'ORAIT', '32', '31')||'m'|| sys_context('USERENV','DB_NAME')||'>'||chr(27)||'[0m' db_name from dual; set sqlprompt '&db_name' set termout on set heading off SELECT chr(27) || '[0m' FROM DUAL UNION ALL SELECT '*********** Current connection details ***********' FROM DUAL UNION ALL SELECT 'Starting: ' || to_char(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') FROM DUAL UNION ALL SELECT 'Language: ' ||SYS_CONTEXT('USERENV', 'LANGUAGE') FROM DUAL UNION ALL SELECT 'SID : ' ||SYS_CONTEXT('USERENV', 'SID') FROM DUAL UNION ALL SELECT 'DB user : ' ||SYS_CONTEXT('USERENV', 'SESSION_USER') FROM DUAL UNION ALL SELECT 'Database: ' ||SYS_CONTEXT('USERENV', 'DB_UNIQUE_NAME') FROM DUAL UNION ALL SELECT 'Server : ' ||SYS_CONTEXT('USERENV', 'SERVER_HOST') FROM DUAL UNION ALL SELECT '*********** Current connection details ***********' FROM DUAL;
alias plan= SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR)
set heading on set trim on set tab on set feedback on set pagesize 50000