I have created View using unioned CVAS:
CREATE
OR REPLACE VIEW SAMPLEVIEW AS
SELECT
PT.CREDITPARTYACCOUNT AS PT_CREDITPARTYACCOUNT,
PT.DEBITPARTYACCOUNT AS PT_DEBITPARTYACCOUNT,
...
...
FROM
accountingevent AE
LEFT OUTER JOIN paymenttransaction PT ON (
AE.PAYMENTTRANSACTIONKEY = PT.PAYMENTTRANSACTIONKEY
)
OR (
AE.PAYMENTINSTRUCTIONKEY = PT.INCOMINGINSTRUCTIONKEY
)
WHERE
...
UNION ALL
SELECT
PT.CREDITPARTYACCOUNT AS PT_CREDITPARTYACCOUNT,
PT.DEBITPARTYACCOUNT AS PT_DEBITPARTYACCOUNT,
...
...
FROM
accountingevent AE
LEFT OUTER JOIN paymenttransaction PT ON (
AE.PAYMENTTRANSACTIONKEY = PT.PAYMENTTRANSACTIONKEY
)
WHERE
...
ORDER BY 1;
Result of
DESC SAMPLEVIEW;
PT_CREDITPARTYACCOUNT VARCHAR2(1024 CHAR)
PT_DEBITPARTYACCOUNT VARCHAR2(1024 CHAR)
...
...
AND
DESC PAYMENTTRANSACTION;
CREDITPARTYACCOUNT VARCHAR2(256 CHAR)
DEBITPARTYACCOUNT VARCHAR2(256 CHAR)
...
Data Sizes I get are 4 times the size of table column sizes. If we remove the UNION ALL and go with single CVAS than sizes becomes equal in table and view. This view and tables are part of large scripts so something in scripts is off which is causing this behavior. This odd behavior is only visible with char and varchar2 datatypes. I also checked the result of the following query:
select * from NLS_DATABASE_PARAMETERS where parameter='NLS_CHARACTERSET';
NLS_CHARACTERSET AL32UTF8
Kindly guide me on what could be wrong here which is causing this behavior.
Thanks