Search code examples
oracle-databaseconditional-operatormaterialized-views

Replace empty column by some string in Oracle Materialized view


I have to create a materialized view based on data:-

ID   Class_Code   Student_Name
1     1011         Jatin
2     1012         Pual
3                  Patrick
4     1014         Liaba
5                   Noah

and i want a materialized view to return

 ID   Class_Code  Student_Name
 1     1011        Jatin
 2     1012        Pual
 3     Not Enrolled Patrick
 4     1014         Liaba
 5     Not Enrolled Noah

Yes i did some research on google and did not get any thing. CASE WHEN statements return weird results. Please help.


Solution

  • I dont think this is much complexed. You may try this below simple query -

    SELECT ID, NVL(Class_Code, 'Not Enrolled') Class_Code, Student_Name
      FROM YOUR_MV;