Data Studio supports formatting and highlighting of SQL queries and PL/SQL statements.
Follow the steps to format PL/SQL statements:
Alternatively, use the key combination Ctrl+Shift+F or choose Edit > Format from the main menu.
The PL/SQL statements are formatted.
Data Studio supports formatting of simple SQL SELECT, INSERT, UPDATE, DELETE statements which are syntactically correct. The following are some of the statements for which formatting is supported:
SELECT statement without SET operations like UNION, UNION ALL, MINUS, INTERSECT and so on.
SELECT statements without sub-queries.
Follow the steps below to format SQL queries:
Alternatively, use the key combination Ctrl+Shift+F or choose Edit > Format from the main menu.
The query is formatted.
Refer following table for query formatting rules.
Statement |
Clauses |
Formatting Rules |
---|---|---|
SELECT |
SELECT list |
Line break before first column |
Indent column list |
||
FROM |
Line break before FROM |
|
Line break after FROM |
||
Indent FROM list |
||
Stack FROM list |
||
JOIN (FROM clause) |
Line break before JOIN |
|
Line break after JOIN |
||
Line break before ON |
||
Line break after ON |
||
Indent table after JOIN |
||
Indent ON condition |
||
WHERE |
Line break before WHERE |
|
Line break after WHERE |
||
Indent WHERE condition |
||
Place WHERE condition on single line |
||
GROUP BY |
Line break before GROUP |
|
Line break before GROUP BY expression |
||
Indent column list |
||
Stack column list |
||
HAVING |
Line break before HAVING |
|
Line break after HAVING |
||
Indent HAVING condition |
||
ORDER BY |
Line break before ORDER |
|
Line break after BY |
||
Indent column list |
||
Stack column list |
||
CTE |
Indent subquery braces |
|
Each CTE in a new line |
||
INSERT |
INSERT INFO |
Line break before opening brace |
Line break after opening brace |
||
Line break before closing brace |
||
Indent column list braces |
||
Indent column list |
||
Line break before VALUES |
||
Stack column list |
||
Line break before VALUES |
||
Line break before opening brace |
||
Line break after opening brace |
||
Line break before closing brace |
||
Indent VALUES expressions list braces |
||
Indent VALUES expressions list |
||
Stack VALUES expressions list |
||
DEFAULT |
Line break before DEFAULT |
|
Indent DEFAULT keyword |
||
CTE |
Each CTE in a new line |
|
RETURNING |
Line break before RETURNING |
|
Line break after RETURNING |
||
Indent RETURNING column list |
||
Place RETURNING column List on single line |
||
UPDATE |
UPDATE Table |
Line break before table |
Indent table |
||
SET Clause |
Line break before SET |
|
Indent column assignments list |
||
Indent column assignments list |
||
FROM CLAUSE |
Line break before FROM |
|
Line break after FROM |
||
Indent FROM list |
||
Stack FROM list |
||
JOIN CLAUSE(FROM CLAUSE) |
Line break before JOIN |
|
Line break after JOIN |
||
Line break before ON |
||
Line break after ON |
||
Indent table after JOIN |
||
Indent ON condition |
||
WHERE CLAUSE |
Line break before WHERE |
|
Line break after WHERE |
||
Indent WHERE condition |
||
Indent WHERE condition |
||
CTE |
Each CTE in a new line |
|
RETURNING |
Line break before RETURNING |
|
Line break after RETURNING |
||
DELETE |
USING CLAUSE |
Indent RETURNING column list |
Line break before FROM |
||
Line break after FROM |
||
Indent USING list |
||
Stack FROM list |
||
JOIN CLAUSE |
Line break before JOIN |
|
Line break after JOIN |
||
Line break before ON |
||
Line break after ON |
||
Indent table after JOIN |
||
Indent ON condition List |
||
WHERE CLAUSE |
Line break before WHERE |
|
Line break after WHERE |
||
Indent WHERE condition |
||
Stack WHERE condition list |
||
CTE |
Each CTE in a new line |
|
RETURNING |
Line break before RETURNING |
|
Line break after RETURNING |
||
Indent RETURNING column list |
Data Studio supports automatic highlighting of the following punctuation mark's pair when cursor is placed before or after the punctuation mark or the punctuation mark is selected.
Follow the steps below to change case for SQL queries and PL/SQL statements:
Text case can be changed in the SQL Terminal using one of the following methods:
Method 1:
The text changes to the case selected.
Method 2:
The text changes to the case selected.
Method 3:
The text changes to the case selected.
Keywords are highlighted automatically when you enter them (according to the default color scheme) as shown below:
The following figure shows the default color scheme for the specified type of syntax:
Refer to Syntax Highlighting to customize the SQL highlighting color scheme for the specific type of syntax.