When in a large editor file, and there are insert commands, the following shows:
Found 'insert': Expecting: end-of-input -or- FOR ORDER -or- INTERSECT MINUS UNION -or- CONNECT GROUP HAVING START -or-
WHERE -or- AS CROSS FETCH FULL identifier ILM INNER JOIN LEFT LOCATION LOG MATCH_RECOGNIZE MODEL NATURAL NESTED OFFSET OUTER PARTITION PIVOT RETURN RETURNING RIGHT
SAMPLE SUBPARTITION substitution_variable TYPE UNPIVOT USING VERSIONS
Please share a reproducible sample that shows the syntax error. Whatever is triggering the false positive will be very near the insert statement flagged, probably the prior statement.
The first SELECT statement is not properly terminated, i.e. it does not contain the trailing ; as your INSERT statements do.
The parser relies on statement terminators to know the bounds of each statement. In your example, the SELECT appears as a multiline statement because it lacks the terminator and the next token found is INSERT which is wrong at that location.
You have two options...
Terminate every statement
Check this option if you typically use blank lines around statements instead of terminating
Sorry the title is not very good. Can you update the title to update error message please?
Could the error message be updated to something like terminator needed on last command or add semicolon to last command? The error message is not very helpful.
There are two error messages shown depending on where you mouse over. I will have a look at this in the morning, but it may be that there are multiple messages being returned from the parser. When you mouse over the red indicator in the gutter you see the message you shared in your screenshot. That is showing the "expected tokens" message which is less helpful. If you mouse over the INSERT that is underlined in red you will see a better message that you cannot use INSERT as an alias.
I think the message is OK. The problem with your suggestion is that the parser would need to know your intent. Did you mean to use a reserved word as an alias or did you just forget the terminator? Generally speaking, when there is a flagged syntax error the actual problem is likely immediately upstream. Similar to a compiled language where a missing terminator will flag some less clear error message immediately downstream. Oracle scripts require the usage of terminators. If you try to run your script with SQL Plus, it should fail as well.
I wasn't trying to use insert as an alias. I was trying to insert some data in the people table. This error message does not seem much better.
My intent was to insert some data in the people table.
Which alias did I use? Didn't think I used an alias.
This time I purposely left the semicolon off to show you the error message. I have forgotten semicolons before and it always takes awhile to figure out. I have also copied a command out of my recall history that does not add a semicolon to the end.
Which version of Toad are you using? A change was made for Toad for Oracle 2024 R2 to ensure all SQL Recall statements have the trailing terminator for this very reason. Previous versions of Toad would not necessarily contain the terminator so if you're on an older version or if you had used an older version and your SQL Recall history was carried forward when you upgraded that would explain the missing terminator. That should be corrected going forward.
The presence of the -------- lines there suggest you are using a version older than 2024 R2. The latest version of Toad also eliminates those unnecessary comment separators. If you can upgrade I think your SQL Recall experience will be better in this regard.
I have 16, 17, and Toad for Oracle 2024 R2. I like to use the optimizer and can only run one at a time in each program. I did also carry my old recall history to Toad for Oracle 2024 R2.
I do like using comment separators. I add them between groups of commands.
Do you think the error message can be updated please?