我收到以下语句的SQL错误ORA-00933。这在postgres中解析,但在oracle中没有解析...如何为oracle格式化?
提前致谢!
UPDATE comments
SET parent_type='report'
FROM reports
WHERE comments.parent_id=reports.id;
答案 0 :(得分:4)
尝试使用Oracle:
UPDATE Comments
SET parent_type = 'report'
WHERE parent_id IN (SELECT Id FROM Reports)
或者,如果您尝试将值设置为等于另一列中的值:
UPDATE Comments
SET parent_type = (SELECT FieldName
FROM reports
WHERE reports.id = Comments.parent_id);
这适用于MSSQL:
UPDATE c
SET c.parent_type='report'
FROM Comments c JOIN reports r ON c.parent_id=r.id
祝你好运。