oracle问题
假设表是这样的 表名 a 字段名1,字段2,字段3 1 a b a 1 b 1 2 2 3 7 2 . . . . . . . . . . . . . . . . . . 现在三个字段的数据类型都是字符型的 我现在想把看上去都是数字的记录删除 就是说1 2 2 3 7 2 . . . . . . 要删除
如果三个字段的值除了数字和字母没有其他的符号, 那么最简单的方法是直接用字母和数字的比较, 因为数字比字母小. 严谨是方法是将三个字段转化正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; 上述语法可能不完整,只是叙述了个方法,谨供参考.
简单判断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()函数转换整数做判断! 。
问:SQL语句使用union all后如何知道返回的每一条记录属于哪一张原表
答:这个问题不难解决,请参考如下代码(SYBASE): select * from (select '1' a,* from [表1] union all sele...详情>>
答:不知道你是不是写错文件名了,pdf?详情>>
答:当电脑的全部组件(包括软件)我们国家都能生产的时候。详情>>