DBMS_LOB.READ + ORA-06502
Hello,
I have the following function to convert a CLOB to a BLOB.
function Clob_2_Blob (I_CLOB IN CLOB)
return blob
is
v_rst BLOB := empty_blob();
v_clob_length BINARY_INTEGER;
v_blob BLOB := empty_blob();
-- Param pour lire le CLOB.
v_buffer VARCHAR2(32767);
v_amount BINARY_INTEGER := 32767;
v_position INTEGER := 1;
BEGIN
dbms_lob.createtemporary(v_rst,TRUE);
v_clob_length := DBMS_LOB.GETLENGTH(I_CLOB);
LOOP
EXIT WHEN v_position > v_clob_length;
dbms_lob.READ (I_CLOB, v_amount, v_position, v_buffer);
v_blob := utl_raw.cast_to_raw(v_buffer);
dbms_lob.append(v_rst,v_blob);
v_position := v_position + v_amount;
END LOOP;
return v_rst;
end Clob_2_Blob;
When I use it, I get a ORA-06502 exception.
If I change v_amount as follow
v_amount BINARY_INTEGER := 32766;
then I don't get any exception.
I don't understand this because in theory, I can get up to 32767.
What's wrong ?
Hi Peter,
It worked after i split the v_read_count to half. It means
v_read_cnt := 16383;The issue is when reading a character from the database it can get 'expanded' into two bytes. The chunk buffer can hold 32767 characters so if you read 16383 multi-byte characters from the database, it takes up twice the room (the 32766, one left over from rounding).
Thanks
Similar Messages
-
Got error ORA-06502 when creating a report page
Hi,
I got ORA-06502 error message when trying to create a report page using one particular query (see below). It happened in the 'SQL Query' step. After put query in the text box and click on 'Next' button, the error message read
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Exactly same query running in sqlplus session against same database and same schema can run thru fine.
I wonder if anybody can give me a pointer what could be wrong with the query, and how to debug.
The query is
WITH o AS
SELECT a.manager, m.owner
FROM man_hierarchy_v m,
SELECT owner manager
FROM man_hierarchy_v
WHERE manager_ladder LIKE '%-CROZWAT-%'
AND olevel =
(SELECT olevel + 1 FROM man_hierarchy_v WHERE owner = 'CROZWAT')
ORDER BY owner
) a
WHERE manager_ladder LIKE '%-' || a.manager || '-%'
SELECT manager,
code, TO_CHAR(code/total*100, '999.9') code_perc,
code_symptoms, TO_CHAR(code_symptoms/num_symptoms*100, '999.9') code_sym_perc,
env, TO_CHAR(env/total*100, '999.9') env_perc,
env_symptoms, TO_CHAR(env_symptoms/num_symptoms*100, '999.9') env_sym_perc,
test, TO_CHAR(test/total*100, '999.9') test_perc,
test_symptoms, TO_CHAR(test_symptoms/num_symptoms*100, '999.9') test_sym_perc,
tbd, TO_CHAR(tbd/total*100, '999.9') tbd_perc,
tbd_symptoms, TO_CHAR(tbd_symptoms/num_symptoms*100, '999.9') tbd_sym_perc,
cnd, TO_CHAR(cnd/total*100, '999.9') cnd_perc,
cnd_symptoms, TO_CHAR(cnd_symptoms/num_symptoms*100, '999.9') cnd_sym_perc,
latent, TO_CHAR(latent/total*100, '999.9') latent_perc,
latent_symptoms, TO_CHAR(latent_symptoms/num_symptoms*100, '999.9') latent_sym_perc,
behavior, TO_CHAR(behavior/total*100, '999.9') behavior_perc,
behavior_symptoms, TO_CHAR(behavior_symptoms/num_symptoms*100, '999.9') behavior_sym_perc,
dep_labels, TO_CHAR(dep_labels/total*100, '999.9') dep_labels_perc,
dep_labels_symptoms, TO_CHAR(dep_labels_symptoms/num_symptoms*100, '999.9') dep_labels_sym_perc,
total, num_symptoms
FROM
SELECT manager, SUM(code) code, SUM(code_symptoms) code_symptoms,
SUM(cnd) cnd, SUM(cnd_symptoms) cnd_symptoms,
SUM(env) env, SUM(env_symptoms) env_symptoms,
SUM(behavior) behavior, SUM(behavior_symptoms) behavior_symptoms,
SUM(latent) latent, SUM(latent_symptoms) latent_symptoms,
SUM(dep_labels) dep_labels, SUM(dep_labels_symptoms) dep_labels_symptoms,
SUM(test) test, SUM(test_symptoms) test_symptoms,
SUM(tbd) tbd, SUM(tbd_symptoms) tbd_symptoms,
COUNT(probid) total,
SUM(num_symptoms) num_symptoms
FROM
SELECT o.manager, p.probid, NVL(num_symptoms, 0) num_symptoms,
DECODE(type, 'C', 1, 0) code,
CASE WHEN type = 'C' THEN num_symptoms ELSE 0 END code_symptoms,
DECODE(type, 'CND', 1, 0) cnd,
CASE WHEN type = 'CND' THEN num_symptoms ELSE 0 END cnd_symptoms,
DECODE(type, 'E', 1, 0) env,
CASE WHEN type = 'E' THEN num_symptoms ELSE 0 END env_symptoms,
DECODE(type, 'L', 1, 0) behavior,
CASE WHEN type = 'L' THEN num_symptoms ELSE 0 END behavior_symptoms,
DECODE(type, 'LATENT', 1, 0) latent,
CASE WHEN type = 'LATENT' THEN num_symptoms ELSE 0 END latent_symptoms,
DECODE(type, 'O', 1, 0) dep_labels,
CASE WHEN type = 'O' THEN num_symptoms ELSE 0 END dep_labels_symptoms,
DECODE(type, 'T', 1, 0) test,
CASE WHEN type = 'T' THEN num_symptoms ELSE 0 END test_symptoms,
DECODE(type, 'TBD', 1, 0) tbd,
CASE WHEN type = 'TBD' THEN num_symptoms ELSE 0 END tbd_symptoms
FROM lrg_problem_v3 p, o
WHERE p.assigned = o.owner
AND p.cdate BETWEEN '16-DEC-08' AND '15-JAN-09'
AND last_label LIKE 'RDBMS_MAIN_LINUX' || '_%'
AND lrg LIKE 'lrg' || '%'
GROUP BY manager
ORDER BY manager
I tried to remove all the TO_CHAR functions but same error message was returned.
Thanks,
MingyingThis version of Apex comes with database release 11.1.0.6.0
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
Following information might also be helpful.
Product Build: 3.1.0.00.32
Schema Compatibility: 2007.09.06
NLS_CHARACTERSET: AL32UTF8
DAD CHARACTERSET: UTF-8
JOB_QUEUE_PROCESSES: 1000
Thanks,
Mingying -
Dbms_lob.substr is failing with ORA-06502
The following query is throwing error while doing minus with dbms_lob.substr although 4000
characters are being selected. Column billing_inventory is of CLOB. Please advice.
SQL> select count(1) from llums_feed;
724754
SQL> select count(1) from llums_feed_prv;
0
SQL> SELECT
asset_id,dbms_lob.substr(billing_inventory,4000,1),dbms_lob.substr(billing_inventory,8000,4001)
FROM llums_feed
minus
select asset_id, dbms_lob.substr(billing_inventory,4000,1)
,dbms_lob.substr(billing_inventory,8000,4001)
from llums_feed_prv;
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1Hello
You are selecting 8000 characters from position 4001, not 4000 characters from position 4001....
FUNCTION substr(lob_loc IN BLOB,
amount IN INTEGER := 32767,
offset IN INTEGER := 1)dbms_lob.substr(billing_inventory,4000,1),dbms_lob.substr(billing_inventory,8000,4001)
You need to modify the 2nd substr in each select statement to be
dbms_lob.substr(billing_inventory,4000,1),dbms_lob.substr(billing_inventory,4001,4000)
HTH
David
Edited by: David Tyler on Jun 27, 2011 1:16 PM -
XML publisher report using dbms_xmlgen (ORA-06502)
Dear All,
I have written the below code to generate xml output in Oracle Apps. The code is working fine for less records. But when CLOB size is more than 32k, then
it giving the ORA-06502 error as fnd_file.put_line(fnd_file.output,v_result) can only write 32k at a time.
Can anyone let me know how to handle this? Any help on this would be highly appreciated.
PROCEDURE MAIN ( errbuf OUT VARCHAR2
,retcode OUT NUMBER
) IS
TYPE g_query_ref IS REF CURSOR;
v_query_ref g_query_ref;
v_handle dbms_xmlgen.ctxhandle;
v_result clob;
BEGIN
OPEN v_query_ref FOR
SELECT invoice_num,
description,
customer_no,
customer_name
FROM XX_INVOICE_DETAILS;
v_handle := dbms_xmlgen.newContext(v_query_ref);
DBMS_XMLGEN.SETROWTAG (v_handle , 'INVOICE');
v_result := dbms_xmlgen.getXML(v_handle);
fnd_file.put_line(fnd_file.output,v_result);
EXCEPTION
when others then
errbuf := sqlerrm;
retcode := sqlcode;
fnd_file.put_line(fnd_file.log,’sqlerrm ‘||sqlerrm);
END MAIN;
Thanks in Advance.
Regards,
AstikWhat you need to do is to chop your CLOB up into smaller strings, something like:
l_size := DBMS_LOB.getlength (l_clob);
IF (NVL (l_size, 0) = 0) THEN
raise_application_error (-20001, 'CLOB is NULL');
END IF;
l_offset := 1;
-- Loop
WHILE (l_offset <= l_size) LOOP
l_char := DBMS_LOB.SUBSTR (l_clob,1,l_offset);
IF (l_char = CHR (10)) THEN
FND_FILE.NEW_LINE(FND_FILE.output, 1);
ELSE
FND_FILE.PUT(FND_FILE.output, l_char);
END IF;
-- Increment Offset.
l_offset:= l_offset+1;
END LOOP;
FND_FILE.NEW_LINE(fnd_file.output, 1); -
I'm attempting to dynamically generate a rather large SQL query via the "PL/SQL function body returning SQL query" report region option. The SQL query generated will possibly be over 32K. When I execute my page, I sometimes receive the "ORA-06502: PL/SQL: numeric or value error" which points to a larger than 32K query that was generated. I've seen other posts in the forum related to this dynamic SQL size limitation issue, but they are older (pre-2010) and point to the 32K limit of the DNS (EXECUTE IMMEDIATE) and DBMS_SQL. I found this post (dynamic sql enhancements in 11g) which discusses 11g no longer having the 32K size limitation for generating dynamic SQL. Our environment is on 11gR2 and using ApEx 4.2.1. I do not know which dynamic SQL method -- DNS or DBMS_SQL -- ApEx 4.2.1 is using. Can someone clarify for me which dynamic SQL method ApEx uses to implement the "PL/SQL function body returning SQL query" option?
As a test, I created a page on apex.oracle.com with a report region with the following source:
declare
l_stub varchar2(25) := 'select * from sys.dual ';
l_sql clob := l_stub || 'union all ';
br number(3) := 33;
begin
while length ( l_sql ) < 34000 loop
l_sql := l_sql || l_stub || 'union all ';
end loop;
l_sql := l_sql || l_stub;
for i in 1 .. ceil ( length ( l_sql ) / br ) loop
dbms_output.put_line ( dbms_lob.substr ( l_sql, br, ( ( i - 1 ) * br ) + 1 ) );
end loop;
return l_sql;
end;
The dbms_output section is there to be able to run this code in SQL*Plus and confirm the size of the SQL is indeed larger than 32K. When running this in SQL*Plus, the procedure is successful and produces a proper SQL statement which can be executed. When I put this into the report region on apex.oracle.com, I get the ORA-06502 error.
I can certainly implement a work-around for my issue by creating a 'Before Header' process on the page which populates an ApEx collection with the data I am returning and then the report can simply select from the collection, but according to documentation, the above 32K limitation should be resolved in 11g. Thoughts?
Shane.What setting do you use in your report properties - especially in Type and in Region Source?
If you have Type="SQL Query", then you should have a SELECT statement in the Region Source. Something like: SELECT .... FROM ... WHERE
According to the ERR-1101 error message, you have probably set Type to "SQL Query (PL/SQL function body returning SQL query)". In this situation APEX expects you to write a body of a PL/SQL function, that will generate the text of a SQL query that APEX should run. So it can be something like:
declare
mycond varchar2(4000);
begin
if :P1_REPORT_SEARCH is not null THEN
mycond:='WHERE LAST_NAME like :P1_REPORT_SEARCH ||''%''';
end if;
return 'select EMPLOYEE_ID, FIRST_NAME, LAST_NAME from EMPLOYEES ' ||mycond;
end;
And for escaping - are you interested in escaping the LIKE wildcards, or the quotes?
For escaping the wildcards in LIKE function so that when the user enters % you will find a record with % and not all functions, look into the SQL Reference:
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm
(You would than need to change the code of your function accordingly).
If you are interested in escaping the quotes, try to avoid concatenating the values entered by the user into the SQL. If you can, use bind variables instead - as I have in my example above. If you start concatenating the values into the text of SQL, you are open to SQLInjection - user can enter anything, even things that will break your SQL. If you really need to allow users to choose the operator, I would probably give them a separate combo for operators and a textfield for values, than you could check if the operator is one of the allowed ones and create the condition accordingly - and than still use bind variable for inserting the filtering value into the query. -
Using DBMS_LOB.COPY - (ORA-22275)
Hi All,
I need to copy BLOB value from one table to another.
For that i am using DBMS_LOB.COPY.
I am not sure if this is the right approach. If not, can someone help me out.
Mentioned below is my sample procedure:
CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
i_ID number,
o_OutputStatus OUT NUMBER,
o_OutputMessage OUT VARCHAR2
as
v_blob_data_d blob;
v_blob_data_s blob;
amt INTEGER := 4000;
begin
select BLOB_DATA
into v_blob_data_d
from blob_test_dest -- My Destination Table
where id = i_ID
for update;
select BLOB_DATA
into v_blob_data_s
from blob_test -- My Source Table
where id = i_ID;
DBMS_LOB.COPY(v_blob_data_d, v_blob_data_s, amt);
o_OutputStatus := 0;
o_OutputMessage := 'SUCCESS';
EXCEPTION
WHEN OTHERS THEN
o_OutputStatus := -1;
o_OutputMessage := 'Procedure ins_upd_blob Failed at step no:- '||v_ErrorFlag|| ' SQL ERROR:- '||SUBSTR(SQLERRM,1,100);
END;
After execution i am getting following error:
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
Thanks,
Srikanthhow about using merge instead of dbms_lob package?
CREATE OR REPLACE PROCEDURE INS_UPD_BLOB
i_ID number,
o_OutputStatus OUT NUMBER,
o_OutputMessage OUT VARCHAR2)
as
v_blob_data_d blob;
v_blob_data_s blob;
amt INTEGER := 4000;
begin
merge into blob_test_dest b1
using (select id, blob_data from blob_test) b2
on (b1.id = i_id and b1.id = b2.id)
when not matched then insert(b1.id, b1.blob_data) values(b2.id,b2.blob_data)
when matched then update set b1.blob_data = b2.blob_data;
END;
/ -
ORA-06502: PL/SQL: numeric or value error
HI All,
I am facing the following issue and looking forward for help to find the cause.
We are converting PDF documents in our repository to HTML using Oracle API
ctx_doc.ifilter (v_datablob, v_dataclob);
a highly simplified version of our code will be something like this..
1) Create table to store the BLOB(Binary PDF documents)
create table tbl_pdf_store(pdf_doc blob);
2) Insert a row and store a PDF.
3) Convert the PDF into HTML and store it in a CLOB object..
DECLARE
v_datablob BLOB;
v_dataclob CLOB;
BEGIN
--Create temporary clob objects
DBMS_LOB.createtemporary (v_dataclob, TRUE, DBMS_LOB.SESSION);
DBMS_LOB.createtemporary (v_datablob, TRUE, DBMS_LOB.SESSION);
--get the pdf to be converted from store table
SELECT pdf_doc
INTO v_datablob
FROM tbl_pdf_store
WHERE rownum < 1;
--convert the BLOB to HTML and store it in CLOB
ctx_doc.ifilter (v_datablob, v_dataclob);
exception
when others then
dbms_output.put_line(sqlerrm||' - '||sqlcode);
end;
Now the issue I am facing is, the above code works fine for few documents and for few others I get this cryptic error message
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "CTXSYS.DRUE", line 180
ORA-06512: at "CTXSYS.CTX_DOC", line 1142
ORA-06502: PL/SQL: numeric or value error - -6502
I cant reproduce the exact code here, but if anyone had faced the similar issue, then it would be great if they help me out.
thanks,
Prashant> Billy, its not just plain wrong its a sin :). "When
others" should itself be avoided if possible(it just
shows you don't know what error can occur). In the
actual code, we are using separate package to handle
and log errors. Here it was just for simplification I
added that putline code.
Phew.. You had me worried there... :-)
> I ran my procedure in debug mode and it throws this
exception when its executing the Oracle API
ctx_doc.ifilter
And there is very little you can do debugging that, as that source code is encoded (wrapped).
Which means that unfortunately you have to treat that code as a black box and investigate the bug with respects to:
a) the "environment" from which the call is made (ito of session settings, the sequence of calls made, etc)
b) the data and parameters passed
> this is not the case with all the PDFs..I was able to
convert more than 11 thousand documents without any
issues. I have this for only few hundred documents.
This would seem to point to a bug in Oracle's CTX conversion/filter code. Maybe those PDFs are a newer version and is not correctly supported. Maybe they're an older version that is not supported.
Which is why I said you need to isolate the error. Determine which PDFs are failing. Create a test harness (simplified code as you've posted) to perform a conversion (and nothing else).
Determine which PDFs fail and which works. Look at the differences between PDFs. E.g. can those problem PDFs be opened with different Acrobat Reader version - or do some of them fail?
> Another issue is I cannot view the content of the
these documents to check if anything is different :(.
You can with Acrobat Reader.. right?
> so no sure how to go from here...is there a
printstack method in Oracle 9i(similar to 10g I
guess) which can give me more information as I am
currently lost and not sure where to look.
Dumping the stack will not be of much help. In fact, the error message sequence you pasted already show the call sequence. And as these are in Oracle PL/SQL code, there is nothing really you can do about it.
My suggestion is to
a) isolate the error
b) consult the manual(s) to ensure that the Oracle PL/SQL s/w is used correctly
c) determine if this is data related (e.g. different PDF versions for example)
d) log a SR (Service Request) with Oracle Support
The more you can do ito of (a) - (c), the better the chance for finding the root cause, and the quicker resolution when you have no choice but to do (d). -
I'm trying to write this out in chunks to a file, but I keep getting the following error;
ORA-06502: PL/SQL: numeric or value error: hex to raw conversion error
Not sure what is going on with this error. Never used RAW before and the error is at; dbms_lob.read(vxml,bytelen,vstart,my_vr);
I'm I missing anything in this code? Sorry for the long code, but was not sure if I could post it or not. Thanks!
CLOB is about 85m
vxml cLOB;
vstart NUMBER := 1;
bytelen NUMBER := 32000;
lenxml number;
my_vr RAW(32000);
l_output utl_file.file_type;
BEGIN
-- define output directory
l_output := utl_file.fopen('IO', p_month||'_'||p_day||'.wme','w', 32760);
vstart := 1;
bytelen := 32000;
-- get length of clob
SELECT dbms_lob.getlength(manual_cl)
INTO lenxml
FROM catalog
WHERE item_id = 3;
-- select clob into variable
SELECT manual_cl
INTO vxml
FROM catalog
WHERE item_id = 3;
vstart := 1;
WHILE vstart < lenxml and bytelen > 0
LOOP
>> dbms_lob.read(vxml,bytelen,vstart,my_vr); <<line producing error >>
utl_file.put(l_output,my_vr);
-- set the start position for the next cut
vstart := vstart + bytelen;
lenxml := lenxml - bytelen;
IF lenxml < 32000 THEN
bytelen := lenxml;
END IF;
end loop;
utl_file.fclose(l_output);
end;At the first look you are confusing dbms_lob.read procedures, which are overloaded with respect to different data types of parameter. It seems, you don't need raw variable at all, as you read a clob and write a character data into your file - simply change a data type of my_vr variable to varchar2(32000) - raw could be suitable if you would read a blob data and write it into binary file.
Best regards
Maxim -
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
I use the procedure to convert the documents if it is not already converted before using procedure as follows
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
doccount number;
errorcode number;
errormessage varchar2(200);
BEGIN -- executable part starts here
SELECT COUNT(document_id) INTO doccount FROM docviewhtml where document_id=docid;
--dbms_output.put_line(doccount);
if doccount=0 then
dbms_output.put_line('Document Not Found: Converting '||docid);
--If document is not found run document coversion routine
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);
COMMIT;
elsif doccount=1 then
--return;
dbms_output.put_line('Document Found');
--if document id found then return the document content
null;
else
--dbms_output.put_line('Error occured');
--need to deal with duplicate documents
null;
end if;
dbms_lob.freetemporary(mklob);
EXCEPTION
--rollback when an exception occurs
WHEN OTHERS THEN
errorcode:=SQLCODE;
errormessage:=SQLERRM;
dbms_output.put_line(sqlcode || ':' ||sqlerrm);
ROLLBACK;
LOGERROR(errorcode,errormessage);
END "HTMLOUTPUT";
i get the error when i convert large documents
"ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275"
what is wrong. please help!"ORA-06502: PL/SQL: numeric or value error: invalid
LOB locator specified: ORA-22275"
PROCEDURE "STARDOC"."HTMLOUTPUT" (
"DOCID" IN NUMBER) IS
mklob clob;
ctx_doc.filter('idxdocuments',docid, mklob,FALSE);
INSERT INTO docviewhtml(document_id, html) VALUES (docid, mklob);I think You forget to initialize variable mklob.
You can do it, assigning the empty_clob(). -
Appending 2 CLOBs- Facing ORA-06502
Hi All,
Am trying to append a CLOB variable to another CLOB variable.
Declare
l_dest CLOB := ' ';
l_src CLOB;
CURSOR C1 IS
<select cOLUMN_NAME1 FROM hz_parties>
Begin
FOR tmp_rec in C1
LOOP
Calls a procedure get_msg and outputs the data into l_src
CLOB variable
get_msg(tmp_rec.column_nam1,l_src);
DBMS_LOB.APPEND(l_dest,l_src);
END LOOP;
END;
The procedure is able to append the data to l_dest CLOB variable.But it is erroring out when the
size of the l_dest CLOB variable reaches to 26213.
Following error is thrown
Code - ORA-06502: PL/SQL: numeric or value error.
I have to put all the information fetched from the table into a CLOB variable. Finally i will be passing this CLOB variable to a API.
I have gone through all the info about the DBMS_LOB.append,but culdnt able to resolve it....?
If anyone has come across this situation.please let me know how to resolve it ??Exception is raised, when i call the DBMS_LOB.APPEND(l_dest,l_src);
If i filter out the select statement in the cursor say rownum < 70; It is successfully appending the details to the l_dest CLOB. But if there are records with more than 70, then it is erroring out.
get_msg(tmp_rec.column_nam1,l_src) is the procedure which just fetches the following
fnd_message.set_name ('XXAAA', 'XXAA_VALIDATION');
fnd_message.set_token ('source_info',pi_some_parameter);
l_src := fnd_message.get;
l_src := l_src||CHR(10)||CHR(10); -
Listener Error - character string buffer too small (ORA-06502)
I am running into a very strange problem with the APEX listener on seemingly random pages. I can hit every page in my application just fine, but as soon as I hit this specific one, Glassfish throws an HTTP 500 error. If I click Debug, the page seems to load fine with no indications of trouble, but as soon as I turn debug back off, it goes back to the HTTP 500 error. I don't see anything special about the page that makes this happen. It is pretty simple and has 4 regions. I have noticed that if I set any 1 of the 4 regions to "Never display", the page loads fine. It's like having all 4 of them enabled at once are causing some overload, even though it's actually a smaller amount of data than most of my other pages.
**Update: I just discovered this only happens if I'm logged into the workspace first and then try to run the page! If I log out of APEX and then hit the application as a normal user, page loads error-free. This is still an annoying problem, but at least it seems I have a decent workaround since regular users never see it.
After a couple days, I noticed the exact same problem on a second APEX application I'm using. Again, it is on some random page whereas all the other pages work fine.
Both applications and pages in question worked without issue in APEX 3.x. I am trying to get an APEX application up and running on the latest version.
I have tried both Glassfish server and simply downloading the latest listener (version 1.1.1) and running it in standalone mode. I get the problem both ways, which is why it seems it's a listener issue.
I have seen a few other threads of people having this problem, but I never did find anyone with a solution, and most of the posts stopped back in December.
Some details on my environment:
Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
APEX version: 4.0.2
Webserver: Glassfish 3.1
Here is the log entry from Glassfish when the HTTP 500 error displays as I try to load one of the bugged pages.
[#|2011-05-10T21:14:22.967-0500|INFO|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=111;_ThreadName=Thread-1;|MaxConnectionReuseCount=50000|#]
[#|2011-05-10T21:14:46.431-0500|SEVERE|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=112;_ThreadName=Thread-1;|
***********ERROR***********
init: # headers=46
declare nm owa.vc_arr := ?;
vl owa.vc_arr := ?;
begin
owa.init_cgi_env( ?, nm, vl );
htp.init; htp.HTBUF_LEN := 63;
? := sys_context('USERENV','SID');
end;
SID:1242
CALL:
begin
f(p=>?);
commit;
end;
BINDS
p:100:2:220529248574492::NOPAGE CALL:
declare
nlns number := 999999;
l_clob CLOB;
lines htp.htbuf_arr;
l_buff varchar2(32767);
l_clob_init boolean:= false;
l_file varchar2(5);
l_doc_info varchar2(1000);
begin
OWA.GET_PAGE(lines, nlns);
if (nlns > 1) then
for i in 1..nlns loop
if ( length(lines(i)) > 0 ) then
if ( ( lengthb(l_buff) + lengthb(lines(i))) > 32767) then
if (NOT l_clob_init) then
dbms_lob.createtemporary(l_clob, TRUE);
dbms_lob.open(l_clob, dbms_lob.lob_readwrite);
l_clob_init:=true;
end if;
dbms_lob.writeappend(l_clob,length(l_buff),l_buff);
l_buff := lines(i);
else
l_buff := l_buff || lines(i);
end if;
end if;
end loop;
end if;
if (l_clob_init) then
dbms_lob.writeappend(l_clob,length(l_buff),l_buff);
l_buff := '';
end if;
? := l_clob;
? := l_buff;
if (wpg_docload.is_file_download) then l_file:='TRUE'; wpg_docload.get_download_file(l_doc_info); else l_file := 'FALSE'; end if; ? := l_file;
? := l_doc_info;
end;
get_page FAILED:ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 33
Edited by: BrianB on May 11, 2011 7:50 AM
Edited by: BrianB on May 11, 2011 8:01 AMBrian,
this post is going to get a bit longer, so the summary comes first.
h6. Summary
1. I could reproduce the problem on my system using the APEX Listener in standalone mode.
2. I don't think the problem is content-related in the sense that you have any issue in your page or database contents.
3. I have a workaround for your problem.
h6. Error message
Having that error in my environment made me start to think. I not only disabled some item and got it work, but I could also add something to achieve this effect.
So I came to think, this really is somewhere deep down. The error message doesn't seem very helpful on first sight, but when starting to follow on what's happening there, things get clearer:
APEX generates pages dynamically, replacing substitution strings and other tokens to get the actual page definition. This has to be read by a requesting client. The use of VARCHAR2 as buffer introduces a limit of 32767 bytes, after which the contents is handled as CLOB instead.
h6. Analysis
Obviously, there are cases where the "estimation" fails. Of course, this is may only be relevant in rare cases, because:
1. If a page would exceed the maximum without some charset interpretation problem, the buffer would be switched to clob.
2. If a page stays small enough to stay below 32767 even with some characters that are acutally larger then expected, the buffer isn't busted.
To find out, if your could be one of these rare cases, I investigated the HTTP headers, focussing on X-DB-Content-length and made an odd observation.
Test case 1: "Go" button disabled, so the page runs fine with APEX Listener
1. It has *31968 bytes* when coming from APEX Listener with a Go button disabled.
2. It has *31938 bytes* according to the header set by EPG - for exactly the same page.
That makes a difference of 30 bytes for what is expected to be the same contents.
Test case 2: The button is enabled again
1. This causes the page load to crash in APEX Listener.
2. EPG transports *32341 bytes* according to that header.
So we are pretty close to the hard limit for the VARCHAR2 buffer.
For some reason, APEX Listener seems to cause a false calculation of the actual page size. Whether this is due to some charset problem or due to some other problem with response handling, I don't know. The 30 bytes difference may result from the odd header "X-ORACLE-IGNORE" with value "IGNORE, IGNORE, IGNORE, IGNORE" sent by the APEX Listener. This value has exactly 30 bytes in length, but this could be coincidence, as there are more differences in headers. If I add the size of all headers, we are even closer to the buffer limit and probably exceed it when some items need more bytes than expected.
This could even be as simple as a line break, as your page has about 424 lines when I disabled the button... Adding 1 byte per line to the 32341 bytes of the EPG, I get 32765 bytes. Now add that button (403 bytes difference on EPG) and you exceeed the limit. Reduce that value by the line count again and you are still below.
Could be coincidence as well, but makes me wonder.
h6. Workaround
To make sure that we were actually hitting that limit, I now introduce my suggestion for a workaround.
Test case 3: Add a hidden item
1. APEX Listener loads the page, stating the size to be *32876 bytes*
2. EPG sees 30 bytes less and transmits the header with *32846 bytes*
h6. Conclusion
I can't give you a real solution for that problem, nor do I have a definitive answer on what is the root cause for it. It seems, only one of the developers may find it. But I can offer you a workaround, which is to just add some hidden item to your page so it exceeds the limit for the VARCHAR2 buffer and gets handled as clob.
Note that this may occur outside the app builder as well. The app builder just renders some additional items when starting that page, so it has a different size from its productive representation. On the other hand, I may start counting the size of that additional page section - I wouldn't wonder if that results in a value around 400 bytes, and this is the forgotten part...
Unfortunately, if it actually is happening outside of the app builder, this workaround isn't very handy: Dynamic contents can't be calculated that easy all the time, so you may have cases where you just don't know in advance if you are close to the limit and have to add some item to exceed it or if you've already exceeded it or if you are far below, or close enough to actually hit it when adding just one byte...
-Udo -
Problem with error ORA-06502: PL/SQL: numeric or value error string
Hi,
I am running a loop to just spool output data using 'dbms_output.put_line' and I keep getting this error after a few records. I resorted it and it happen at a different interval. Could it have to do with the length of the item I am trying to spool? Thanks.
ORA-06502: PL/SQL: numeric or value error stringSD wrote:
Hi,
I am running a loop to just spool output data using 'dbms_output.put_line' and I keep getting this error after a few records. I resorted it and it happen at a different interval. Could it have to do with the length of the item I am trying to spool? Thanks.
ORA-06502: PL/SQL: numeric or value error stringyes, it is a data dependent error.
Handle: SD
Status Level: Newbie
Registered: Nov 21, 2001
Total Posts: 289
Total Questions: 189 (183 unresolved)
why do you waste time here when you rarely get your questions answered? -
ORA-06502: PL/SQL: numeric or value error: character string buffer too smal
Hi Guys I am getting error ORA-06502: PL/SQL: numeric or value error: character string buffer too small as it said i thought it would be issue with length of feild but i tried to change is nothihg work i am posing code here if any one can please help me on this
PROCEDURE REPORT
p_rpt_from_dt in varchar2,
p_rpt_to_dt in varchar2,
p_apvr_id in tc_wkr.tc_row_id%type default NULL,
p_rpt_type in varchar2 default NULL,
p_backto_pg in varchar2 default NULL
IS
v_rpt_from_dt date := var_to_date(p_rpt_from_dt);
v_rpt_to_dt date := var_to_date(p_rpt_to_dt);
v_time_str varchar2(15);
cursor period_cur
cp_from_dt date,
cp_to_dt date
is
select beg_dt, end_dt
from jmcs_wk_tprd
where beg_dt <= cp_to_dt -- report end date
and end_dt >= cp_from_dt -- report start date
BEGIN
if sys_security('tcsys', 'tc_reports') != 'GRANTED' then
apps_main.access_denied;
return;
end if;
if lg_debug_fl then
v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
else
v_time_str := tc_time(lg_sysdate);
end if;
/* get the time card time periods applicable to the report */
lga_tc_strt_dt := lga_null_date;
for recs in period_cur(v_rpt_from_dt, v_rpt_to_dt) loop
lga_tc_strt_dt(lga_tc_strt_dt.count+1) := recs.beg_dt;
lga_tc_end_dt(lga_tc_end_dt.count+1) := recs.end_dt;
end loop;
--if p_apvr_id is NULL then
if p_rpt_type != 'D' then
tc_reporting.reports_header
1,
'Time Card Status Report',
'for '||dd_mon_yyyy(v_rpt_from_dt)||' through '||dd_mon_yyyy(v_rpt_to_dt)||'<BR>'||
'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
NULL,
NULL,
NULL,
'javascript:window.close()', /* Backto */
'alert(''Reminder! Click on logo when you are ready to return to previous page'')'
end if;
if p_apvr_id is NULL then
sub_STATUS_BD_ALPHA (v_rpt_from_dt, v_rpt_to_dt, TRUE, p_rpt_type, p_apvr_id);
else
htp.p('<!-- Selected Approver ('||p_apvr_id||') -->');
sub_STATUS_BD_APVR (v_rpt_from_dt, v_rpt_to_dt, p_rpt_type, p_apvr_id);
end if;
htp.p('</body></html>');
EXCEPTION
WHEN OTHERS THEN
error_proc(SQLERRM, SQLCODE, owa_util.get_cgi_env('PATH_INFO'));
htp.p('Error Code is :'||SQLERRM);
END REPORT;
This package in trun call other procedure like below
PROCEDURE sub_STATUS_BD_ALPHA
p_rpt_from_dt in date,
p_rpt_to_dt in date,
p_display_hdr in boolean,
p_rpt_type in varchar2 default 'B',
p_apvr_id in tc_wkr.tc_row_id%type default NULL,
p_tcs_user_id in tc_wkr.tc_row_id%type default NULL
IS
v_time_str varchar2(15);
v_apvr_id tc_wkr.tc_row_id%type := 0;
v_a_user_id tc_wkr.tc_row_id%type; -- approver tcs_user_id
v_cnt integer := 0;
v_people_cnt integer := 0;
v_stat_cd varchar2(2000);
v_display_fl boolean := FALSE;
/*===========================================================================*/
cursor people_cur
cp_from_dt in date,
cp_to_dt in date
is
select
d_full_nm_lfm as name,
tc_row_id as tcs_user_id,
tcw_typ as pay_typ,
tcw_id as pay_id,
sys_strt_date as sys_strt_dt,
sys_end_dt
from tc_wkr
where sys_strt_date <= cp_to_dt
and nvl(sys_end_dt, cp_to_dt) >= cp_from_dt
order by upper(d_full_nm_lfm);
/* find the current or the most recent (if no current) approver */
cursor apvr_cur
cp_tcs_user_id in tc_wkr.tc_row_id%type
is
select
a.f_tc_apvr_id as fk_tcs_apvr_id,
w.d_full_nm_lfm as apvr_name,
w.tcw_typ as apvr_pay_typ,
w.tcw_id as apvr_pay_id,
a.strt_dt,
a.end_dt
from tc_wkr w, tc_ap_asmt a
where a.f_tc_wkr_id = cp_tcs_user_id
and w.tc_row_id = a.f_tc_apvr_id
order by a.strt_dt desc;
/* list of existing time cards UNION required time cards */
cursor tc_cur
cp_tcs_user_id in tc_wkr.tc_row_id%type, /* who's time cards */
cp_from_dt in date, /* report period from date */
cp_to_dt in date /* report period to date */
is
select
stat_cd,
strt_dt,
end_dt
from tc
where strt_dt <= cp_to_dt
and end_dt >= cp_from_dt
and fk_tc_wkrtcw_id = cp_tcs_user_id
UNION
select
'Required' as stat_cd,
beg_dt as strt_dt,
end_dt
from jmcs_wk_tprd
where beg_dt <= cp_to_dt
and end_dt >= cp_from_dt
and beg_dt not in (
select strt_dt
from tc
where strt_dt <= cp_to_dt
and end_dt >= cp_from_dt
and fk_tc_wkrtcw_id = cp_tcs_user_id
order by strt_dt;
BEGIN
if lg_debug_fl then
v_time_str := to_char(lg_sysdate, 'hh:mi:ss a.m.');
else
v_time_str := tc_time(lg_sysdate);
end if;
if p_apvr_id > 0 then
lga_report_out := lga_report_out_null;
v_apvr_id := p_apvr_id;
lga_apvr := lga_apvr_null;
select
d_full_nm_lfm,
tc_row_id,
tcw_id,
tcw_typ
into
lga_apvr(1).apvr_name,
lga_apvr(1).apvr_tcs_id,
lga_apvr(1).apvr_pay_id,
lga_apvr(1).apvr_pay_typ
from tc_wkr
where tc_row_id = v_apvr_id;
if lga_apvr(1).apvr_pay_typ != 'S' then
select decode(bend_empl_fl, 'Y', 'E', 'W')
into lga_apvr(1).apvr_pay_typ
from empl
where empl_id = lga_apvr(1).apvr_pay_id;
end if;
end if;
if p_display_hdr then
if lga_tc_strt_dt.count > 6 then /* more than 6 time periods (1 month) */
lga_width(1) := to_char(.15 * lg_page_width_standard);
lga_width(2) := to_char(.08 * lg_page_width_standard);
for i in 1..lga_tc_strt_dt.count loop
lga_width(lga_width.count+1) := to_char(.09 * lg_page_width_standard);
end loop;
lg_page_width_standard := to_number(lga_width(1)) + to_number(lga_width(2));
if nvl(p_apvr_id, 0) = 0 then
lg_page_width_standard := lg_page_width_standard * 2;
end if;
htp.p('<!-- page width = '||lg_page_width_standard||'-->');
for i in 3..lga_width.count loop
lg_page_width_standard := lg_page_width_standard + to_number(lga_width(i));
htp.p('<!-- page width = '||lg_page_width_standard||'-->');
end loop;
lg_page_width := to_char(lg_page_width_standard);
else
lga_width(1) := '15%';
lga_width(2) := '8%';
lga_width(3) := '9%';
lga_width(4) := '9%';
lga_width(5) := '9%';
lga_width(6) := '9%';
lga_width(7) := '9%';
lga_width(8) := '9%';
end if;
sub_DETAIL_PAGE_HD(p_apvr_id);
end if;
/* cursor loop */
for p in people_cur(p_rpt_from_dt, p_rpt_to_dt) loop
/* is/was this person assigned to the selected approver for the report period */
v_display_fl := FALSE;
if nvl(p_tcs_user_id, 0) > 0 then
if p_tcs_user_id = p.tcs_user_id then
htp.p('<br>Selected User');
v_display_fl := TRUE;
end if;
elsif nvl(p_apvr_id, 0) = 0 then
if nvl(p_apvr_id, 0) = 0 then
v_display_fl := TRUE;
elsif p_apvr_id > 0 or p_apvr_id = -1 then
v_display_fl := fct_ASSIGNED_APVR(p.tcs_user_id, p_apvr_id, p_rpt_from_dt, p_rpt_to_dt);
end if;
if v_display_fl then
v_people_cnt := v_people_cnt + 1;
lg_tcs_owner_info.USER_ID := p.tcs_user_id;
lg_tcs_owner_info.PAY_ID := p.pay_id;
lg_tcs_owner_info.PAY_TYPE := p.pay_typ;
lg_tcs_owner_info.SYS_STRT_DT := p.sys_strt_dt;
lg_tcs_owner_info.TERM_DT := p.sys_end_dt;
if p.pay_typ = 'S' then
begin
select wrk_hire_dt
into lg_tcs_owner_info.hire_dt
from subcntr
where sub_id = p.pay_id;
exception
when no_data_found then
tc_debug.html_message('subcntr.pay_id('||p.pay_id||')');
end;
else
select
wrk_hire_dt,
decode(bend_empl_fl, 'Y', 'E', 'W')
into
lg_tcs_owner_info.hire_dt,
lg_tcs_owner_info.pay_type
from empl
where empl_id = lg_tcs_owner_info.PAY_ID;
end if;
if lga_report_out.count = 0 then
lga_report_out(lga_report_out.count+1) := '<table border="1" cellpadding="3" width="'||lg_page_width||'">';
end if;
if mod(v_people_cnt,2) = 1 then
lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_odd_bgcolor||'">');
else
lga_report_out(lga_report_out.count+1) := ('<tr bgcolor="'||lg_even_bgcolor||'">');
end if;
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.name||'</font></td >');
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>'||p.pay_typ||'-'||lpad(p.pay_id,4,'0')||'</font></td >');
if nvl(p_apvr_id, 0) > 0 then /* Single Approver */
/* need approver ID for time card "status" */
lga_apvr := lga_apvr_null; /* clear the approver id array */
lga_apvr(1).apvr_tcs_id := p_apvr_id;
elsif nvl(p_apvr_id, 0) = 0 then /* ALL Approvers */
lga_apvr := lga_apvr_null; /* clear the approver id array */
v_cnt := 0;
for ap in apvr_cur (p.tcs_user_id) loop
if v_cnt = 0 then
/* most recent approver may not be the applicable approver */
v_cnt := 1;
lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
v_apvr_id := ap.fk_tcs_apvr_id;
if ap.apvr_pay_typ = 'S' then
lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
else
select decode(bend_empl_fl, 'Y', 'E', 'W')
into lga_apvr(1).apvr_pay_typ
from empl
where empl_id = lga_apvr(1).apvr_pay_id;
end if;
end if;
if ap.strt_dt <= p_rpt_to_dt and nvl(ap.end_dt, p_rpt_to_dt) >= p_rpt_from_dt then
/* approver record */
lg_tcs_owner_info.APVR_ID := ap.fk_tcs_apvr_id;
lg_tcs_owner_info.APVR_STRT_DT := ap.strt_dt;
lg_tcs_owner_info.APVR_END_DT := ap.end_dt;
don't enter same approver name multiple times
when same approver has been assigned more than once
Example: approver1, approver_2, approver_1 (change back to approver 1)
for i in 1..lga_apvr.count loop
v_apvr_id := ap.fk_tcs_apvr_id;
if lga_apvr(i).apvr_tcs_id = ap.fk_tcs_apvr_id then
/* don't add again */
v_apvr_id := NULL;
exit;
end if;
end loop;
if v_apvr_id is not NULL then
v_cnt := v_cnt + 1;
lga_apvr(v_cnt).apvr_name := ap.apvr_name; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_tcs_id := ap.fk_tcs_apvr_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_id := ap.apvr_pay_id; -- identify multiple approvers for the "status"
lga_apvr(v_cnt).apvr_pay_typ := ap.apvr_pay_typ; -- identify multiple approvers for the "status"
end if;
end if;
end loop;
/* list approver pay IDs */
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
if lga_apvr.count = 0 then
lga_report_out(lga_report_out.count+1) := 'Approver Unassigned';
else
for i in 1..lga_apvr.count loop
if i > 1 then
lga_report_out(lga_report_out.count+1) := '<br>';
end if;
lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_name);
end loop;
end if;
lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
if lga_apvr.count = 0 then
lga_report_out(lga_report_out.count+1) := 'N/A';
else
for i in 1..lga_apvr.count loop
if i > 1 then
lga_report_out(lga_report_out.count+1) := '<br>';
end if;
lga_report_out(lga_report_out.count+1) := (lga_apvr(i).apvr_pay_typ)||'-'||lpad(lga_apvr(i).apvr_pay_id,4,'0');
end loop;
end if;
lga_report_out(lga_report_out.count+1) := ('</font></td >');
end if;
for t in tc_cur(p.tcs_user_id, p_rpt_from_dt, p_rpt_to_dt) loop
htp.p('<! '||t.strt_dt||', '||t.end_dt||', '||t.stat_cd||' -->');
--lga_report_out(lga_report_out.count+1) := ('<td valign="top"><font size=-2>');
--lga_report_out(lga_report_out.count+1) := (t.stat_cd);
--lga_report_out(lga_report_out.count+1) := ('</font></td >');
/* has the selected approver has completed processing */
if p_apvr_id > 0
and v_apvr_id = p_apvr_id
and v_a_user_id != p_apvr_id
then
exit;
end if;
for ap in apvr_cur (p.tcs_user_id) loop
if apvr_cur%rowcount = 1 then
/* most recent approver assigned */
lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
end if;
if ap.strt_dt <= t.end_dt and nvl(ap.end_dt, t.end_dt) >= t.strt_dt then
/* approver assigned during time card period */
lg_tcs_owner_info.apvr_id := ap.fk_tcs_apvr_id;
exit;
end if;
end loop;
lg_tc_status.strt_dt := t.strt_dt;
lg_tc_status.end_dt := t.end_dt;
lg_tc_status.stat_cd := t.stat_cd;
v_stat_cd := fct_TC_STATUS(nvl(p_apvr_id, 0));
lga_report_out(lga_report_out.count+1) := ('<td align="center" valign="top" bgcolor="'||lg_tc_status.bg_color||'">');
lga_report_out(lga_report_out.count+1) := ('<font size=-2 color='||lg_tc_status.font_color||'>');
lga_report_out(lga_report_out.count+1) := v_stat_cd;
lga_report_out(lga_report_out.count+1) := ('</font></td >');
end loop;
lga_report_out(lga_report_out.count+1) := '</tr>';
end if; /* v_display_fl */
end loop;
if p_rpt_type in ('B', 'S') then
lg_page_cnt := lg_page_cnt + 1;
sub_DISPLAY_STATUS_SUMMARY;
end if;
if lga_report_out.count > 0 then
lga_report_out(lga_report_out.count+1) := '</table>';
end if;
if lga_report_out.count > 0 then
if p_rpt_type = 'B' or p_apvr_id > 0 then
if p_display_hdr then
if lg_page_cnt > 0 then
if p_apvr_id > 0 then /* selected individual approver */
htp.p('</table>');
end if;
htp.p('<br style="page-break-after:always">');
htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
htp.p('<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& -->');
end if;
lg_page_cnt := lg_page_cnt + 1;
tc_reporting.reports_header
1,
'Time Card Status Report',
'for '||dd_mon_yyyy(p_rpt_from_dt)||' through '||dd_mon_yyyy(p_rpt_to_dt)||'<BR>'||
'Report Date: '||dd_mon_yyyy(lg_sysdate)||' Time: '||v_time_str,
NULL,
NULL,
NULL,
NULL, -- p_backto_pg, /* Backto */
'focus()',
lg_page_cnt
end if;
end if;
if p_rpt_type in ('B', 'D') then
for i in 1..lga_report_out.count loop
htp.p(lga_report_out(i));
end loop;
end if;
end if;
END sub_STATUS_BD_ALPHA;
Some veriable
type report_tc_rec is record
tc_owner_name tc_wkr.d_full_nm_lfm%type,
o_user_id tc_wkr.tc_row_id%type,
o_pay_id varchar2(10),
o_sys_strt_dt date,
o_sys_end_dt date,
tc_apvr_name tc_wkr.d_full_nm_lfm%type,
a_pay_id varchar2(10),
a_user_id tc_wkr.tc_row_id%type,
tc_strt_dt date,
tc_end_dt date,
tc_stat_cd varchar2(50),
ap_strt_dt date,
ap_end_dt date
/* time card owner information */
TYPE tcs_owner_info_rec IS RECORD
USER_ID tc_wkr.tc_row_id%type,
PAY_ID tc_wkr.tcw_id%type,
PAY_TYPE tc_wkr.tcw_typ%type,
HIRE_DT date,
SYS_STRT_DT date,
TERM_DT date,
APVR_ID tc_wkr.tc_row_id%type,
APVR_STRT_DT date,
APVR_END_DT date
/* status code determines report cell font and background colors */
TYPE tc_status_rec IS RECORD
STRT_DT date,
END_DT date,
STAT_CD tc.stat_cd%type,
FONT_COLOR varchar2(16),
BG_COLOR varchar2(16)
/* count of all time card status for report summary */
TYPE tc_status_summary_rec IS RECORD
APPROVED_CNT integer := 0,
REJECTED_CNT integer := 0,
SUBMITTED_CNT integer := 0,
POSTED_CNT integer := 0,
VERIFIED_CNT integer := 0,
OPEN_CNT integer := 0,
NEW_CNT integer := 0,
REQUIRED_CNT integer := 0,
TOTAL_CNT integer := 0
/* determine multiple approvers for individual for selected report period */
TYPE apvr_rec IS RECORD
apvr_name tc_wkr.d_full_nm_lfm%type,
apvr_tcs_id tc_wkr.tc_row_id%type,
apvr_pay_id tc_wkr.tcw_id%type,
apvr_pay_typ tc_wkr.tcw_typ%type
TYPE apvr_id_array_table IS TABLE OF apvr_rec
index by binary_integer;
type output_array is table of varchar2(1000)
index by binary_integer;
type date_array is table of date
index by binary_integer;
type status_array is table of varchar2(1000)
index by binary_integer;
type apvr_array is table of number(8)
index by binary_integer;
lga_report_out output_array; /* array of HTML code to be output to browser */
lga_report_out_null output_array; /* null array of HTML code */
lga_tc_status status_array;
lga_null_status status_array;
lga_tc_strt_dt date_array;
lga_tc_end_dt date_array;
lga_tc_disp date_array; /* start dates of displayed TC for selected user */
lga_null_date date_array; /* null array used to clear other date arrays */
/* LOCAL GLOBAL VARIABLES */
lg_tcs_owner_info tcs_owner_info_rec; /* time card owner information */
lg_tc_status tc_status_rec; /* time card status information */
lg_tc_status_summary tc_status_summary_rec; /* time card count by status */
lg_tc_rec report_tc_rec; /* time card */
lga_apvr apvr_id_array_table; /* array of approver Names and Payroll IDs */
lga_apvr_null apvr_id_array_table; /* clear the lga_apvr array for each user */
lg_sysdate date := sysdate;
lg_debug_fl boolean := FALSE;
lg_debug_owner_id tc_wkr.tc_row_id%type := 9905;
lg_debug_apvr_id tc_wkr.tc_row_id%type := 1000;
The chnages i have done its in bold
Please Advice
Thanks
Edited by: Purvik on Aug 25, 2009 11:59 AMThere is not a chance in the world, especially not knowing column definitions that I, and I suspect most anyone else, is going to wade through this much unformated code looking for an error you couldn't bother to copy in full.
Either tell us, specifically, the line on which the error is occurring or, better yet, start whacking stuff out of your code until you find the offending definition. That is certainly what I would do. Commenting out sections is a marvelous way to quickly find an issue.
Before you post again please read the FAQ. It will explain to you how to properly post and use the tags. -
Hi I have a Sql Query Report Region as defined below. On the report attributes I am not using any "Row Selector". In a After submit process I try to print out the results of the value I have entered in as a value in updatable report and i get the error: I am doing this as a test before i use the data to insert into another table...
I receive this error if I enter in a characters (not numeric) into the "Field Value" field.:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error.
If I enter in a numeric into the "Field Value" text box, then I get the value displayed back without error. I need to be able to enter a varchar value without error.
My SQL QUERY is:
select i.INDEXED_FIELD_ID, i.field_name,
HTMLDB_ITEM.TEXT(3,d.indexed_field_value) field_value,
decode(f.required, 0, 'O', 1, 'R', 'NOT USED') REQUIRED
from XXVG_EFILE_DOCUMENT_FIELDS D,
xxvg_efile_type_fields f, xxvg_efile_indexed_fields i
WHERE f.indexed_field_id = i.indexed_field_id
and f.required in (0,1)
and i.indexed_field_id = d.indexed_field_id(+)
and d.document_id(+) = -1
and f.document_type_id = :p21_doc_type
My after submit process is the following...**Note** I am using P21_test as a field just to display my test. I receive the value back just fine without error if numeric. If varchar, that is when the problems occur. I have used just a length variable like the lettter 't' for testing and still receive the error.
DECLARE
vRow BINARY_INTEGER;
BEGIN
-- update field values
FOR i IN 1 .. HTMLDB_APPLICATION.g_f03.COUNT -- your field value
LOOP
vRow := HTMLDB_APPLICATION.g_f03(i);
IF vRow is Not NULL --means the field has data in it.
THEN
:p21_test := HTMLDB_APPLICATION.G_F03(i); --set a variable to the field with data.
END IF;
END LOOP;
END;
Is there a conversion I need to do? I do not want to do this via checkboxes as I dont want the user have to check a checkbox and then enter a value in. I just want a blank text box the user can enter a value in and then i can do an insert.
Thanks So much.Thanks Scott, That did do the trick as the varchar is now displayed of the entered item.
How do i also display the value of indexed_field_id as well.
I have an insert where i need the indexed field id and the entered field value.
Thanks in advance. -
I have a form which uses a customer form/report, drop downs etc..
the debug shows it running this statement
...Execute Statement: begin begin SELECT distinct initcap(RTRIM (LTRIM (e.surname, ' *0123456789-/:.?,'), ' *0123456789-/:.?,') || ', ' || RTRIM (LTRIM (e.first_name, ' *0123456789-/:.?,'), ' *0123456789-/:.?,' )) empname, e.ID bulk collect into wwv_flow_utilities.g_display,wwv_flow_utilities.g_value FROM dms.dms_employees@dmsprd e, dms.dms_employee_contracts@dmsprd ec WHERE e.ID = ec.emp_id and e.surname like '%%' AND :p75_date BETWEEN ec.start_date AND NVL (ec.end_date, :p75_date) AND e.brh_id = 3654 ORDER BY 1; end; end;
Then says
"report error: ORA-06502: PL/SQL: numeric or value error: character string buffer too small"
Any Ideas?
Thanks
DeanDenes Kubicek wrote:
A select list is limited in size. I am not sure what the limit is but that is definitelly the case.The maximum size for the HTML generated for a select list is 32K.
86 options sounds on the low side to be hitting that limit, but there are other concerns to this as well. Scrolling through hundreds/thousands of options in a select list is a pain for users, and huge select lists produce bloated pages that impact load times and network bandwidth. That list of around 200 countries you find on many sites is about the sensible maximum length for a select list.
You should use popups.Indeed.
Maybe you are looking for
-
Almost there. Can't driver doesn't recognize variables in another class?
I know this has got to be an easy fix.. but i can't figure it out.so I'll put it all here... it's a program that serves as inventory. add items. sell items. etc... this driver will not compile while the item and inventory classes compile fine. // Pro
-
How to capture non-work related time in SAP
Hi gurus, We are trying to implement a new system where by the shop floor person can enter his travelling time, break time and working time. Billing can only be done for working time. I know the regular way of entering time in CAT2 and transferring i
-
P67A-C43 B2 Constant reboot when memory in DIMM1
I just built a barebones kit consisting of: MB: P67A-C43 B2 PSU: Thermaltake TR2 RX 750W Bronze Proc: Core I7-2600 (unlocked) Mem: (2) 2x4 GB Corsair Vengeance DDR-1600 (16 GB) 9-9-9-24 Cool: Corsair H60 Hydro Vid: EVGA GTX 550 Ti HD1: OCZ SSD 120
-
Connecting my imac to my Dell laptop
Hi there, I'm trying to transfer files from my dell inspiron notebook to my imac using the file transfer wizard. The program keeps asking me to connect my computers, but I can't seem to find a cable that works. I've tried ethernet, USB and fire wire.
-
I am tring to log onto itunes and it is saying that my address doesn't match the system I have changed it in apple and I tunes and i still cant download or access my account