Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Where子句SQL(Oracle)中的大小写_Sql_Oracle_Where Clause - Fatal编程技术网

Where子句SQL(Oracle)中的大小写

Where子句SQL(Oracle)中的大小写,sql,oracle,where-clause,Sql,Oracle,Where Clause,我想在Where语句中筛选查询。我想将ID与“IN”进行比较,但前提是输入有值。 如果此文本为空,我不想进行比较。防止错误查询 例如: StringProductIDs = '' WHERE ({Issue}.[ServiceRequestId] IN (@StringServiceRequestIDs)) AND ({ServiceRequest}.[Id] IN (@StringServiceRequestIDs)) AND ({Product}.[Id] I

我想在Where语句中筛选查询。我想将ID与“IN”进行比较,但前提是输入有值。 如果此文本为空,我不想进行比较。防止错误查询

例如:

StringProductIDs = ''



WHERE
    ({Issue}.[ServiceRequestId] IN (@StringServiceRequestIDs)) 
    AND ({ServiceRequest}.[Id] IN (@StringServiceRequestIDs))
    AND ({Product}.[Id] IN (@StringProductIDs) OR @StringProductIDs = '')   /* Is this one that i want to prevent*/
    AND EXTRACT(MONTH FROM {Sprint}.[CompleteDate]) = @Month
    AND EXTRACT(YEAR FROM {Sprint}.[CompleteDate]) = @Year
在本例中,如果作为参数传递的值具有value,我只想筛选things.id。如果它是空的,我不想比较和避免使用and行

或者尝试另一种方法:)。只有当此输入有值时,才可以运行查询?如果没有值,则不返回任何内容。如果输入值正常运行——


非常感谢

您需要

WHERE  (things.active = 1 AND things.state = 2) AND
       (things.id IN (@INPUT) OR @INPUT IS NULL); 

什么是
@input
?这在Oracle中是无效的,那个些带有可怕方括号的列名在Oracle中肯定不起作用。这看起来更像SQLServer的T-SQL。这是Outsystems语法。然后是Oracle数据库的映射。我编辑了这个问题。我正在使用带Oracle数据库的OutSystems。出现错误ORA-00936错误-ORA-00936请尝试其他方法:)。只有当此输入有值时,才可以运行查询?如果没有值,则不返回任何内容。如果输入值正常运行