2 " Language: SQL, PL/SQL (Oracle 8i)
3 " Maintainer: Paul Moore <pf_moore AT yahoo.co.uk>
4 " Last Change: 2005 Dec 23
6 " For version 5.x: Clear all syntax items
7 " For version 6.x: Quit when a syntax file was already loaded
10 elseif exists("b:current_syntax")
16 " The SQL reserved words, defined as keywords.
18 syn keyword sqlSpecial false null true
20 syn keyword sqlKeyword access add as asc begin by check cluster column
21 syn keyword sqlKeyword compress connect current cursor decimal default desc
22 syn keyword sqlKeyword else elsif end exception exclusive file for from
23 syn keyword sqlKeyword function group having identified if immediate increment
24 syn keyword sqlKeyword index initial into is level loop maxextents mode modify
25 syn keyword sqlKeyword nocompress nowait of offline on online start
26 syn keyword sqlKeyword successful synonym table then to trigger uid
27 syn keyword sqlKeyword unique user validate values view whenever
28 syn keyword sqlKeyword where with option order pctfree privileges procedure
29 syn keyword sqlKeyword public resource return row rowlabel rownum rows
30 syn keyword sqlKeyword session share size smallint type using
32 syn keyword sqlOperator not and or
33 syn keyword sqlOperator in any some all between exists
34 syn keyword sqlOperator like escape
35 syn keyword sqlOperator union intersect minus
36 syn keyword sqlOperator prior distinct
37 syn keyword sqlOperator sysdate out
39 syn keyword sqlStatement alter analyze audit comment commit create
40 syn keyword sqlStatement delete drop execute explain grant insert lock noaudit
41 syn keyword sqlStatement rename revoke rollback savepoint select set
42 syn keyword sqlStatement truncate update
44 syn keyword sqlType boolean char character date float integer long
45 syn keyword sqlType mlslabel number raw rowid varchar varchar2 varray
47 " Strings and characters:
48 syn region sqlString start=+"+ skip=+\\\\\|\\"+ end=+"+
49 syn region sqlString start=+'+ skip=+\\\\\|\\'+ end=+'+
52 syn match sqlNumber "-\=\<\d*\.\=[0-9_]\>"
55 syn region sqlComment start="/\*" end="\*/" contains=sqlTodo
56 syn match sqlComment "--.*$" contains=sqlTodo
58 syn sync ccomment sqlComment
61 syn keyword sqlTodo contained TODO FIXME XXX DEBUG NOTE
63 " Define the default highlighting.
64 " For version 5.7 and earlier: only when not done already
65 " For version 5.8 and later: only when an item doesn't have highlighting yet
66 if version >= 508 || !exists("did_sql_syn_inits")
68 let did_sql_syn_inits = 1
69 command -nargs=+ HiLink hi link <args>
71 command -nargs=+ HiLink hi def link <args>
74 HiLink sqlComment Comment
75 HiLink sqlKeyword sqlSpecial
76 HiLink sqlNumber Number
77 HiLink sqlOperator sqlStatement
78 HiLink sqlSpecial Special
79 HiLink sqlStatement Statement
80 HiLink sqlString String
87 let b:current_syntax = "sql"