where 1=1的作用
where 1=1最近看到很多sql里用到where 1=1,原来觉得这没用嘛,但是又想到如果没用为什么要写呢?于是在网上
查了查,在这里就浅谈一下:)o!hz.eZ4k%@
1=1 永真, 1<>1 永假。
1<>1 的用处:
用于只取结构不取数据的场合
例如:o't-d"h+U+o
create table table_temp tablespace tbs_temp as*B b5?I#nU9y
select * from table_ori where 1<>1
建成一个与table_ori 结构相同的表table_temp,但是不要table_ori 里的数据。(除了表结构,其它结D lAiz,R{6cT6k
8g2}5U_t B_
构也同理)"m3r8]O%E
;A:wBY8rT)V#L
1=1的用处
用于动态SQL