SQL - Constraints • Default



--====================================================
SQL - Constraints      Default
--====================================================

DROP TABLE XX_EMP_TL

CREATE TABLE XX_EMP_TL
(
  EMPNO     NUMBER(4),
  ENAME     VARCHAR2(100),
  HIREDATE  DATE,
  SAL       NUMBER(7),
  DEPTNO    NUMBER(2),
  CREATION_DATE Date
)

select * from XX_EMP_TL

insert into  XX_EMP_TL (EMPNO, ENAME, HIREDATE, SAL, DEPTNO, CREATION_DATE)  Values ( 1000, 'Sachin', '1-MAR-2020', 25000, 10, sysdate)

Commit;

select * from XX_EMP_TL

insert into  XX_EMP_TL (EMPNO, ENAME)  Values ( 1001, 'Mohan' )

Commit;

select * from XX_EMP_TL

EMPNO
ENAME
HIREDATE
SAL
DEPTNO
CREATION_DATE
1000
Sachin
01-Mar-20
25000
10
26-03-2020 21:48
1001
Mohan






DROP TABLE  APPS.XX_EMP_TL

--====================================================

CREATE TABLE XX_EMP_TL
(
  EMPNO     NUMBER(4),
  ENAME     VARCHAR2(100),
  HIREDATE  DATE DEFAULT TO_DATE(sysdate),
  SAL       NUMBER(7) DEFAULT 10000,
  DEPTNO    NUMBER(2) DEFAULT 10,
  CREATION_DATE Date DEFAULT SYSDATE
)

select * from XX_EMP_TL

insert into  XX_EMP_TL (EMPNO, ENAME, HIREDATE, SAL, DEPTNO, CREATION_DATE)  Values ( 1000, 'Sachin', '1-MAR-2020', 25000, 10, sysdate)

Commit;

select * from XX_EMP_TL

insert into  XX_EMP_TL (EMPNO, ENAME)  Values ( 1001, 'Mohan' )

Commit;

select * from XX_EMP_TL

EMPNO
ENAME
HIREDATE
SAL
DEPTNO
CREATION_DATE
1000
Sachin
01-Mar-20
25000
10
26-03-2020 21:48
1001
Mohan
26-Mar-20
10000
10
26-03-2020 21:50


DROP TABLE  APPS.XX_EMP_TL


SELECT * FROM ALL_CONSTRAINTS 
WHERE TABLE_NAME = 'XX_EMP_TL'



Comments

Popular posts from this blog

E-Text Report In Fusion | Types of E-Text reports

Supplier API's

How to pass default Parameter in cursor