如果更改了别名,Oracle 是否会再次硬解析命令?

Does Oracle hard parse a command again if aliases are changed?

如果我执行这样的命令:

select a.Id, b.Name from A b, B b where a.Id = b.Id

然后是这样的第二个命令,更改别名:

select c.Id, d.Name from A c, B d where c.Id = d.Id

会有两次硬解析操作?有类似解析缓存的东西吗?如果是,它是如何工作的?

Oracle 检查查询的校验和,如果校验和已更改,则重新分析查询。

所以,是的,它将重新分析查询。即使您 add/remove 一个空格,校验和也会改变,因此 Oracle 将不得不重新解析它。