Home > database >  Oracle SQL statements will one die is zero update into another column values, not to 0 has a value n
Oracle SQL statements will one die is zero update into another column values, not to 0 has a value n

Time:10-01

As shown in figure, as shown in the table openprice zero value in a column in the modified into precloseprice values,
Requirement is that each line openprice values and corresponding precloseprice values, not zero does not need to be modified,

CodePudding user response:

 update t set openprice=precloseprice where openprice='0'; 


The name of the table it ourselves

CodePudding user response:

The update t set openprice=precloseprice where openprice='0';
You this statement is wrong, after the execution, precloseprice value is 0,
Its unless that's what I was writing, but after execution, the result is wrong, I am in PLSQL,

CodePudding user response:

reference 1st floor js14982 response:
 update t set openprice=precloseprice where openprice='0'; 


The table name it ourselves


The result is wrong, is invalid, precloseprice be updated to 0

CodePudding user response:

Should not, update t set precloseprice=openprice where openprice='0'; So just can appear you say that?

CodePudding user response:

1 # statement there is no problem, check the building Lord, on the table to have a trigger,
  • Related