MySQL错误"空字符串作为参数!字符" [英] MySQL error "empty string given as argument for ! character"
问题描述
我有一个非常简单的查询
I have a very simple query
select *
from tablename
where keyvar is not null
order by keyvar
该查询以前有效,但由于某种原因,我现在收到一个错误:
The query worked before but for some reason now I am getting an error:
错误:错误格式化SQL查询:空字符串作为!的参数给出字符
Error:Error formatting SQL query: empty string given as argument for ! character
任何人都知道为什么我会收到此错误?任何帮助表示赞赏
Anyone has any idea why I am getting this error? Any help hugely appreciated
PS:如果我再次从头开始运行整个代码(创建数据库,加载csv文件等),则查询工作正常.
PS: If I run the whole code again from scratch (creating the database, loading the csv file etc) the query works fine.
推荐答案
首先,这不是MySQL错误-这是MySQL Workbench错误(您可以在Oracle的源代码
First of all, this is not a MySQL error - it's a MySQL Workbench error (you can see it in Oracle's source code here).
第二,如果未选择数据库,则会出现此错误.有两种选择方法.
Secondly, you'll get this error when no database is selected. There's two ways you can select one.
让我们看看选择 no 数据库时的外观:
Let's look at what it looks like when no databases are selected:
如您所见,它不是粗体.可以通过在数据库名称上双击或右键单击并选择"设置为默认模式"来轻松解决此问题:
as you can see it's not bold. This can be easily fixed by double clicking on the database name, or right clicking and choosing "Set as Default Schema":
Should you still not see any database selected on the left side, you can force it by using the SQL command USE
like so: USE `dbname`;
(where dbname
is your database name):
这篇关于MySQL错误"空字符串作为参数!字符"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!