select max(f_wlmc) into vswlmc from table where f_wlbh like ||vswhere||'%'; 改成 select max(f_wlmc) into vswlmc from table where f_wlbh like vswhere||'%';
第一个||跟谁运算? 你如果是想查包含vswhere的数据,改成 select max(f_wlmc) into vswlmc from table where f_wlbh like '%'||vswhere||'%'; 如果是想查vswhere开头的就 select max(f_wlmc) into vswlmc from table where f_wlbh like vswhere||'%'; 如果是想查vswhere结尾的就 select max(f_wlmc) into vswlmc from table where f_wlbh like '%'||vswhere;
e,如果你不是在存储过程里使用这个句子,把那个 into 去掉。
第一个||跟谁运算? 你如果是想查包含vswhere的数据,改成 select max(f_wlmc) from table where f_wlbh like '%'||vswhere||'%'; 如果是想查vswhere开头的就 select max(f_wlmc) from table where f_wlbh like vswhere||'%'; 如果是想查vswhere结尾的就 select max(f_wlmc) from table where f_wlbh like '%'||vswhere;
我是指 like vswhere||'%'; 这个语法不正确,跟前面的into没有关系
SQL> SELECT 1 FROM dual WHERE to_char(trunc(SYSDATE),'yyyy-mm-dd hh24:mi:ss')='2010-07-28 00:00:00';
1 ---------- 1
SQL> select * from test1;
A -------------------- asdf 1asdf 132asdf
SQL> select * from test2;
A -------------------- 1 a
SQL> select * from test1 a,test2 b where a.a like b.a||'%';
A A -------------------- -------------------- 1asdf 1 132asdf 1 asdf a
改成
select max(f_wlmc) into vswlmc from table where f_wlbh like vswhere||'%';
你如果是想查包含vswhere的数据,改成
select max(f_wlmc) into vswlmc from table where f_wlbh like '%'||vswhere||'%';
如果是想查vswhere开头的就
select max(f_wlmc) into vswlmc from table where f_wlbh like vswhere||'%';
如果是想查vswhere结尾的就
select max(f_wlmc) into vswlmc from table where f_wlbh like '%'||vswhere;
你如果是想查包含vswhere的数据,改成
select max(f_wlmc) from table where f_wlbh like '%'||vswhere||'%';
如果是想查vswhere开头的就
select max(f_wlmc) from table where f_wlbh like vswhere||'%';
如果是想查vswhere结尾的就
select max(f_wlmc) from table where f_wlbh like '%'||vswhere;
1
----------
1
SQL> select * from test1;
A
--------------------
asdf
1asdf
132asdf
SQL> select * from test2;
A
--------------------
1
a
SQL> select * from test1 a,test2 b where a.a like b.a||'%';
A A
-------------------- --------------------
1asdf 1
132asdf 1
asdf a
SQL>