Avatar of Wilder1626
Wilder1626Flag for Canada

asked on 

Oracle - Case clause issue

Hi,

I have a query that i would like to insert a CASE that if TRT.trlr_type_id LIKE ('%HTD%')  then i need to put '0' in the column TRT.current_num_vehicles of the same row.

I tried like below but i get an error:
Error report -
Unknown Command

Select ...
CASE
  WHEN TRT.trlr_type_id LIKE ('%HTD%') THEN TRT.current_num_vehicles = '0';
  WHEN TRT.trlr_type_id LIKE ('%HEAT%') THEN TRT.current_num_vehicles ='0';
  ELSE TRT.current_num_vehicles
  END AS NUM_VAL,

Open in new window


How can i do that?
Thank you for your help
Oracle DatabaseSQL

Avatar of undefined
Last Comment
Wilder1626
ASKER CERTIFIED SOLUTION
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Wilder1626
Wilder1626
Flag of Canada image

ASKER

ok, so from what i see, you cannot override another column value. right?

I can only populate the result in the column  NUM_VAL.

I have a column in my query called TRT.current_num_vehicles and i wanted to update that column value with a ZERO and not the column NUM_VAL.
Avatar of Wilder1626
Wilder1626
Flag of Canada image

ASKER

Thanks, i will use this instead of looking after change another column value.
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo