sql - Oracle : Which column to update ? Complex query -


i have table 15 columns, 12 columns (january, february, march, ..., december), fill table should know column update.

because update query depends on user entry, if enter 1 should update january , so...

i know if it's possible or not ?

i have 3 queries :

  1. i collect data many tables calculate value 1 year, 1 month 1 sens(import/export , product)
  2. i put result in intermediate table sens, year, month , value
  3. third query update table intermediate table

this third table have (january, february, march,..) columns

thanks

what you've got there bad database design. best cource take normalise columns single column additional column indicate month.

however, can control column updated case statement.

update   my_table set   january_col  = case when column_to_update = 1 new_value else january_col  end,   february_col = case when column_to_update = 2 new_value else february_col end,   march_col    = case when column_to_update = 3 new_value else march_col    end,   ... etc   ... 

Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -