declare begin for i in (select * from emp) loop if i.sal=1300 then update emp set sal=13000; end if; end loop; end;
This code updates all records with a salary of 13000.Instead, I want to update records with a salary of 1300 to a value of 13000.Can you tell me where I made a mistake?I use entries using an implicit cursor.for each record, I check the sal value of this record. If the salary value in a particular record is 1500, I want to update it to 15000.
, , . , ; , , .
, , where, , , . , ( ), rowid:
begin for i in (select rowid, emp.* from emp) loop if i.sal=1300 then update emp set sal=13000 where rowid=i.rowid; end if; end loop; end;
- "update... where current of cursorname".
:
update emp set sal = 13000 where sal = 1300
.
, , , 1300, SQL:
update emp set sal=13000;
13000. , 1300, 13000.sal . 1500, 15 000.
13000. , 1300, 13000.
sal . 1500, 15 000.
, ?
1500 , :
UPDATE emp SET sal = 15000 WHERE sal = 1500;
, :
UPDATE emp SET sal = sal * 10;
Source: https://habr.com/ru/post/1703344/More articles:What is the latest version of Lucene.net? - lucene.netHow to use Symbol packages for Windows with Visual Studio 2008? - debuggingCreating XML string in Flex (AS3) using DOM functions - domКак вы рекурсивно вызываете задачи в MSBuild? - .netSQL: update statement with dynamic column value assignment - sqlJumping from Java to C ++ - c ++SQL: using target table in UPDATE statement in nested FROM clause - sqlThrowing / throwing exceptions from C'tor static object in C ++ - c ++spelling arabic text in opengl - fontsDisplay a downward triangle in VB.NET ▼ (U + 25BC) - vb.netAll Articles