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 found.' -
CREATE OR REPLACE PROCEDURE PROCESS_ANGKASA(REF_NO varchar2)is
-
v_cntr_code varchar2(16);
-
v_receipt_code varchar2(3);
-
start_time number;
-
end_time number;
-
receipt_date date;
-
receipt_no varchar2(50);
-
c_receipt_no varchar2(30);
-
-
--JOIN IN CURSOR
-
/* cursor cur_angkasa(ref_no varchar2) is
-
select p.c_client_code, p.n_seq_no, x_employer_no, p.x_employee_no,
-
p.x_receipt_code, p.a_amt_recd, p.x_deduction_month,p.x_nric_old,a.angkasa_ic,a.type
-
into l_angkasa
-
from pp_angkasa_receipt_dets p
-
JOIN angkasa a
-
on p.c_client_code = a.angkasa_ic
-
--where c_angkasa_ref_no = ref_no
-
where c_angkasa_ref_no = 'BP22868'
-
and p.n_seq_no = a.sequence_no; */
-
-
cursor cur_angkasa(ref_no varchar2) is
-
select c_client_code, n_seq_no, x_employer_no, x_employee_no,
-
x_receipt_code, a_amt_recd, x_deduction_month,x_nric_old
-
from pp_angkasa_receipt_dets
-
where c_angkasa_ref_no = 'BP22868';
-
-
TYPE cur_angkasa_type IS TABLE OF cur_angkasa%ROWTYPE;
-
rec1 cur_angkasa_type;
-
recl cur_angkasa%ROWTYPE;
-
-
Begin
-
-
receipt_date := sysdate;
-
receipt_no :='HQ1234';
-
-
Open cur_angkasa(ref_no);
-
DBMS_OUTPUT.PUT_LINE('TESTING BULK COLLECT');
-
Fetch cur_angkasa bulk collect into rec1 limit 100;
-
For i in 1..rec1.count
-
loop
-
Dbms_output.put_line('In the Loop');
-
Dbms_output.put_line (recl.c_client_code); -- no data
-
select c_cntr_code,type--error line51
-
into v_cntr_code, v_receipt_code
-
from angkasa
-
where angkasa_ic = recl.c_client_code
-
and sequence_no = recl.n_seq_no;
-
-
Exit when cur_angkasa%notfound;
-
Dbms_output.put_line ('End of the Loop');
-
-
if nvl(recl.a_amt_recd,0) <> 0 then
-
insert into receipt_info_all(c_cntr_code,c_receipt_no,d_receipt_date,a_receipt_amt,x_receipt_type,x_lastupd_user,x_lastupd_prog,x_lastupd_inftim)
-
values (v_cntr_code,receipt_no,receipt_date,recl.a_amt_recd,v_receipt_code,user,'PREM_PROC',to_char(get_control_date,'dd/mm/rr hh24:mi:ss'));
-
end if;
-
-
end loop;
-
end;
-
/*---------RESULTS--------- */
14:00:05 SQL> exec PROCESS_ANGKASA('BP22868');
TESTING BULK COLLECT
In the Loop
begin PROCESS_ANGKASA('BP22868'); end;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "PRODUCTION.PROCESS_ANGKASA", line 51
ORA-06512: at line 1
real: 94
14:00:06 SQL>
*END ---------ERROR --------- */
Please guide me to resolve the above problem.
Thanks & Regards,
3 3624 Saii 145
Recognized Expert New Member
handle the error using exception block.
Thanks Saii,
Added exception .. Below is the changes. -
-
Begin
-
Open cur_angkasa(ref_no);
-
Loop
-
Fetch cur_angkasa BULK COLLECT into rec1 limit 100;
-
For i in 1..rec1.count
-
Loop
-
SELECT c_cntr_code,TYPE
-
INTO v_cntr_code, v_receipt_code
-
FROM angkasa
-
WHERE angkasa_ic = rec1.c_client_code
-
AND sequence_no = rec1.n_seq_no;
-
-
IF NVL(recl.a_amt_recd,0) <> 0 Then
-
INSERT INTO receipt_info_all(c_cntr_code,c_receipt_no,d_receip t_date,a_receipt_amt,x_receipt_type,x_lastupd_user ,x_lastupd_prog,x_lastupd_inftim)
-
VALUES (v_cntr_code,receipt_no,receipt_date,rec1.a_amt_re cd,v_receipt_code,USER,'PREM_PROC',TO_CHAR(get_con trol_date,'dd/mm/rr hh24:mi:ss'));
-
END IF;
-
End Loop;
-
EXIT WHEN cur_angkasa%notfound;
-
END LOOP;
-
exception
-
WHEN OTHERS THEN
-
dbms_output.put_line(SQLCODE || SQLERRM);
-
END;
-
-
regards,
Vijaya
Oravm,
Please remember to use [code] tags when ever you post any source code in forum.
For more details on code tags, check here Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Diego |
last post by:
HI, I'm trying yo improve the performance of the following piece of
code.
Here I'm archiving Items that are done processing to Archive Tables.
I believe that if I use BULK INSERTS/SELECTS/UPDATES...
|
by: gizmo |
last post by:
I have a stored procedure that queries a database using a Select
statement with some inner joins and conditions. With over 9 million
records it takes 1 min 36 sec to complete. This is too slow...
|
by: adi |
last post by:
Hi all,
Hope there is a quick fix for this:
I am inserting data from one table to another on the same DB. The
insert is pretty simple as in:
insert into datatable(field1, field2, field3)...
|
by: Pioneer |
last post by:
HI,
We are using BI software on Datawarehouse for reporting purpose.
In that we had some performance realted issues. So the only solution to
that was cerating indexes as per the requirements....
|
by: Nadav |
last post by:
Hi,
I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
| |
by: maxzsim via SQLMonster.com |
last post by:
Hi,
I am using MS Access as the front end and it's using ODBC link to connect
to the backend tables residing at SQL SERVER.
I have some queries that are doing some calculation and the time...
|
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;...
|
by: keerthyragavendran |
last post by:
hi
i'm downloading a single file using multiple threads...
how can i specify a particular range of bytes alone from a single
large file... for example say if i need only bytes ranging from...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |