改成oracle写法
时间: 2023-07-04 20:15:32 浏览: 189
这是一段MyBatis的SQL语句,如果您需要将其转换为Oracle数据库的写法,可以将其中的LIMIT、LEFT JOIN、IF、FOREACH等语法转换为Oracle对应的语法,同时需要注意一些MyBatis中特有的语法特性。具体可以参考以下转换后的Oracle SQL语句:
```
SELECT
has.id,
has.employee_id,
has.shift_id,
has.scheduling_date,
has.attendance_time_str,
e.name,
e.phone,
hsm.name as shiftName,
hadm.week_name,
hadm.week_code,
(hsm.name || ' ' || has.attendance_time_str) as shiftData
FROM
ha_attendance_scheduling has,
employee e,
ha_shift_mg hsm,
ha_attendance_day_mg_hi hadm
WHERE
has.employee_id = e.employee_id
AND has.shift_id = hsm.id
AND hadm.shift_id = has.shift_id
AND hadm.attendance_group_id = has.attendance_group_id
AND has.company_id = :companyId
AND has.attendance_group_id = :attendanceGroupId
AND has.is_delete = '0'
AND e.is_delete = '0'
AND substr(has.scheduling_date, 1, 7) = :shiftDate
AND (
:employeeIds IS NULL
OR has.employee_id IN (
SELECT column_value FROM TABLE(:employeeIds)
)
)
GROUP BY
has.employee_id,
has.scheduling_date,
has.id,
has.shift_id,
has.attendance_time_str,
e.name,
e.phone,
hsm.name,
hadm.week_name,
hadm.week_code,
(hsm.name || ' ' || has.attendance_time_str)
ORDER BY
has.scheduling_date;
```
在转换过程中,我们将LEFT JOIN操作转换为了WHERE条件,并将IF和FOREACH语法转换为了Oracle中的条件查询和表函数查询。同时,我们也将原来的#{xxx}参数替换成了Oracle中的:xxx参数。请根据实际情况进行适当调整。
阅读全文