首页 > 解决方案 > 视图的每一列的定义

问题描述

CREATE TABLE TRANSACTIONS(
SHOP_CODE VARCHAR2(10),
BILL_NO NUMBER(10),
TRAN_DATE DATE,
BILL_DATE DATE,
BILL_AMOUNT NUMBER(10,2)
);
/

CREATE OR REPLACE VIEW TEST55 AS 
SELECT SHOP_CODE,BILL_NO V_NO,TRAN_DATE, TO_CHAR(BILL_DATE,'DD-MON-YYYY') BILL_DATE, NVL(BILL_AMOUNT,0) BILL_AMOUNT,
       (SELECT 'X' FROM DUAL) U_NAME              
  FROM TRANSACTIONS;
/


**Expected result** 
COLUMN_ID       COLUMN_NAME     COLUMN_EXPRESSION
------------    -------------   ----------------------------------
1               SHOP_CODE       SHOP_CODE
2               V_NO            BILL_NO
3               TRAN_DATE       TRAN_DATE
4               BILL_DATE       TO_CHAR(BILL_DATE,'DD-MON-YYYY')
5               BILL_AMOUNT     NVL(BILL_AMOUNT,0)
6               U_NAME          (SELECT 'X' FROM DUAL)

我需要得到如上所述的预期结果。我怎样才能做到这一点?我曾尝试使用 DBMS_METADATA、DBMS_SQL 但未生成预期结果。

标签: sqloracleplsqlviewmetadata

解决方案


推荐阅读