The precision/scale are neglected, when running the following example in Oracle 11g:
CREATE OR REPLACE FORCE VIEW VSA_X ASTable X will have no precision/scale for FLD1. It is bypassed and will simply have NUMBER for its datatype. This is a bug in Oracle.
SELECT
CAST(1 AS NUMERIC(10,2)) AS FLD1,
ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY 1) AS RN
FROM DUAL;
DROP TABLE X;
CREATE TABLE X AS SELECT * FROM VSA_X;
Note:
- Using NUMBER in stead of NUMERIC makes no difference, the bug is still there.
- Explicitly casting the ROW_NUMBER() function also makes no difference.
Put the window function inside a derived table:
CREATE OR REPLACE FORCE VIEW VSA_X ASKeywords: CTAS omits precision, CTAS omits number precision, CTAS bypasses precision, CTAS bypasses number precision.
SELECT
CAST(FLD1 AS NUMERIC(10,2)) AS FLD1,
RN
FROM
(
SELECT
1 AS FLD1,
ROW_NUMBER() OVER (PARTITION BY 1 ORDER BY 1) AS RN
FROM DUAL
) x;
No comments:
Post a Comment