Oracle查看sql注释错误

时间:2015-06-01 20:21:13

标签: sql oracle view

当我创建一个视图时,它有很多回车以及一些" - "记录代码行的注释。制作示例:

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

结果记下结果:

  1. 填充在字段上添加到AS(之前与别名齐平,例如"字段AS别名"而不是突然所有AS排队,例如"字段AS别名"。
  2. 在SQL中的某个时刻(在这种情况下,在" COMMENT"字段之后),从那时开始的所有行都会丢失它们的回车。
  3. 任何只有双击(充当分隔符)的注释行都会完全消失。
  4. 如前所述,当视图被实例化并且我立即获得DDL时,它看起来与创建它的方式相同。但是,在某些时候,上述情况发生了。 Oracle方面是否存在一些问题并尝试重新格式化导致此问题的SQL?有没有人见过这个?

0 个答案:

没有答案