aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/plsql/index.html
blob: be603d99040759552e4ababd30c5c723153b0536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!doctype html>
<html>
  <head>
    <title>CodeMirror: Oracle PL/SQL mode</title>
    <link rel="stylesheet" href="../../lib/codemirror.css">
    <script src="../../lib/codemirror.js"></script>
    <script src="plsql.js"></script>
    <link rel="stylesheet" href="../../doc/docs.css">
    <style>.CodeMirror {border: 2px inset #dee;}</style>
  </head>
  <body>
    <h1>CodeMirror: Oracle PL/SQL mode</h1>

<form><textarea id="code" name="code">
-- Oracle PL/SQL Code Demo
/*
   based on c-like mode, adapted to PL/SQL by Peter Raganitsch ( http://www.oracle-and-apex.com/ )
   April 2011
*/
DECLARE
    vIdx    NUMBER;
    vString VARCHAR2(100);
    cText   CONSTANT VARCHAR2(100) := 'That''s it! Have fun with CodeMirror 2';
BEGIN
    vIdx := 0;
    --
    FOR rDATA IN
      ( SELECT *
          FROM EMP
         ORDER BY EMPNO
      )
    LOOP
        vIdx    := vIdx + 1;
        vString := rDATA.EMPNO || ' - ' || rDATA.ENAME;
        --
        UPDATE EMP
           SET SAL   = SAL * 101/100
         WHERE EMPNO = rDATA.EMPNO
        ;
    END LOOP;
    --
    SYS.DBMS_OUTPUT.Put_Line (cText);
END;
--
</textarea></form>

    <script>
      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
        lineNumbers: true,
        matchBrackets: true,
        indentUnit: 4,
        mode: "text/x-plsql"
      });
    </script>

    <p>
        Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course).
    </p>

    <p><strong>MIME type defined:</strong> <code>text/x-plsql</code>
    (PLSQL code)
</html>