Can anyone tell me what is the difference between case and decode. and which one is more
beneficial

CASE executes faster.

DECODE works with expressions which are scalar values.

CASE can work with predicates and subqueries in searchable form:

CASE handles NULL values differently

Member Avatar for hfx642

Decode MUST be in a Select statement and will not work using directly as PL/SQL.

A Case statement can be used directly in PL/SQL.

Note: Case is an old statement that was dropped,
BUT was brought back, so check your versions of DB.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.