need help to trigger to update the change of columns of a table

Hi all
I need help in the manufacture of change update trigger in the columns from one table to another table.
For example, table (col1 col 2 col 3 col 4 col 5 samplea
.. .Col 20

Now if I do any change in one of the data column must be changed to
sample_copya... table that contains duplicate column

So for this I thought to create a trigger with the following logic



If updating (col1) then
Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
Otherwise, if the update (col2) then
Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
Otherwise, if the update (col3) then
Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

end if;
But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
I would like to know if there is a simpler method to achieve...
Thank you

susf wrote:
Hi all
I need help in the manufacture of change update trigger in the columns from one table to another table.
For example, table (col1 col 2 col 3 col 4 col 5 samplea
.. .Col 20

Now if I do any change in one of the data column must be changed to
sample_copya... table that contains duplicate column

So for this I thought to create a trigger with the following logic

If updating (col1) then
Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
Otherwise, if the update (col2) then
Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
Otherwise, if the update (col3) then
Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

end if;
But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
I would like to know if there is a simpler method to achieve...
Thank you

What is the purpose of this trigger?
How can you be sure that ' where n ° 1 =: new.no1 "is true?
How does line in the SAMPLE_COPYA table at the start?
only the last modified value will lie in SAMPLE_COPYA than the previous values is written more

Tags: Database

Similar Questions

Maybe you are looking for

  • Which photos stay permanently in my library of Photos on my Mac, not only in the photo stream?

    I just upgraded to El Capitan 10.11.6 and now tries to use the new Photos app, version 1.5. I have not activated icloud photo library on the computer or the iPhone or iPad and do not want. I would like to know what pictures, cases, will actually stay

  • Windows does not start after the use of CD "" Toshiba Recovery and Applications/drivers ".

    Well my Toshiba Satellite A205-S5814 laptop was very slow and I was getting very frustrated with it, so I decided pop in the CD "Toshiba Applications/Drvers" perhaps to restore my laptop to factory settings and run perfect once again. As I was doing

  • Satellite A30 - portable computer turns off

    HelloIve hada satellite a30 for about 2 years now.A few weeks ago, I reformatted the laptop and now whenever I watch a DVD after that 30 minutes, the laptop turns off and then used charging for a while.In my view, it is an overheating problem but im

  • Satellite P300D - wireless connection problems

    Good evening. Sorry for my bad English. Here's my problem: whenever I try to install my wireless modem, my computer shuts down, the blue screen before connecting off the coast with many words that I did not have time to read. The modem is certainly n

  • DV 9933nr

    Hi everyone, I need help with the part number of motherboards for HP Pavilion dv 9933nr and HP Pavilion 9890el. Much apreciated