Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7545999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:05:10+00:00 2026-05-30T09:05:10+00:00

Let me be clear with the problem – I have a query used to

  • 0

Let me be clear with the problem – I have a query used to update a few columns in an Oracle table:

UPDATE MED_COM_MAPPER_CMDS SET STATUS = ?, OUTAGE_ID = ? WHERE CMD_ID = ?

I want to conditionally not update the OUTAGE_ID column value table unless I have a particular value in the STATUS column. How can I implement this within the same method as shown below? Changes to the method are acceptable, but not too many. Is it not possible to do this in the same method shown by the below lines of code ?

Connection connection = DatabaseUtil.getConnection();
preparedStatement.setInt(1, Integer.parseInt(status));

// On a condition, how can i avoid updating this column value.
// That means keep intact what it is in the DB.
preparedStatement.setString(2, outage_id); 
preparedStatement.setString(3, cmd_id);

int i = preparedStatement.executeUpdate();
connection.commit();

This is to just to make it simple. It can be done by overriding the query or the method or by if conditions with increment of index value.

Hope I’ve been clear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:05:12+00:00Added an answer on May 30, 2026 at 9:05 am

    How about change the update statement, something like:

    UPDATE MED_COM_MAPPER_CMDS 
    SET STATUS = :stat, 
    OUTAGE_ID = decode(status, 'X', :new_val, outage_id)
    WHERE CMD_ID = blah
    ;
    

    If status = ‘X’ (the existing status value that is), then update outage_id with new_val, else keep existing outage_id.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have 10 breakpoints and I want to clear one but not
Let's say I have cleaner like this .cleaner:after { content: '.'; display: block; clear:
The title is not clear so let me explain: In my apps, I have
I have a problem calling a static method from a class. Let me explain
This is my problem: I have a partition on my Ubuntu system, let's call
Ok Title may not be clear so let me explain. I have 2 classes,
So let's see if I can write a clear enough description of my problem...
I have searched and not found any clear answers to a problem im having.
Is it possible to clear one action's cache from another action? Let's say my
Ok, the question might not be crystal clear. Let me give some details: Let's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.