2017年4月22日 星期六

sqlplus color.sql



If you have seen a colored scripts like a fish from “Session Snapper v.4” by Tanel Poder or OraLatencyMap by Luca Canali, you may be also want to colorize your scripts.
I’ve created the script for this purposes with predefined substitution variables.
Just download colors.sql and use it like that:



in VI  插入 ESC 符號

Hi,
I need to send "^[" command to the buffer.
I tried to use insert within VIM and press 'ctrl' key and then '^' and '[' key.
but it didn't work.
CTRL + V +[
^[

在 Notepad 插入 ESC 符號
ALT + 27
出現  ESC

select open_mode
    , case  open_mode
when 'READ WRITE' then ' [42m OK [0m'
when 'READ ONLY' then  ' [42m NG!~~ [0m'
when 'MOUNTED' then    ' [41m NG!! [0m'
end  STATUS
from v$database;


@colors.sql;
prompt ::: &_C_RED ***  TEST PASSED  *** &_C_RESET :::
prompt ::: &_C_RED *** &_C_BLINK TEST PASSED &_C_BLINK_OFF *** &_C_RESET :::

 prompt :::  &_C_RED SQL> [0m  abcd


set sqlprompt '^[[31mSQL> ^[[0m'


set sqlprompt 'ESC[31mSQL> ESC[0m'
SQL> 

set sqlprompt 'ESC[32mSQL> ESC[0m'
SQL> 


## Production
set sqlprompt '^[[25;1;41mSQL> ^[[0m'
SQL> 


set sqlprompt '^[[37;1;44mSQL> ^[[0m'
SQL> 



def _C_RESET =^[[0m
-- _C_RESET can be simply =^[[m

def _C_BOLD =^[[1m
def _C_BOLD_OFF =^[[21m

def _C_UNDERLINE =^[[4m
def _C_UNDERLINE_OFF=^[[24m

def _C_BLINK =^[[5m
def _C_BLINK_OFF =^[[25m

def _C_REVERSE =^[[7m
def _C_REVERSE_OFF =^[[27m

def _C_HIDE =^[[8m
def _C_HIDE_OFF =^[[28m

def _C_BLACK =^[[30m
def _C_RED =^[[31m
def _C_GREEN =^[[32m
def _C_YELLOW =^[[33m
def _C_BLUE =^[[34m
def _C_MAGENTA =^[[35m
def _C_CYAN =^[[36m
def _C_WHITE =^[[37m
def _C_DEFAULT =^[[39m

def _CB_BLACK =^[[40m
def _CB_RED =^[[41m
def _CB_GREEN =^[[42m
def _CB_YELLOW =^[[43m
def _CB_BLUE =^[[44m
def _CB_MAGENTA =^[[45m
def _CB_CYAN =^[[46m
def _CB_WHITE =^[[47m
def _CB_DEFAULT =^[[49m

REM just addition variables for convenience:
def _ESC =^[
def _CLS =^[[2J

沒有留言:

RHEL install EPEL

  https://www.linuxtechi.com/install-epel-repo-on-rhel-system/ EPEL dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest...