【问题标题】:Query about database (mysql, oracle)查询数据库(mysql、oracle)
【发布时间】:2014-08-20 14:02:43
【问题描述】:

我在项目上遇到了一些麻烦。 我有 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')

真的很着急,因为有人在逗我。

【问题讨论】:

    标签: mysql database oracle


    【解决方案1】:

    用“plsql”函数替换“mysql”函数 带有 substr 的子字符串 与 || 连接在您要连接的内容之间 如果 convert 是将类型更改为数字,则将其替换为 to_number

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多