PLSQL- Question: to delete the records I have execute immediate - TopicsExpress



          

PLSQL- Question: to delete the records I have execute immediate (Delete from sden where sden_pidm= ||vc_pidm); sden_cnt:= SQL%ROWCOUNT; sdenDeletednumber := sdenDeletednumber + sden_cnt; Where vc_pidm is the returned value from the cursor loop the sdenDeletednumber is always 0 even though the count in the loop is 40. Before this loop Im putputing the vc_pidm values. Ans: You had mentioned that you are populating vc_pidm from a cursor before the loop, so vc_pidm is a plsql table, right? If I am right in that case you have to use a subsript (index) while referring to the plsql table within the loop (ex.,vc_pidm(ivar) where ivar should be a incremented for every iteration of the loop). (or) vc_idm is a simple variable which is getting populated from a cursor and is used directly in execute immediate....(if you have pasted the loop.. i would have got an idea... just want to know if your execute immediate is within a simple loop or a cursor for loop?) Anyway check the folllowing: > check vc_pidm holds the correct value from your cursor... dbms_output.... vc_pidm and check... > May be non of the rows in sden table are getting satisfied based on the vc_pidm value > check if sdenDeletednumber variable is initialized to 0 (u said its value is 0 ... i understand but just cross check) > if vc_pidm is varchar2 column ... i mean the content... try doing a trim(vc_pidm)... to take care of the spaces...
Posted on: Sun, 10 Nov 2013 18:24:40 +0000

Trending Topics



Recently Viewed Topics




© 2015