Re: Some semicolon oddities

From: Luuk <luuk_at_invalid.lan>
Date: Sat, 26 Sep 2015 09:04:07 +0200
Message-ID: <56064360$0$23795$e4fe514c_at_news.xs4all.nl>


On 25-09-15 22:05, Stefan Ram wrote:
> When one enters »USE« into the client, no semicolon is needed:
>
> USE S
>
> . But when the USE is preceded by other commands on the same
> line, it /does/ need a semicolon:
>
> DROP SCHEMA D; CREATE SCHEMA D; USE D;
>
> . I did not read this in the manual (is it in the manual at all?),
> but observed it from the behavior of the client.
>
> Now, one might say, »Ok, then I will /always/ add a semicolon,
> since I do not want to learn detailed rules about when it is
> needed.«, but sometimes a semicolon is not allowed as in
>
> SOURCE C:\example.txt
>
> , where a final semicolon would be treated as part of the
> filepath IIRC.
>
> So, when entering client commands, sometimes we must add a
> semicolon, sometimes we may not, and sometimes both choices
> are possible.
>

 From the manual:
"A command normally consists of an SQL statement followed by a semicolon. (There are some exceptions where a semicolon may be omitted. QUIT, mentioned earlier, is one of them. We'll get to others later.) " ( https://dev.mysql.com/doc/refman/5.7/en/entering-queries.html )

In other words, always add a ';' ad the end of your SQL statement.

The problem you have with SOURCE c:\example.txt might be related to Windows only? It works with, or without, semicolon on linux. Received on Sat Sep 26 2015 - 09:04:07 CEST

Original text of this message