Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The oracle stored procedure traverses the cursor twice

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

There are two cursors in a stored procedure, and the second cursor uses the value of the first cursor. Here is an example:

Create or replace procedure DYNAMIC_CONFIRM

As

Cursor c1 is select o.id,o.cno,o.icorpid,o.iroeid, o.lr from ccs os inner join cc o on os.ids= o.id where o.istate=3

V C1% rowtypecontrol / assign the type of cursor C1 query value to v

Cno varchar (15)

Begin

Open c1

Loop

Fetch c1 into v

Exit when C1% notfound

Update fc set fc.ibalance = v.lr

/ * declare the cursor 2percent /

DECLARE cursor c2 is SELECT ISMBID FROM FC_SECUMONEYB where FC_SECUMONEYB.IOUTCORPID=v.icorpid AND FC_SECUMONEYB.IDEPID=v.idepid

V1 c2%rowtype

Begin / / traverses the second cursor

Open c2

Loop fetch c2 into v1

Exit when C2% notfound

Insert Into FC_SECUMONEYR (IINCORPID,DDATE,IDEPID,ISETTLEBALANCE) Values (431 sysdateauthoring v.idepidrecoveryv1.ISETTLEBANCE)

End loop

End

End loop

End

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report