1232

Css code posted by 3213
created at 15 Feb 00:23, updated at 23 Apr 14:07

Edit | Back
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Already implemented PL/SQL features are :

1. Package Bodies
    1.a PL/SQL example
        CREATE OR REPLACE PACKAGE BODY PKG1
        IS
        ...
        END PKG1;
    1.b Parsed XML example
        <Package_Body>
            <Schema_Name>null</Schema_Name>
            <Name>PKG1</Name>
            ...
        </Package_Body>

2. Variable Declarations
    2.a PL/SQL example
        G_SSN           VARCHAR2(10) := NULL;
    2.b Parsed XML example
        <Variable>
            <Name>G_SSN</Name>
            <Type>VARCHAR2(10)</Type>
            <Expression>
                <Type>SIMPLE</Type>
                <Value>NULL</Value>
            </Expression>
        </Variable>

3. SQL Select Statements
    3.a PL/SQL example
        SELECT NAME
          INTO G_NAME
          FROM PS_PERSONAL_DATA
          WHERE EMPLID = P_EMPLID;
    3.b Parsed XML example
        <SQL>
            <Select>
                <Column>
                    <Spec>null</Spec>
                    <Name>NAME</Name>
                    <Alias>null</Alias>
                </Column>
            </Select>
            <Into>G_NAME</Into>
            <From>PS_PERSONAL_DATA</From>
            <Where>WHERE EMPLID = P_EMPLID</Where>
        </SQL>

4. Assign statements
    4.a PL/SQL example
        G_NAME := NULL;
    4.b Parsed XML example
        <Statement>
            <Type>Assign</Type>
            <LValue>G_NAME</LValue>
            <RValue>
                <Expression>
                    <Type>SIMPLE</Type>
                    <Value>NULL</Value>
                </Expression>
            </RValue>
        </Statement>

5. Return statements
    5.a PL/SQL example
        RETURN G_NAME;
    5.b Parsed XML example
        <Statement>
            <Type>RETURN</Type>
            <Expression>
                <Type>SIMPLE</Type>
                <Value>G_NAME</Value>
            </Expression>
        </Statement>

6. GOTO statements
    6.a PL/SQL example
        GOTO label_name
    6.b Parsed XML example
        <Statement>
            <Type>GO TO</Type>
            <Label>label_name</Label>
        </Statement>

7. Raise statements
    7.a PL/SQL example
        RAISE exception_name
    7.b Parsed XML example
        <Statement>
            <Type>RAISE</Type>
            <Exception>exception_name</Exception>
        </Statement>

8. NULL statenent
    8.a PL/SQL example
        NULL
    8.b Parsed XML example
        <Statement>
            <Type>NULL</Type>
        </Statement>

9. EXIT statement
    9.a PL/SQL example
        EXIT label_name WHEN plsql_condition )
    9.b Parsed XML example
        <Statement>
            <Type>EXIT</Type>
            <Label>label_name</Label>
            plsql_condition - parsed like pl/sql conditions or expressions  e.g value1 <> value2
        </Statement>

10. Function bodies (with parameters, return type and declarations)
    10.a PL/SQL example
        FUNCTION GETEMPLSSN
          (P_EMPLID    OUT VARCHAR2)
           RETURN  VARCHAR2
        IS
        BEGIN
        END GETEMPLSN;
    10.b Parsed XML example
        <Function>
            <Name>GETEMPLSSN</Name>
            <Parameter>
                <Name>P_EMPLID</Name>
                <Direction> OUT </Direction>
                <Type>VARCHAR2</Type>
            </Parameter>
            <Return>
                <Type>VARCHAR2</Type>
            </Return>
        </Function>

11. Fuction calls (with parmeters, it's also possible to catch "Param_Name => Param_Value" statement for any param)
    11.a PL/SQL example
        NVL(G_EMPLID1,'X');
    11.b Parsed XML example
        <Call>
            <Function>
                <Name>NVL</Name>
                <Parameter>
                    <Name>null</Name>
                    <Value>
                        <Expression>
                            <Type>SIMPLE</Type>
                            <Value>G_EMPLID1</Value>
                        </Expression>
                    </Value>
                </Parameter>
                <Parameter>
                    <Name>null</Name>
                    <Value>
                        <Expression>
                            <Type>SIMPLE</Type>
                            <Value>'X'</Value>
                        </Expression>
                    </Value>
                </Parameter>
            </Function>
        </Call>

12. Relational operators
    =              ->  <Operator>equal</Operator>
    <              ->  <Operator>less then</Operator>
    >              ->  <Operator>greater then</Operator>
    <>, !=, ^=     ->  <Operator>not equal</Operator>
    <=             ->  <Operator>less or equal</Operator>
    >=             ->  <Operator>greater or equal</Operator>

13. IF-THEN-ELSE statements
    13.a PL/SQL example
        IF NVL(G_EMPLID1,'X') <> P_EMPLID THEN
        ...
        END IF;
    13.b Parsed XML example
        <Statement>
            <Type>IF</Type>
            <Expression></Expression> - Expression, Fuction call or something like that
            <Operator></Operator> -- e.g. some relational operator
            <Expression></Expression> - Expression, Fuction call or something like that
            <Code_Section>
                <Type>THEN</Type>
                ... e.g. SQL, statements, calls, expressions tags
            </Code_Section>
            <Code_Section>
                <Type>ELSE</Type>
                ... e.g. SQL, statements, calls, expressions tags
            </Code_Section>
        </Statement>

Please, feel free to express your opinion on how to make it better ... :)
5.63 KB in 9 ms with coderay