当我创建一个视图时,它有很多回车以及一些" - "记录代码行的注释。制作示例:
CREATE VIEW ... AS
SELECT
P.ID AS PRODUCT_ID,
P.PROD_DESC AS PRODUCT_DESC,
P."COMMENT" AS PRODUCT_COMMENT,
P.ACTIVE_IND AS PRODUCT_ACTIVE_IND,
--
SKU.SKU AS SKU,
SKU.PRES_DESC AS SKU_PRESENTATION_DESC
FROM PRODUCTS P
LEFT JOIN SKUS SKU ON P.PRODUCT_ID = SKU.PRODUCT_ID
WHERE P.DELETED = 0 -- Non-deleted products only
AND SKU.DELETED = 0 -- Non-deleted SKUs only
AND P.CAT_ID NOT IN (1, 3) -- Exclude promo and sandbox items
ORDER BY P.ID
最初实例化时,视图很好,当我导出DDL时,它看起来与实例化的格式相同。但是,经过一段时间后,视图SQL被重新格式化,并且神秘地将许多行折叠成一行,有时会导致错误。基于以上的例子:
CREATE VIEW ... AS
SELECT
P.ID AS PRODUCT_ID,
P.PROD_DESC AS PRODUCT_DESC,
P."COMMENT" AS PRODUCT_COMMENT, P.ACTIVE_IND AS PRODUCT_ACTIVE_IND, SKU.SKU AS SKU, SKU.PRES_DESC AS SKU_PRESENTATION_DESCFROM PRODUCTS P LEFT JOIN SKUS SKU ON P.PRODUCT_ID = SKU.PRODUCT_IDWHERE P.DELETED = 0 -- Non-deleted products only AND SKU.DELETED = 0 -- Non-deleted SKUs only AND P.CAT_ID NOT IN (1, 3) -- Exclude promo and sandbox itemsORDER BY P.ID
结果记下结果:
如前所述,当视图被实例化并且我立即获得DDL时,它看起来与创建它的方式相同。但是,在某些时候,上述情况发生了。 Oracle方面是否存在一些问题并尝试重新格式化导致此问题的SQL?有没有人见过这个?