Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Character Limit passing from PL/SQL to HTML with htp.prn, WHY?

675865Jan 22 2009 — edited Apr 24 2009
I am trying to pass many rows (each with several fields) from the database to an ajax request.
I then get the content i show it in the page using javascript.
The problem is, i don't know why but after a certain number of characters the result is truncated.

Here's an example of the PL/SQL code portion:

-------------------------------------------------CODE-----------------------------------------------------
for k in 1..arr_fields.count loop
DBMS_SQL.COLUMN_VALUE(c1, k, arr_values(k));
htp.prn(arr_values(k));
--lista := lista || arr_values(k) || ' ';
if counter > 5000 then
htp.prn('~ENDING LIMIT~






');
counter :=1;
exit;
end if;
counter := counter+1;
end loop;
htp.prn('~r~
');

-------------------------------------------------CODE-----------------------------------------------------


Here's an example of the Javascript code portion:

-------------------------------------------------CODE-----------------------------------------------------
function teste_function()
{
var axustring="";

var ajaxRequest = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=TESTELISTAGEM',0);
ajaxRequest.add('P1002_MAP_COD',"empty");
ajaxResult = ajaxRequest.get();
if(ajaxResult)
{
document.getElementById('teste_listagem').innerHTML =ajaxResult;
}
else
{
alert("erro");
}
}
-------------------------------------------------CODE-----------------------------------------------------














PS: Initially i had the code like this (the commented was not commented)

-------------------------------------------------CODE-----------------------------------------------------
LOOP
IF DBMS_SQL.FETCH_ROWS(c1)>0 THEN
-- get column values of the row
--htp.prn('VALOR-'||DBMS_SQL.LAST_ROW_COUNT);
if length(lista) > 20000 then
-- arr_aux.EXTEND;
-- arr_aux(arr_aux.last):=lista;
lista:='';
-- counter := counter+1;
else
for k in 1..arr_fields.count loop
DBMS_SQL.COLUMN_VALUE(c1, k, arr_values(k));
htp.prn(arr_values(k));
--lista := lista || arr_values(k) || ' ';
if counter > 5000 then
htp.prn('~ENDING LIMIT~






');
counter :=1;
exit;
end if;
counter := counter+1;
end loop;
htp.prn('~r~
');
end if;
ELSE
-- No more rows to copy:
EXIT;
END IF;
END LOOP;
-------------------------------------------------CODE-----------------------------------------------------

Meaning that i would have a variable and would keep adding rows to it until it was greater than 20000 chars (to make sure the limit of 32000 wasn t reached),
but this still would get the result truncated.

I have made many tests and found out that i can do any number of htp.prn and that i can write in the html div all the chars (did it manually by hand).
If i send few rows the end doesn t get truncated...
THe content gets truncated with 9000 chars and with 356 000 chars... (I got those into the html page using diferent values for the length(lista) > 20000, if i put like 10000 i get less chars but still truncates )
So the problem has to be something to do with the ajax request, but i can't seem so find it...

Any idea what the problem is?


Thanks right away for any help.


My Homepage

Edited by: Igor Carrasco on Apr 24, 2009 1:17 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2009
Added on Jan 22 2009
2 comments
1,197 views