1=1 forever, 1<>1 forever false.
The use of 1<>1:
For applications where the structure is not fetching data
For example:
CREATE TABLE Table_temp tablespace tbs_temp as
SELECT * FROM Table_ori where 1<>1
Build a table table_temp with the same table_ori structure, but don't table_ori the data. (in addition to the table structure, other structures are the same)
The use of 1=1:
for dynamic SQL
For example:
lv_string: = ' Select Tbl_name,tbl_desc from tbl_test where 1=1 ' | | L_condition;
When the user selects the name of the query ' abc ', L_condition: = ' and tbl_name = ' abc ', but when the user does not have
When you select a name query, L_condition is empty so lv_string = ' Select Tbl_name,tbl_desc from Tbl_test
Where 1=1 ', run also without error, equivalent to no restriction on the name condition. But if there is no 1=1 condition, then lv_string =
' Select Tbl_name,tbl_desc from Tbl_test where '; this will cause an error.
In addition to 1=1 or 1<>1, the same conditions of eternal and eternal leave.
The role of where 1=1 in SQL statements