473,394 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Bulk collect not updating

Hi All,

I have two tables 1) In_decrement_base_ch
Expand|Select|Wrap|Line Numbers
  1.   MSC_ID        VARCHAR2(20 ),
  2.   PLAN_ID    VARCHAR2(20 ),
  3.   ACT_DATE   DATE,
  4.   DUM        VARCHAR2(5 ),
  5.   PADJ       NUMBER(10,2));
  6.  
  7. 2)
  8. CREATE TABLE TMP_ADJ
  9. (
  10.   MSC_ID               NUMBER(20),
  11.   NOMINALAMOUNT         NUMBER(20))
  12.  
  13. I have to comepare MSC_ID and update the Nominalamount in table1 (PADJ)column
  14.  
  15. This is the proc i have written
  16.  
  17.  
  18. CREATE OR REPLACE procedure PRE_DECRE_CALC is
  19.  
  20. lcnt number(5);
  21. TYPE ADJMOB IS TABLE OF tmp_adj.MSISDN%TYPE;
  22. ADJMSISDN ADJMOB ;
  23.  
  24. TYPE ADJAMT IS TABLE OF tmp_adj.NOMINALAMOUNT%TYPE;
  25. ADJNAMT ADJAMT;
  26.  
  27.  
  28.  
  29. BEGIN
  30.  
  31. SELECT COUNT(*) INTO LCNT FROM AUTO_SH_LOAD WHERE TRUNC(LOADDATE)=TRUNC(SYSDATE)-1
  32. AND FILEGROUP IN ('CHPYMT','CHP2P','CHREFL','CHSTAT','CHADJ','CHCLCR','CHSFEE');
  33.  
  34. IF LCNT=7 THEN
  35.  
  36. DECLARE
  37.  
  38. CURSOR C1 IS 
  39. SELECT MSC_ID,SUM(NOMINALAMOUNT)  
  40. FROM tmp_adj A  GROUP BY
  41. MSC_ID;
  42.  
  43.  
  44. BEGIN
  45. OPEN C1;
  46. LOOP
  47. FETCH C1 BULK COLLECT INTO ADJMSISDN,ADJNAMT;
  48. EXIT WHEN C1%NOTFOUND;
  49.  
  50. FORALL I IN ADJMSISDN.FIRST..ADJMSISDN.LAST 
  51.  
  52. UPDATE IN_DECREMENT_BASE_CH V SET V.PADJ=ADJNAMT(I) WHERE  V.MSC_ID=ADJMSISDN(I);
  53. COMMIT;
  54.  
  55.  
  56. END LOOP;
  57. END;
  58. END IF;
  59. END;
  60. /

Procedure got compiled but data is not getting updated in the table 1...

Am i making any mistake here if so pls correct me...

Note : (Auto_Sh_load is a temp log table)
May 26 '10 #1
2 1897
ananthaisin,

can you post the output of:

Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) 
  2. FROM   AUTO_SH_LOAD 
  3. WHERE  TRUNC(LOADDATE)  =  TRUNC(SYSDATE) - 1 
  4. AND    FILEGROUP       IN  ( 'CHPYMT','CHP2P' ,'CHREFL','CHSTAT'
  5.                             ,'CHADJ' ,'CHCLCR','CHSFEE')
  6.  
edited:
I forgot, the output of

Expand|Select|Wrap|Line Numbers
  1. select count(*)
  2. from
  3.   ( SELECT      MSC_ID,SUM(NOMINALAMOUNT)   
  4.     FROM         tmp_adj A  
  5.     GROUP BY MSC_ID
  6.   );
  7.  
also.
May 30 '10 #2
amitpatel66
2,367 Expert 2GB
Firstly, when you are using Fetch..BULK COLLECT clause then why you need a LOOP?
Jun 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Paul Rowe | last post by:
Hi "You" I have two collection types declared at the SQL level. 1. Do you know of any known bugs with the BULK COLLECT clause used with the TABLE operator? I have a situation now where I am...
20
by: akej via SQLMonster.com | last post by:
Hi, i have table with 15 columns CREATE TABLE . ( PRIMARY KEY , NULL , NULL , NULL , NULL , (50) NULL , NULL
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
6
by: Sean | last post by:
HI There, I am making the transition from asp to asp .net, I am currenty writing an application that requires a bulk insert from a webform into SQL server, normally I would just create rows of...
22
by: Tim | last post by:
Hi A while ago I got some help in writing a mock console. The idea was to write a VB app that contained a textbox, then run a process from within the app and redirect the stdout to the textbox. ...
1
by: sumanroyc | last post by:
Hi, We are trying to insert into a remote database using the forall statement 5000 rows at a time. type t_column_id is table of number index by binary_integer; v_column_id t_column_id; begin...
1
by: devmiral | last post by:
Hello every one I trying simple bulk collect , it is giving me an error in oracle 9i, i wroe as per book and on the web deatils about bulk collect declare type emp_type is table of emp%rowtype;...
0
debasisdas
by: debasisdas | last post by:
We can fetch from a cursor into one or more collections: DECLARE TYPE NameList IS TABLE OF employees.last_name%TYPE; TYPE SalList IS TABLE OF employees.salary%TYPE; CURSOR c1 IS SELECT...
2
by: pravatjena | last post by:
can someone explain clearly what is bulk collect and for all..........
3
by: oravm | last post by:
Hi, I re-write a query and used bulk collect to improve the performance of the batch process. The query below has NO compile error but when execute query there is error 'ORA-01403: no data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.