SELECT instr('abc', 'a') FROM dual 出来1,表明abc含有a,并且再第一个位置
SQL> select * from test where name like '%1%' or name like '%3.%'; ID NAME ---------- ---------- 1 1.2 3 3.7SQL> select * from test; ID NAME ---------- ---------- 1 1.2 2 2 2 2.0 3 3.7判断包含2或者包含3.的记录
if instr(V_name,'任三') > 0 then
declare V_name varchar2(150); begin V_name := '人力资源部门_任三_离职';
if instr(V_name,'任三') > 0 then DBMS_OUTPUT.PUT_LINE('有'); else DBMS_OUTPUT.PUT_LINE('无'); end if; end; /
declare V_name varchar2(100); begin V_name := '人力资源部门_任三_离职';if instr(V_name,'任三') > 0 then DBMS_OUTPUT.PUT_LINE('有'); else DBMS_OUTPUT.PUT_LINE('无'); end if; end; /
出来1,表明abc含有a,并且再第一个位置
---------- ----------
1 1.2
3 3.7SQL> select * from test; ID NAME
---------- ----------
1 1.2
2 2
2 2.0
3 3.7判断包含2或者包含3.的记录
V_name varchar2(150);
begin
V_name := '人力资源部门_任三_离职';
if instr(V_name,'任三') > 0 then
DBMS_OUTPUT.PUT_LINE('有');
else
DBMS_OUTPUT.PUT_LINE('无');
end if;
end;
/
V_name varchar2(100);
begin
V_name := '人力资源部门_任三_离职';if instr(V_name,'任三') > 0 then
DBMS_OUTPUT.PUT_LINE('有');
else
DBMS_OUTPUT.PUT_LINE('无');
end if;
end;
/