如何修改Oracle表中的数据

一 语法

UPDATE table_name
SET column1=value1,...
[WHERE conditions]
二 实例
1、无条件更新
  1. SQL> update userinfo
  2. 2set userpwd='111111';
  3. 已更新4行。
  4. SQL>select userpwd from userinfo;
  5. USERPWD
  6. --------------------
  7. 111111
  8. 111111
  9. 111111
  10. 111111
  11. SQL> update userinfo
  12. 2set userpwd='111',email='[email protected]';
  13. 已更新4行。
  14. SQL>select userpwd,email from userinfo;
  15. USERPWD EMAIL
  16. --------------------------------------------------
  17. 111 cakin@qq.com
  18. 111 cakin@qq.com
  19. 111 cakin@qq.com
  20. 111 cakin@qq.com
2、有条件更新
  1. SQL> update userinfo
  2. 2set userpwd ='1234567'
  3. 3where username='xxx'
  4. 4;
  5. 已更新1行。
  6. SQL>select username,userpwd from userinfo;
  7. USERNAME USERPWD
  8. ----------------------------------------
  9. xxx 1234567
  10. yyy 111
  11. 111
  12. 111
 

猜你喜欢

转载自cakin24.iteye.com/blog/2388599