Hi again,

If it might be interesting for someone, the answer to my first question proved to be the following:

this part of code

...
l_query:= l_query||
','||'max (DECODE (source,’’’|| x.source ||’’’, MIDPX ,null)) "'|| x. source ||' " ’;
...


should have been ammended (',' added in the very beginning:
So it worked fine.

Here comes my second question.I tried to 'complicate' the matter:

1: CREATE OR REPLACE PACKAGE BODY ChartNameHistoryBySource
2: AS
3: PROCEDURE ChartNameHistoryBySource ,
4: (
5: p_StoreDateStart IN DATE
6: p_StoreDateEnd IN DATE
7: p_CompanyName IN VarChar2
8: p_Maturity IN Integer
9: ChartOutput IN OUT ReturnCursor
10: )
11:
12: IS
13: l_query long := 'SELECT storedate ';
14:
15: BEGIN
16: FOR x IN (SELECT DISTINCT source FROM tbltestsources)
17:
18:
19:
33:
34:
35:
36: LOOP
37: l_query:= l_query||
38: ','||'max (DECODE (source,’’’|| x.source ||’’’, MIDPX ,null)) "'|| x. source ||' " ’;
39: END LOOP;
40:
41:
42:
43:
44: l_query :=rtrim(l_query, ',') ||
45: ' FROM tblcdsbysource cds
46: , Itblcds cd
47: , tblnames n
48: , tblsources srs
49:
I50: WHERE
51: cds.PROTECTIONID=cd.PROTECTIONID
52: AND cds.SOURCEID=srs.SOURCEID
53: AND cd.NAMEID=n.NAMEID
54: AND STOREDATE >= : p_StoreDateStart AND STOREDATE <= : p_StoreDateEnd
55: AND CONAME= : p_CompanyName
56: AND MATURITY= : p_Maturity
57: GROUP BY storedate';
58: OPEN ChartOutput FOR l_query;
59:
60: END;
61: END;
62: /


and now I receive an error saying:
ORA-00600 internal error code, arguments [15212],[4],[],[],[],[],[]....


Guys, do I miss something major here?
Again would appreciate your input.

Regards,
Shurik12.