-- PL/SQL language -- string connector | select 'abc' | '000000' from dual; -- constants and variables declare -- <-- used to define variables, constants, cursors, and custom data types stu_name nvarchar2 (4); begin -- <-- execution statement start stu_name: = 'lu'; --: = value assignment symbol dbms_output.put_line (stu_name); end; -- <-- execution statement end declare PI constant number: = 3.1415926; -- constant is used to define constants -- Define the Data Type declare type student is record (-- <-- the allowed data types include record and table varray (Variable Length array) name nvarchar2 (20), sex char (2), age INT); stul student; -- <-- The stulbeginstul variable is defined here. name: = 'text'; dbms_output.put_line (stul. name); end; -- if... else statement declare I number; -- defines the number type variable ibegin I: = 1; if I <18 then dbms_output.put_line ('less than 18 '); else NULL; -- null statement, do not execute anything. It plays a placeholder role: end if; end; -- if... elsif... else statement declarei number; begin I: = 40; if I <18 then dbms_output.put_line ('less than 18 '); elsif I> 18 and I <30 then dbms_output.put_line ('less than 30'); else dbms_output.put_line ('outside the scope of Statistics '); end if; end; -- case statement declare C char (2); begin C: = 'C '; case C -- <-- it can be the expression when 'a 'then dbms_output.put_line ('You got A'); When 'B' then dbms_output.put_line ('You got B '); when 'C' then dbms_output.put_line ('You got C'); else dbms_output.put_line (' sorry, you didn't pass '); End case; end; -- loop declare I number; begin I: = 1; loop dbms_output.put_line (I); I: = I + 1; exit when I> 5; exit when I> 10; -- <-- exit can have multiple statements. If not written, it is an endless loop end loop; end; -- while loop declare I number; begin I: = 0; while I <10 loop dbms_output.put_line (I); I: = I + 1; end loop; end; -- For Loop declare I number; SUMI number; begin I: = 0; SUMI: = 100; for I in 1... 100 loop SUMI: = SUMI + I; dbms_output.put_line (SUMI); End loop; dbms_output.put_line (SUMI); end;