Hi,
it is probably overflow of the Comp_list variable.
Try to declare it longer than 1000 chars.
BTW, for better performance you should avoid testing "IF n=Comp_Counter THEN ... ".
You can add the comma in each loop and after closing the cursor just trim the last one:
Comp_list := rtrim(Comp_list,',');
I have implemented ur second suggestion...but sorry to say that the problem still persists although I have increased the size of Comp_list to VARCHAR2(3000)
I don't think that the string that i need to generate like 123,234,235,235 will ever be of such a huge magnitude...
There can be at max 50 comma seperated components each of max 3 digit making it 50*3+50 chars long at most...
At last was able to get rid of the error....
After a good checking found that there was indeed a buffer overflow and some infinite loops in my procedure.
Thanks for the help.
One more problem that I am getting is ORA-01722
The situation is like this.
I have got Comp_list as 123,456,789,12
and Comp_list is VARCHAR2(1000).
Now I have a query like
SELECT DISTINCT CATEGORYNAME FROM BCOMP_MAP WHERE BCNAME_ID IN (Comp_List);
In Bcomp_map table we have Categoryname as VARCHAR2(60) and BCNAME_ID as NUMBER(10)
So in the select query we have a type mismatch.
I thought of overcoming this using TO_NUMBER but didnt work..
Do u have any idea on how to overcome such a situation??
Well, this is a job for dynamic sql.
In 8i I'd do that in this way:
Code:
--declare cursor variable:
type type_cc is ref cursor;
my_cursor type_cc;
...
begin
...
open my_cursor for
'SELECT DISTINCT CATEGORYNAME FROM BCOMP_MAP WHERE BCNAME_ID IN ('||Comp_list||')';
Then you can go through the cursor with FETCH statement ...
1. How to resolve ORA-06502
2. Should not use IF ELSE in loop...this causes performance loss
3. Dynamic sql solved my ORA-01722 ...this doesn't work in Oracle 7.3.4....luckily I had 8i server arround...so was able to figure it out.
4. Good amount of PL/SQL.
Vijayr,
Thanks for pointing out my mistake...I got rid of all infinite loops
Thanks again.
oops..
just to let u know....my procedure is working fine now...
This I had to device because sombody deleted all entries in a particular important table and there was no backup of the table...
So I had to recreate this table with all previous data...fetching from various different existing tables
Bookmarks