-1

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.

jaykio77
  • 379
  • 1
  • 7
  • 22

2 Answers2

1

You can try to use the NVL:

NVL(class_code, 'Not Enrolled')

This way, whenever the value for the column CLASS_CODE is NULL, it will populate the void with a "Not Enrolled".

EdwardKirk
  • 425
  • 1
  • 7
  • 16
1

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;
Ankit Bajpai
  • 13,128
  • 4
  • 25
  • 40