We are in the process of creating masked data using PL/SQL.We adapted Create as select as one of the approaches to masked the data in the target table.
Below is sample source table structure
COLUMN NAME DATATYPE
EMPID NUMBER(8)
NAME VARCHAR2(40)
DOB TIMESTAMP(6)
While creating the target table we are masking NAME and DOB columns and inputting the masked data in the target table.
Below is the target table structure after masking
COLUMN NAME DATATYPE
EMPID NUMBER(8)
NAME VARCHAR2(100)
DOB DATE
Please help us understand why there is a difference in the source and target table structure using masking for Create As select .
CTAS infers data types based on the values your subquery returns.
To ensure they have a specific data type, cast them:
create table t_copy as
select cast ( c1 as ... ) c1 ,
cast ( c2 as ... ) c2 ,
...
from t;While creating the target table we are masking NAME and DOB columns How exactly are you doing this masking? By any chance are the masked named up to 100 characters long, and the masked DOBs DATEs?