Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Use Existing Values in UPDATE Statements
How To Use Existing Values in UPDATE Statements? - Oracle DBA FAQ - Understanding SQL DML Statements
✍: FYIcenter.com
If a row matches the WHERE clause in a UPDATE statement, existing values in this row can be used in expressions to provide new values in the SET clause. Existing values are represented by columns in the expressions. The tutorial exercise below shows a good example:
UPDATE fyi_links SET id = 1000 + id, counts = id*2 WHERE id >= 250; 3 rows updated. SELECT * FROM fyi_links WHERE id >= 250; ID URL NOTES COUNTS CREATED ----- -------------------- ------------ ------- --------- 1250 Retail Sales.com Wrong URL 500 07-MAY-06 1260 Recruiting.com Wrong URL 520 07-MAY-06 1270 Payroll.com Wrong URL 540 07-MAY-06
This statement increased values in the id column by 1000.
2007-04-21, 4566👍, 0💬
Popular Posts:
How To Set Background to Transparent or Non-transparent? - CSS Tutorials - HTML Formatting Model: Bl...
How To Return Top 5 Rows? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries If you want ...
What would you use to compare two String variables - the operator == or the method equals()? You can...
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notif...
What is XSLT? XSLT is a rule based language used to transform XML documents in to other file formats...