select count(rowid) into nCnt from 表名 where 号码 like '0106330%'
if nCnt > 0 then return 0;
return 1;
if nCnt > 0 then return 0;
return 1;
解决方案 »
- 谁知道我们做的是什么系统?
- win7安装oracle11gr2client(都是64位的)问题反馈,求解决
- 坐等高手解题~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 数据库高手来啊!为何oracle10g数据库总是查询失败?
- oracle语句优化/*+ ALL_ROWS */
- PL/SQL写个PROCEDURE,比较难!!!!!!!!!!!!!!
- 奇怪的问题
- Oracle9i中有无和MS SQL Profiler(SQL事件探查器)对应的SQL监视工具?
- 关于Asp调用Oracle序列的小问题
- android debug 问题
- 求教一个sql语句?
- 如何得到group by后的记录数
v_ret number(5);
begin
select count(*) into v_ret from 表名 where instr(phone,in_str)>0;
if v_ret > 0 then return 0;
return 1;
end;
/
select case when count(*)=0 then 0 else 1 end from phone where instr( phone,'010' ) >0;
//用存储过程也可以这样
create or replace procedure f_is_in_str(in_str in varchar2,Rst out integer)
is
begin
select case when count(*)=0 then 0 else 1 end into Rst from phone where instr( phone,'010' ) >0;
end;
is
begin
select count(haoma) into returnStr from phone where id like '0106330%';
if returnStr > 0 then
returnStr:='0';
else
returnStr:='1';
end if;
dbms_output.put_line(returnStr);
end;
我现在这样能实现,我现在想去掉id最后的一位判断是否和0106330相等
该怎么改SQL语句 ?
is
begin
select count(haoma) into returnStr from phone where substr(id,1,length(id)-1)= '0106330';
if returnStr > 0 then
returnStr:='0';
else
returnStr:='1';
end if;
dbms_output.put_line(returnStr);
end;