给定一个像这样的表:
CREATE TABLE "MyTable"
(
"MyColumn" NUMBER NOT NULL
);
我想创建一个像这样的视图:
CREATE VIEW "MyView" AS
SELECT
CAST("MyColumn" AS BINARY_DOUBLE) AS "MyColumn"
FROM "MyTable";
仅当列“MyColumn”为“NOT NULL”时。
在 SQL Server 中,这非常简单:
CREATE VIEW [MyView] AS
SELECT
ISNULL(CAST([MyColumn] AS Float), 0.0) AS [MyColumn]
FROM [MyTable];
但是,Oracle 等效项会导致“NULL”列:
CREATE VIEW "MyView" AS
SELECT
NVL(CAST("MyColumn" AS BINARY_DOUBLE), 0.0) AS "MyColumn"
FROM "MyTable";
无论如何强制Oracle在元数据中将视图的列标记为“NOT NULL”?