Oracle的语句SELECT <include refid="Base_Column_List"/> FROM SYS_ADMINISTRATIVE_AREA CONNECT BY PRIOR ID = C_PARENT_ID AND i_flag = - 1 START WITH i_flag = - 1 <if test="ids != null and ids!='' "> AND ID IN <foreach collection="ids.split(',')" open="(" index="index" item="item" separator="," close=")"> #{item} </foreach> </if> ORDER BY I_ORDER 改造成mysql语句
时间: 2024-03-11 14:50:38 浏览: 78
include 详析
您所提供的Oracle语句可以使用以下MySQL语句进行改造:
```
SELECT * FROM SYS_ADMINISTRATIVE_AREA WHERE i_flag = -1 AND ID IN (SELECT * FROM (SELECT CAST(split_string(ids, ',') AS UNSIGNED) AS ID FROM (SELECT '${ids}' AS ids) AS t) AS temp)
START WITH i_flag = -1
CONNECT BY PRIOR ID = C_PARENT_ID
ORDER SIBLINGS BY I_ORDER;
```
其中,您需要将`${ids}`替换为您实际的`ids`值。此外,MySQL中没有直接支持的`split_string`函数,您需要自行实现该函数或使用第三方的实现。
阅读全文