Categories
blog

Preserve code formatting

Hey,
This plugin seems to do exactly what I am looking for, enable users to write code in comments.
Preserve Code Formatting

Please test here and give feedback

Warning: this changed the behavior of old posts too, so I have to reformat all older posts to no longer use < in code 🙁

By Laurent Schneider

Oracle Certified Master

12 replies on “Preserve code formatting”

OK – I try it:


DECLARE
vTest number;
BEGIN
SELECT sal INTO vTest
FROM "SCOTT"."EMP"
WHERE ename='King';
EXCEPTION
WHEN OTHERS THEN NULL ; -- ;-)
END;
/

testing XML Schema stuff


SQL> declare
2 res boolean;
3 xmlSchema xmlType := xmlType(
4 '
5
10
11
12 Example XML Schema
13

14
15
16
17
18

19

20

21
22
23
24
25
26

27

28

29
'
30 );
31 begin
32 if (dbms_xdb.existsResource(:schemaPath)) then
33 dbms_xdb.deleteResource(:schemaPath);
34 end if;
35 res := dbms_xdb.createResource(:schemaPath,xmlSchema);
36 end;
37 /


SELECT
CASE WHEN Type = ‘C’ THEN ‘Child’ ELSE ‘Parent’ END “End”,
CASE WHEN Type = ‘C’ THEN Child_Column ELSE Parent_Column END “Column”,
SubStr(Position, 1, 1) “#”,
CASE WHEN Type = ‘C’ THEN Parent_Table ELSE Child_Table END “Other Table”,
CASE WHEN Type = ‘C’ THEN Parent_Column ELSE Child_Column END “Other Column”,
Constraint_Name “Constraint”
FROM
(
SELECT
(
CASE
WHEN Child_Columns.Table_Name = UPPER(‘&1’) THEN ‘C’
ELSE ‘P’
END
) Type,
Constraints.Constraint_Name Constraint_Name,
Constraints.R_Constraint_Name R_Constraint_Name,
Parent_Columns.Position Position,
Substr(Parent_Columns.Table_Name, 1, 30) Parent_Table,
Substr(Parent_Columns.Column_Name, 1, 30) Parent_Column,
Substr(Child_Columns.Table_Name, 1, 30) Child_Table,
Substr(Child_Columns.Column_Name, 1, 30) Child_Column
FROM
All_Constraints Constraints,
All_Cons_Columns Parent_Columns,
All_Cons_Columns Child_Columns
WHERE
UPPER(‘&1’) IN (Parent_Columns.Table_Name, Child_Columns.Table_Name)
— Join Parent_Columns to get the COLUMN names.
AND Parent_Columns.Owner = Constraints.R_Owner
AND Parent_Columns.Constraint_Name = Constraints.R_Constraint_Name
— Join Child_Columns to get the COLUMN names.
AND Child_Columns.Owner = Constraints.Owner
AND Child_Columns.Constraint_Name = Constraints.Constraint_Name
AND Child_Columns.Position = Parent_Columns.Position
)
ORDER BY
Type,
Constraint_Name;

Copy&paste, silly. 🙂

For example, i just pressed in “a” then pressed tab then pressed “b”. I copied that from Notepad and pasted it here. There is clearly a tab there. In the edit box right now, it shows only one character.

Without code tags:
a b
With code tags:
[code]
a b
[/code]

Leave a Reply

Your email address will not be published.