查询数据库(mysql,oracle)

时间:2014-08-20 14:02:43

标签: mysql database oracle

我在项目上遇到了一些麻烦。 我有1个mysql查询句子。 我需要将它从mysql更改为oracle。 查询如下,

select substring(ad_cde,1,18)
from advertise
where substring(ad_cde,1,18)='119821168010300222'


insert into advertise(ad_cde)
select concat('119821168010300000',lpad(convert(substring(max(ad_cde),19,3),unsigned)+1,3,'0')) as a
from advertise
where substring(ad_cde,1,18)='119821168010300000' 
and EXISTS(select * from advertise where substring(ad_cde,1,18)='119821168010300000')


insert into advertise(ad_cde)
select concat('119821168010300101',lpad(convert(substring(max(ad_cde),19,3),unsigned)+1,3,'0')) as a
from advertise
where NOT EXISTS(select * from advertise where substring(ad_cde,1,18)='119821168010300101')

它真的很着急,因为有人在戏弄我。

1 个答案:

答案 0 :(得分:0)

替换' mysql'功能与' plsql'功能 substring with substr 与||结合你想要连接什么之间 如果转换是将类型更改为数字,请将其替换为to_number