Skip to Content
Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts
book

Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts

by John Adolph Palinski
August 2002
Intermediate to advanced content levelIntermediate to advanced
528 pages
10h 12m
English
Addison-Wesley Professional
Content preview from Oracle SQL and PL/SQL Handbook: A Guide for Data Administrators, Developers, and Business Analysts

Case Expressions

Case expressions are an Oracle tool similar in nature to the DECODE statement. CASE statements offer the business analyst added f lexibility and logical power, and they are easier to read than the DECODE statement. A CASE statement is a good tool for breaking data into classes or buckets. A syntax template of the statement follows:

				Case when
				condition1
				then
				expression1
				When
				condition2
				then
				expression2
				[Else]
				expression2a
				End
			

Listing 6.17 illustrates the use of a CASE statement to create a histogramtype report. The report counts the number of employees who have wages within specific classes. The classes consist of $5,000 increments. A SUM group function is created for each class. A CASE statement is then placed inside the group ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Expert PL/SQL Practices for Oracle Developers and DBAs

Expert PL/SQL Practices for Oracle Developers and DBAs

John Beresniewicz, Adrian Billington, Martin Büchi, Melanie Caffrey, Ron Crisco, Lewis Cunningham, Dominic Delmolino, Sue Harper, Torben Holm, Connor McDonald, Arup Nanda, Stephan Petit, Michael Rosenblum, Robyn Sands, Riyaj Shamsudeen
Beginning Oracle SQL: for Oracle Database 12c, Third Edition

Beginning Oracle SQL: for Oracle Database 12c, Third Edition

Lex De Haan, Tim Gorman, Inger Jørgensen, Melanie Caffrey

Publisher Resources

ISBN: 0201752948Purchase book