Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PLSQL Data Type Sensitive Comparison

John VillafaniaAug 31 2022

I have a student_info table that has a column marital_status_code of varchar(60) data type. I have a query like this.
SELECT CASE marital_status_code WHEN '1' THEN 'Single' WHEN '2' THEN 'Married' ELSE 'Unkown' END AS 'Marital_Status' FROM student_info;
The result returns that all records have 'Unknown' Marital_Status even when there are records with 1 or 2. The table contains data uploaded from a csv file.
Using a simple select statement with a condition "WHERE marital_status_code = '1';" also returns no record.
I can't find a way to fix this. Any assistance on this matter is appreciated.

This post has been answered by BluShadow on Aug 31 2022
Jump to Answer
Comments
Post Details
Added on Aug 31 2022
6 comments
191 views