In Oracle, is starting the SQL Query's WHERE clause with 1=1 useful?

前端 未结 3 975
温柔的废话
温柔的废话 2021-01-02 23:50

I\'m working with a client that starts almost all of their WHERE clauses in Oracle with 1=1. Forgive my ignorance, but isn\'t this a no-op? Are there any negati

3条回答
  •  Happy的楠姐
    2021-01-03 00:34

    They may have built the query from substrings.

    It may be a way to build it with just ANDs, depending on the business rule match, so you don't really have to care which is your first condition.

    Wouldn't do it that way myself.

提交回复
热议问题