In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Let's take a look at the simple use of Oracle cursors, as shown below:
Create or replace procedure NW_DelYW (iOPERATION_ID number, sUserID varchar2) is sCurDJBH yw_operation_link.djbh%type; cursor table_yw (ywid yw_operation.id%type) is select * from yw_operation_link T1 where t1.operation_id = ywid;begin for dr in table_yw (iOPERATION_ID) loop sCurDJBH: = dr.djbh;-- get opercationid / * select t1.operation_id into sOperationID from yw_operation_link T1 where t1.djbh = sCurDJBH * /-- write log insert into log_zfywinfo (DJBH, DJDL, DJXL, DLMC, XLMC, SLR, SLRID, SQRXM, FWZL, ZFRQ, ZFRID, zfr) select distinct sCurDJBH, t4.id, t3.id, t4.name, t3.name, t1.slry, t1.slryid, t1.SQRXM, t1.zl, sysdate SUserID, (select tt.name from pw_user tt where tt.id=sUserID) from yw_operation T1 join yw_operation_link T2 on t2.operation_id = t1.ID join BUSINESS_TYPE T3 on t3.id = t1.business_id join BUSINESS_CLASS T4 on t4.id = t3.parent_id where t1.ID = dr.operation_id Exception when others then rollback; dbms_output.put_line (sqlerrm); end NW_DelYW
Oracle uses cursor cursor loops to add and delete updates.
Knowledge point expansion:
Simple example of Oracle cursors
Use cursors to print employee names and salaries
Set serveroutput on;declarecursor cemp is select ename,sal from emp;cname emp.ename%type;csal emp.sal%type;begin open cemp; loop fetch cemp into cname,csal; exit when cemp%notfound; dbms_output.put_line (cname | | 'salary is' | | csal); end loop;end;/
Cursor with parameters
Use cursors to print the names of all employees in a department number
Set serveroutput on;declare cursor cemp (cno emp.deptno%type) is select ename from emp where emp.deptno = cno;cname emp.ename%type;begin open cemp (10); loop fetch cemp into cname; exit when cemp%notfound; dbms_output.put_line (cname); end loop;end;/
Summary
The above is the simple usage of the Oracle cursor introduced by the editor to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.