Oracle-CREATE TABLE AS SELECT for data migration

 

- by the CAST () method redefined type conversion type and length and uses the source table data, data migration to achieve the effect, and Notes fields need to add a separate index table space default configuration 
- Examples: 
the CREATE  TABLE username .TABLE_TEST 
(COL1 DEFAULT  ' 0 '  NOT  NULL , 
COL2 DEFAULT TO_DATE ( ' 19000101 ' , ' YYYYMMDD ' ), 
COL3) 
AS  
SELECT  CAST ( ' 1 '  AS  VARCHAR2 ( 1 )) AS COL1,
 CAST (SYSDATE AS DATE) AS COL2,
CAST(1 AS NUMBER(10)) AS COL3
FROM DUAL;
--结果:

 

 

  

 

Guess you like

Origin www.cnblogs.com/yangjn/p/12722220.html