How to Use CREATE Command in SQL
How to Use CREATE Command in SQL
--====================
--Create Table
--====================
Create Table
XX_EMP_TL
(
EMP_ID NUMBER,
EMP_NAME VARCHAR2(100),
EMP_DOB DATE,
EMP_GRADE CHAR
)
Desc
XX_EMP_TL
select * from
XX_EMP_TL
Create TABLE XX_EMP_BKUP
AS
select * from
XX_EMP_TL
desc
XX_EMP_BKUP
select * from
XX_EMP_BKUP
--====================
--Create View
--====================
select * from
XX_EMP_TL
Create or Replace View
XX_EMP_V
AS
select * from
XX_EMP_TL
select * from
XX_EMP_V
Create or Replace View
XX_EMP_V
AS select
EMP_NAME,
EMP_GRADE from
XX_EMP_TL
--====================
--Create
PROCEDURE
--====================
CREATE or REPLACE procedure
XX_EMP_PROC (
ERRBUF OUT VARCHAR2,
RETCODE OUT NUMBER
)
AS
BEGIN
null;
END;
desc
XX_EMP_PROC
--====================
--Create Function
--====================
CREATE OR REPLACE FUNCTION
XX_EMP_FUN ( P_EMP_NO
VARCHAR2 ) return VARCHAR2
AS
V_NAME VARCHAR2(100);
BEGIN
select
EMP_NAME INTO
V_NAME
from
XX_EMP_TL
where
emp_id =
P_EMP_NO;
Return (
V_NAME );
END;
Comments
Post a Comment