oracle表格颜色,如何在oracle中使用光标更新特定颜色
如果我正確理解您的要求,您希望通過1對所有行遞增eks列,只要所有行總的eks*harga是在預算范圍內。第一次通過后,如果仍有預算剩余,則要重新重復該過程。
我修改了,光標開放使用FOR循環,因為我很喜歡這種語法。
DECLARE
bbs jharga.budget%TYPE;
tharga jharga.budget%TYPE;
balance NUMBER;
CURSOR eksupdate
IS
SELECT isbn, judul, frekuensi, stok, harga, prioritas, eks,
kelompok, bobot
FROM pp_gabungan
FOR UPDATE OF eks NOWAIT;
BEGIN
--get the allotted budget
SELECT budget
INTO bbs
FROM jharga;
--get the total amount
SELECT SUM (eks * harga)
INTO tharga
FROM pp_gabungan;
balance := bbs - tharga; -- the balance amount
--as long as the balance is more than zero , the cusor will be repeatedly called.
-- also note that i've given a name to the loop, loop1
<>
WHILE balance > 0
LOOP
--for loop to open/fetch the cursor, this has been given name loop2
<>
FOR i IN eksupdate
LOOP
--if the balance amount is less than that of harga, exit from both the loops
EXIT loop1 WHEN balance < i.harga;
--if balance amount is more than harga, update the eks by 1
UPDATE pp_gabungan
SET eks = autoeks.eks + 1
WHERE CURRENT OF eksupdate;
--decrease the balance by harga
balance := balance - i.harga;
END LOOP loop2;
END LOOP loop1;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
DBMS_OUTPUT.put_line (SQLERRM);
END;
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的oracle表格颜色,如何在oracle中使用光标更新特定颜色的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: oracle段管理方式设为自动,orac
- 下一篇: oracle修改时区无效,Linux 7
