Skip to content

Oracle PL/SQL Tutorial

Learn Oracle SQL

  • Home
  • Joins
    • Inner Join
    • Left Join
    • Right Join
    • Self Join
    • Full Join
  • Constraints
    • Add primary key
    • Add constraint foreign key
    • Drop constraint key
    • Enable a foreign key
    • Disable foreign key
  • Cursors
  • Triggers
  • Indexes
    • Create index oracle
    • Alter index oracle
    • Drop index oracle
    • List all indexes from Oracle database
  • Interview Questions

CASE

CASE example

  
DECLARE 
	v_num NUMBER:=5;
	v_out VARCHAR2(12);
BEGIN
	CASE v_num
		WHEN 1 THEN v_out:='A'; 
		WHEN 5 THEN v_out:='B';
		WHEN 8 THEN v_out:='C';
		ELSE v_out:='D';
	END CASE;
	DBMS_OUTPUT.put_line(v_out);
END;

Output:

B

Post navigation

IF-THEN-ELSE
LOOP
  • PL/SQL Tutorial
  • PL/SQL Functions
  • PL/SQL Select Query
  • PL/SQL Table Joins
  • PL/SQL Cursors
  • PL/SQL Collections and Records
  • PL/SQL Triggers
  • PL/SQL Views
  • PL/SQL Exception Handling
  • PL/SQL Sequential Control
  • PL/SQL Iterative Control
  • PL/SQL Control Structures
  • PL/SQL Procedure
  • PL/SQL Function
  • PL/SQL Data Types
  • PL/SQL Indexes
  • PL/SQL Constraints
  • PL/SQL %ROWTYPE Attribute
  • PL/SQL %TYPE Attribute
  • PL/SQL Variables
  • PL/SQL Anonymous block
  • PL/SQL Operators
  • PL/SQL Delete
  • PL/SQL Update
  • PL/SQL Insert
  • PL/SQL Select
Copyright 2013 - 2022 PL/SQL Tutorial | Privacy Policy
↑