Sunday, January 14, 2018
Oracle PLSQL Tutorials For Beginners 2, PLSQL Variables & SubTypes Tu...
/*****************************************************************************
PLSQL DATA TYPES
=> Char
=> Varchar2
=> Date
=> NUMBER ( Integer )
=> Boolean True or Flase
*****************************************************************************/
DECLARE
V_Char char(100):='This is Char';
V_Varchar varchar2(100):='This is Varchar Data Type';
V_Number Number(10):=55555;
V_Date DATE:=SYSDATE;
V_Boolean BOOLEAN:=true;
BEGIN
dbms_output.put_line('Welcome Char Variable : ::: '||V_Char );
dbms_output.put_line('Welcome Varchar Variable : ::: '||V_Varchar );
dbms_output.put_line('Welcome Number Variable : ::: '||V_Number );
dbms_output.put_line('Welcome Date Variable : ::: '||V_DATE );
IF V_Boolean THEN
dbms_output.put_line( 'This is Boolean Variable ::: TRUE');
else
dbms_output.put_line( 'This is Boolean Variable ::: FALSE');
END IF;
END;
/
/*****************************************************************************
PLSQL SUB TYPES
*****************************************************************************/
DECLARE
SUBTYPE name IS char(20);
SUBTYPE address IS varchar2(100);
SUBTYPE phone IS NUMBER(10);
V_MyName name;
V_My_Address address;
V_My_Phone phone;
BEGIN
V_MyName := 'Test Char... ';
V_My_Address := 'Welcome to the PLSQL SubTypes..';
V_My_Phone :=999999999;
dbms_output.put_line('Sub Type Char : ::: ' || V_MyName );
dbms_output.put_line('Sub Type Varchar2 : ::: '|| V_My_Address);
dbms_output.put_line('Sub Type Varchar2 : ::: '|| V_My_Phone);
END;
/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment