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 :
- i collect data many tables calculate value 1 year, 1 month 1 sens(import/export , product)
- i put result in intermediate table sens, year, month , value
- 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
Post a Comment