爱问知识人 爱问教育 医院库

oracle问题

首页

oracle问题

假设表是这样的
表名 a
字段名1,字段2,字段3
1        a      b
a        1      b
1        2      2
3        7      2
.        .      .
.        .      .
.        .      .
.        .      .
.        .      .
.        .      .


现在三个字段的数据类型都是字符型的
我现在想把看上去都是数字的记录删除
就是说1  2  2
      3    7   2
      .    .   .
      .    .   .
要删除

提交回答
好评回答
  • 2006-10-16 23:23:37
    如果三个字段的值除了数字和字母没有其他的符号,
    那么最简单的方法是直接用字母和数字的比较, 因为数字比字母小.
    严谨是方法是将三个字段转化正ascii码进行比较
    0-9 的ascii的码是从48-57
    delete from a 
    where ascii(字段1)>47 and ascii(字段1)47 and ascii(字段2)47 and ascii(字段3)47 and substr(temp_a.field,i,1) <58 then
          delete from a where id  = temp_a.id;
          exit;
      end loop
    end loop;
    上述语法可能不完整,只是叙述了个方法,谨供参考.
    

    5***

    2006-10-16 23:23:37

其他答案

    2006-10-21 19:32:07
  •   简单判断assic码值,下面是完整的代码,经过测试可以完成删除!几位整数都无所谓!
    declare
    cursor cur_a is select * from a;
    arow cur_a%rowtype;
    number1 varchar(10);
    number2 varchar(10);
    number3 varchar(10);
    begin
    for arow in cur_a loop
    number1:=arow。
      q; number2:=arow。w; number3:=arow。e; dbms_output。put_line(number1||number2||number3); if((ascii(number1)>=47 and ascii(number1)=47 and ascii(number2)=47 and ascii(number3)<=58)) then delete from a where (q=arow。
      q and w=arow。w and e=arow。e); dbms_output。put_line('dsadsadsa'); dbms_output。put_line(number1||number2||number3); end if; end loop; end; 祝你学习更上一层楼,把分给我吧,嘎嘎!!! 还有一种方法就是用chr()函数转换整数做判断! 。
      

    h***

    2006-10-21 19:32:07

类似问题

换一换
  • 数据库 相关知识

  • 电脑网络技术
  • 电脑网络

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 175-194
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):