You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/1-introduction/introduction.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ There are basically two types of standards.
78
78
79
79
2. Controversial
80
80
81
-
Almost every rule/guildeline falls into this category. An example of this category is [3 space indention](../../3-coding-style/coding-style/#rules). - Why not 2 or 4 or even 8? Why not use tabs? You can argue in favor of all these options. In most cases it does not really matter which option you choose. Being consistent is more important. In this case it will make the code easier to read.
81
+
Almost every rule/guideline falls into this category. An example of this category is [3 space indention](../../3-coding-style/coding-style/#rules). - Why not 2 or 4 or even 8? Why not use tabs? You can argue in favor of all these options. In most cases it does not really matter which option you choose. Being consistent is more important. In this case it will make the code easier to read.
82
82
83
83
For very controversial rules, we have started to include the reasoning either as a footnote or directly in the text.
7 | SQL keywords are right aligned within a SQL command.
@@ -18,34 +18,34 @@ Rule | Description
18
18
19
19
### Example
20
20
21
-
```
22
-
PROCEDURE set_salary(in_employee_id IN employees.employee_id%TYPE) IS
23
-
CURSOR c_employees(p_employee_id IN employees.employee_id%TYPE) IS
24
-
SELECT last_name
21
+
```sql
22
+
procedure set_salary(in_employee_id inemployees.employee_id%type) is
23
+
cursor c_employees(p_employee_id inemployees.employee_id%type) is
24
+
select last_name
25
25
,first_name
26
26
,salary
27
-
FROM employees
28
-
WHERE employee_id = p_employee_id
29
-
ORDER BY last_name
27
+
from employees
28
+
where employee_id = p_employee_id
29
+
order by last_name
30
30
,first_name;
31
31
32
-
r_employee c_employees%ROWTYPE;
33
-
l_new_salary employees.salary%TYPE;
34
-
BEGIN
35
-
OPEN c_employees(p_employee_id => in_employee_id);
36
-
FETCH c_employees INTO r_employee;
37
-
CLOSE c_employees;
32
+
r_employee c_employees%rowtype;
33
+
l_new_salary employees.salary%type;
34
+
begin
35
+
open c_employees(p_employee_id => in_employee_id);
36
+
fetch c_employees into r_employee;
37
+
close c_employees;
38
38
39
39
new_salary (in_employee_id => in_employee_id
40
40
,out_salary => l_new_salary);
41
41
42
42
-- Check whether salary has changed
43
-
IF r_employee.salary <> l_new_salary THEN
44
-
UPDATE employees
45
-
SET salary = l_new_salary
46
-
WHERE employee_id = in_employee_id;
47
-
END IF;
48
-
END set_salary;
43
+
ifr_employee.salary<> l_new_salary then
44
+
update employees
45
+
set salary = l_new_salary
46
+
where employee_id = in_employee_id;
47
+
end if;
48
+
end set_salary;
49
49
```
50
50
51
51
## Code Commenting
@@ -70,7 +70,7 @@ Tag | Meaning | Example
70
70
71
71
This is an example using the documentation capabilities of SQL Developer.
72
72
73
-
```
73
+
```sql
74
74
/**
75
75
Check whether we passed a valid sql name
76
76
@@ -80,15 +80,21 @@ Check whether we passed a valid sql name
80
80
81
81
<b>Call Example:</b>
82
82
<pre>
83
-
SELECT TVDAssert.valid_sql_name('TEST') from dual;
84
-
SELECT TVDAssert.valid_sql_name('123') from dual
83
+
select TVDAssert.valid_sql_name('TEST') from dual;
84
+
select TVDAssert.valid_sql_name('123') from dual
85
85
</pre>
86
86
*/
87
87
```
88
88
89
89
[^2]:
90
+
It used to be good practice to use uppercase keywords and lowercase names to help visualize code structure.
91
+
But practically all editors support more or less advanced color highlighting of code, similar to the examples in these guidelines.
92
+
Hence as of version 4.0 we are now recommending all lowercase, as this is easier and faster for the brain to process.
93
+
You may choose to prefer the old rule - however, it is important to always be consistent, like for example keywords always in uppercase and names always in lowercase.
94
+
95
+
[^3]:
90
96
Tabs are not used because the indentation depends on the editor configuration.
91
-
We want to ensure that the code looks the same, indepenent of the editor used.
97
+
We want to ensure that the code looks the same, independent of the editor used.
92
98
Hence, no tabs. But why not use 8 spaces? That's the traditional value for a tab.
93
99
When writing a package function the code in the body has an indentation of 3.
94
100
That's 24 characters as a starting point for the code. We think it's too much.
0 commit comments