oracle怎么去除0,oracle怎么去除空格

oracle去掉数字后面的0

给你做个试验你就知道了

成都创新互联主要从事做网站、网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务沂水,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18982081108

create table test

(id varchar2(6));

insert into test values ('120000');

insert into test values ('120010');

insert into test values ('120200');

insert into test values ('123000');

insert into test values ('123001');

commit;

执行第一遍:

update test set id=substr(id,1,5) where id like '%0';

commit;

此时结果:

执行第二遍:

update test set id=substr(id,1,4) where id like '%0';

commit;

后边就不举例了,也就是语句执行4遍,需要修改里边的参数。

oracle数据库如何分段去0

我写一份,你试试,看看能不能通过一个SQL就能完成

select t.employee_id employee_id,

t.department_id department_id,

min(t.start_date) date,

min(t.start_date) start_date,

max(t.end_date) end_date,

(select t2.position

from table_name t2

where t2.employee_id = employee_id

and t2.department_id=department_id

and t2.end_date =end_date ) position

from table_name t

group by employee_id,

department_id,

position

oracle如何获取当前月份,去掉前面的0

如果字符串只有开头有零,而字符串中间没有0,那么可以使用replace(字符串,'0','')

如果0开头最长的位数不长,那么可以逐个判断。

比如我可能知道这里面最长的就是连续5个0开头的,这样我就判断如果遇到5个0开头的就截掉前五位,4个0开头截掉前四位,3个0开头截掉前三位,一直到1,逐个判断使用case when可以完成.但是如果最长的0开头个数不确定,就比较麻烦了。


分享文章:oracle怎么去除0,oracle怎么去除空格
转载注明:http://csdahua.cn/article/hciiee.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流