Sql logic error incomplete input

Sql logic error incomplete input

I get the following error if I want to put these table rows together

[SQLITE_ERROR] SQL error or missing database (incomplete input)

each one works individually.

1 Answer 1

One option here is to wrap your current subqueries, and then take the union of that:

Here is a demo link showing that this syntax works:

Not the answer you’re looking for? Browse other questions tagged sqlite or ask your own question.

Related

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.3.26.36382

Sometimes you want to emulate the Python interactive interpreter’s behavior, where it gives you a continuation prompt when the input is incomplete (e.g. you typed the start of an “if” statement or you didn’t close your parentheses or triple string quotes), but it gives you a syntax error message immediately when the input is invalid.

In Python you can use the code or codeop modules, which approximates the parser’s behavior sufficiently. IDLE uses this, for example.

The easiest way to do it in C is to call PyRun_InteractiveLoop (perhaps in a separate thread) and let the Python interpreter handle the input for you. You can also set the PyOS_ReadlineFunctionPointer to point at your custom input function. See Modules/readline.c and Parser/myreadline.c for more hints.

However sometimes you have to run the embedded Python interpreter in the same thread as your rest application and you can’t allow the PyRun_InteractiveLoop to stop while waiting for user input. The one solution then is to call PyParser_ParseString and test for e.error equal to E_EOF, which means the input is incomplete). Here’s a sample code fragment, untested, inspired by code from Alex Farber:

Читайте также:  Мультивибратор на к561ла7 схема

Another solution is trying to compile the received string with Py_CompileString. If it compiles without errors, try to execute the returned code object by calling PyEval_EvalCode. Otherwise save the input for later. If the compilation fails, find out if it’s an error or just more input is required — by extracting the message string from the exception tuple and comparing it to the string “unexpected EOF while parsing”. Here is a complete example using the GNU readline library (you may want to ignore SIGINT while calling readline()):

I’ve a SQLite script which initializes a DB (SQLite 3.8.2), created as follows:

The script file is like:

But it generates the following error:

I’m sure there’re syntax errors nor creating the tables neither inserting the test rows, because if I comment the CREATE TRIGGER statement all works perfectly fine, and I don’t find the syntax error either.

1 Answer 1

Ok, the problem was pretty simple. I though the "END" keyword was enough to mark the end of the CREATE TRIGGER statement (even more knowing that the UPDATE statement has already its own ‘;’), but after END , another ; is required:

Not the answer you’re looking for? Browse other questions tagged sqlite triggers or ask your own question.

Related

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.3.26.36382

Ссылка на основную публикацию
Project is unviewable как снять защиту
Несколько полезных утилит для тех, кто часто работает с макросами: Smart Indenter - выравнивает код в редакторе VBA (формирует отступы...
Micro thumbnail blob 0 что за файл
File Thumbnail_blob.0 и прочие файлы галереи. За что они отвечают и можно ли удалять?! На развитие канала: не принуждаю никого,...
Minitool partition wizard как форматировать флешку
Форматирование жесткого диска это процесс формирования новой файловой таблицы и создания раздела. При этом все данные на диске удаляются. Причин...
Python посчитать количество элементов в массиве
Есть массив, в котором куча повторяющихся элементов. Мне надо вывести содержимое конкретного элемента этого массива и сколько таких же элементов...
Adblock detector