how is it wrong?
in other words, how would you expect it to be after a format?
I would expect that the SQL is formatted with a blank between SELECT and "(", if not the SQL is not valid.
running formatter preferences 'out of the box' i don't see the formatter removing the space between SELECT and the (
I have used the formatter preferences regarding to the attachment.
Here is another one for the formatter. The keyword "elsif" is not capitalised along with the rest of the keywords. Trivial in the larger scheme of things.
-- Before formatting
declare foo number := 1; begin if foo = 1 then foo := 2; elsif foo = 2 then foo := 3; else foo := 1; end if; end;
-- After formatting
DECLARE foo NUMBER := 1; BEGIN IF foo = 1 THEN foo := 2; elsif foo = 2 THEN foo := 3; ELSE foo := 1; END IF; END;
edit: Just noticed that the forum SQL format does not highlight "IF" or "ELSIF" in blue like it does for other keywords.
I don't get this behavior in my SQL Developer. What version are you on?
I gather that you may have changed the default formatter preferences. If so, then undo the changes and see if the behavior continues.
I have the same behaviour. I use the newest version.
One thing that I have found also is that in some cases SQL Developer formats a statement with a linebreak after the "-". This is with the sqldeveloper a problem because it is interpreted like in SQLPlus as linebreak. So you get in this case a wrong result.
>>is that in some cases SQL Developer formats a statement with a linebreak after the "-".
please provide said case
The statement was:
SELECT SNTONDATID, sntondattag, SNTONDATTONERSTAND - NVL((LEAD(SNTONDATTONERSTAND) OVER(ORDER BY sntondattag DESC)),-
WHERE SNTONDATTYP = 20
AND(20 <> 10
OR(20 = 10
AND(SNTONDATBEZEICHNUNG = 'xyz'
OR(SNTONDATBEZEICHNUNG IS NULL
AND TRIM('xyz') IS NULL))))
AND snid = '0120000000A28B'
It seems that the last version of SQLDeveloper doesnt format it anymore in this way. It was in the last version.
with the standard settings everything (except elsif ) is working. It seems that with the settings it is possible to make some problems...