PL/SQL: numeric or value error: number precision too large
hi ,
i am running my script and getting this error. i created a object and and make table type on this with fraction of number(2,2). and in my script i am calling a standard API which have hour in number only .i am also using a custome table also which also having number(2,2). so plz help me to resoulve thsi error.
description below:
DECLARE
l_Return_Status VARCHAR2 (30):=NULL;
l_Msg_Count NUMBER :=0;
l_Msg_Data VARCHAR2 (2000) := NULL;
v_Sape_Sco_info_Tbl SAPE_SCO_INFO_TBL;
v_Sape_Sco_info_rec SAPE_SCO_INFO_REC;
p_assignment number:=165316; -----165688;
p_project_id number:=74538; -----81993;
sco_id number:=10371;
BEGIN
v_Sape_Sco_info_Tbl := SAPE_SCO_INFO_TBL();
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-Oct-2009',15.00,'17-Oct-2009','20-Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
v_Sape_Sco_info_Tbl.EXTEND;
v_Sape_Sco_info_Tbl(1) := v_Sape_Sco_info_rec;
SAPE_UPDATE_SCO_DETAILS_PKG.SCO_ROLE_INCREASE(
x_project_id =>p_project_id,
x_Assignment_Id =>p_assignment,
l_Sape_Sco_info_Tbl => v_Sape_Sco_info_Tbl,
x_called_function =>'ADD_EXISTING_RESOURCES',
x_Return_Status =>l_Return_Status,
x_Msg_Count =>l_Msg_Count,
x_Msg_Data =>l_Msg_Data
dbms_output.put_line('second Procedure executed sucessesfuly');
dbms_output.put_line('l_Return_Status '||l_Return_Status||' l_Msg_Count '||l_Msg_Count||'l_Msg_Data');
dbms_output.put_line('value'||' '||v_Sape_Sco_info_Tbl(1).Assignment_Id);
dbms_output.put_line('completed');
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlerrm(sqlcode));
END;
error :PL/SQL: numeric or value error: number precision too large
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_TBL IS TABLE OF SAPE_SCO_INFO_REC;
Prompt OBJECT TYPE SAPE_PA.SAPE_SCO_INFO_REC
DROP TYPE SAPE_PA.SAPE_SCO_INFO_REC;
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,
sco_role_end_date DATE,
sco_role_mode VARCHAR2(250),
sco_hrs_per_day NUMBER(2,2),
no_of_copies Number,
Active_Flag VARCHAR2(10),
BILLABLE_UPSIDE_INDICATIOR VARCHAR2(5),
RET_CODE VARCHAR2(5),
ERROR_MSG VARCHAR2(255),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
CREATE TABLE SAPE_PA.SAPE_SCO_STAFFING_MAPPINGS
( PROJECT_ID NUMBER,
SCO_ID NUMBER,
ASSIGNMENT_ID NUMBER PRIMARY KEY,
SCO_ROLE_START_DATE DATE,
SCO_ROLE_END_DATE DATE,
SCO_ROLE_HOURS NUMBER(2,2),
SCO_MODE VARCHAR2(80),
ACTIVE_FLAG VARCHAR2(5),
LAST_UPDATE_DATE DATE,
LAST_UPDATED_BY NUMBER(15,0),
CREATION_DATE DATE,
CREATED_BY NUMBER(15,0),
LAST_UPDATE_LOGIN NUMBER(15,0),
ATTRIBUTE1 VARCHAR2(240),
ATTRIBUTE2 VARCHAR2(240),
ATTRIBUTE3 VARCHAR2(240),
ATTRIBUTE4 VARCHAR2(240),
NATTRIBUTE1 NUMBER,
NATTRIBUTE2 NUMBER
)
The problem here is with avg_hrs_per_day NUMBER(2,2)+ of SAPE_SCO_INFO_REC object.
user12226862 wrote:
CREATE OR REPLACE TYPE SAPE_PA.SAPE_SCO_INFO_REC AS OBJECT
( Assignment_Id NUMBER,
project_id Number,
sco_id Number,
Role_START_DATE DATE,
Role_END_DATE DATE,
avg_hrs_per_day NUMBER(2,2),
sco_role_start_date DATE,And while assigning the value it is:
user12226862 wrote:
v_Sape_Sco_info_rec := SAPE_SCO_INFO_REC(p_assignment,p_project_id,sco_id,'15-Oct-2009','31-
Oct-2009',15.00,'17-Oct-2009','20-
Oct-2009','ADD_EXISTING_RESOURCES',02.50,NULL,'Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);Note that number(2,2) means maximum total of digits in that case is 2 (including scale), not 4.
E.g.
SQL> declare
2 x number(2,2);
3 begin
4 x := 02.50;
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 4However, this works:
SQL> declare
2 x number(2,2);
3 begin
4 x := .50;
5 end;
6 /
PL/SQL procedure successfully completed.Cheers,
AA
Similar Messages
-
ORA-06502: PL/SQL: numeric or value error: number precision too large
I am getting this error when my procedure is being invoked. I've checked if a calculation is attemting to assign an integer to a column that has a smaller data type...e.g 99 being inserted into NUMBER(2)....but this all seems fine...
any ideas where I should check?
thanks!>Is there a way to tell which column is throwing this error
As suggested by Guido it appears to be related to your variables, not the table;
SQL> create table t (col1 number(1))
Table created.
SQL> begin
insert into t values (11);
end;
ORA-01438: value larger than specified precision allowed for this column
ORA-06512: at line 2
SQL> declare
n number(1);
n2 number(2) :=11;
begin
n:= n2;
end;
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 5The error message should tell you the line of code that is causing the problem, ie;
ORA-06512: at line 5A quick way to show the values is to display them using dbms_output.put_line inline or in the exception handler. -
I have hit with above error and the code did run successfully before the minor change in the portion I have bolded. Appreciate your comment & help.
Attached with the code:
CREATE TABLE RPT1120B_CHANNEL_new
(SUBSCRIBER_NO NUMBER (9),
FP_CHANNEL VARCHAR2(255),
FP_DATE DATE,
FP_DYNASTY CHAR(1),
FP_MOVIE CHAR(1),
FP_FUN CHAR(1),
FP_LEARNING CHAR(1),
FP_NEWS CHAR(1),
FP_SPORTS CHAR(1),
FP_VARIETY CHAR(1),
FP_EMPEROR CHAR(1),
FP_SX1 CHAR(1),
FP_CEL CHAR(1),
LP_CHANNEL VARCHAR2(255),
LP_DATE DATE,
LP_DYNASTY CHAR(1),
LP_MOVIE CHAR(1),
LP_FUN CHAR(1),
LP_LEARNING CHAR(1),
LP_NEWS CHAR(1),
LP_SPORTS CHAR(1),
LP_VARIETY CHAR(1),
LP_EMPEROR CHAR(1),
LP_SX1 CHAR(1),
LP_CEL CHAR(1));
--truncate table RPT1120B_CHANNEL;
create or replace PROCEDURE sp_rpt1120b_new
AS
FP_CHANNEL VARCHAR2(255);
FP_DATE DATE;
LP_CHANNEL VARCHAR2(255);
LP_DATE DATE;
REC_COUNT NUMBER(3);
TYPE REC_SA IS RECORD
(AGREEMENT_NO NUMBER (9));
TYPE REC_CHANNEL IS RECORD
(CHANNEL VARCHAR2(3),
AGREEMENT_NO NUMBER (9));
BEGIN
FOR REC_SA IN (SELECT DISTINCT SUBSCRIBER_NO FROM RPT1120B_T1_new) LOOP
FP_CHANNEL := '';
LP_CHANNEL := '';
REC_COUNT := 0;
FP_DATE := '';
LP_DATE := '';
FOR REC_CHANNEL IN (SELECT distinct decode(SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',
29994,'D',
29995,'E',
30277,'C',
30293,'C',
30319,'C',
30359,'C',
30276,'X',
30331,'X',
30299,'X',
30380,'X')
AS CHANNEL,SA.EFFECTIVE_DATE as soc_sts_date
FROM SERVICE_AGREEMENT SA
WHERE SA.SOC in ( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380) AND
SA.AGREEMENT_NO = REC_SA.SUBSCRIBER_NO AND
TRUNC(SA.EFFECTIVE_DATE) <> TRUNC(NVL(SA.EXPIRATION_DATE,SYSDATE)) AND
SA.EFFECTIVE_DATE = (SELECT MIN(SA1.EFFECTIVE_DATE) FROM SERVICE_AGREEMENT SA1
WHERE SA1.AGREEMENT_NO = SA.AGREEMENT_NO AND
sa1.soc in (
29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380))
order by DECODE(channel,'D',1,'M',2,'E',3,'C',4,'X',5,'F',6,'L',7,'N',8,'S',9,'V',10)) LOOP
REC_COUNT := REC_COUNT + 1;
if REC_COUNT < 254 then
FP_CHANNEL := FP_CHANNEL || REC_CHANNEL.CHANNEL;
end if;
FP_DATE := REC_CHANNEL.soc_sts_date;
END LOOP;
REC_COUNT := 0;
FOR REC_CHANNEL IN (SELECT distinct decode(sa.SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',
29994,'D',
29995,'E',
30277,'C',
30293,'C',
30319,'C',
30359,'C',
30276,'X',
30331,'X',
30299,'X',
30380,'X')
AS CHANNEL,SA.soc_status_date as soc_sts_date
FROM SERVICE_AGREEMENT SA,
(SELECT MAX(SA1.soc_status_DATE) as soc_date, agreement_no, soc
FROM SERVICE_AGREEMENT SA1
WHERE soc in( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380)
GROUP BY agreement_no, soc) sa1
WHERE SA.SOC in ( 29990,
29991,
29993,
29988,
29989,
29992,
29994,
29995,
30277,
30293,
30319,
30359,
30276,
30331,
30299,
30380) AND
SA.soc_status_date = sa1.soc_date AND
TRUNC(SA.SOC_STATUS_DATE) <> TRUNC(NVL(SA.EXPIRATION_DATE,SYSDATE)) AND
SA.SOC_STATUS = (SELECT MIN(SA2.SOC_STATUS) FROM SERVICE_AGREEMENT SA2
WHERE SA2.AGREEMENT_NO = SA.AGREEMENT_NO AND sa2.soc = sa.soc
and SA2.soc_status_date = SA.soc_status_date)
order by DECODE(channel,'D',1,'M',2,'E',3,'C',4,'X',5,'F',6,'L',7,'N',8,'S',9,'V',10)) LOOP
REC_COUNT := REC_COUNT + 1;
if REC_COUNT < 254 then
LP_CHANNEL := LP_CHANNEL || REC_CHANNEL.CHANNEL;
end if;
LP_DATE := REC_CHANNEL.soc_sts_date;
END LOOP;
INSERT INTO RPT1120B_CHANNEL_new values
(REC_SA.SUBSCRIBER_NO,
substr(FP_CHANNEL,1 essageID=1196758, I have hit with above error and the code did run successfully before the minor change in the portion I have bolded. Appreciate your comment & help.
Attached with the code:
CREATE TABLE RPT1120B_CHANNEL_new
(SUBSCRIBER_NO NUMBER (9),
FP_CHANNEL VARCHAR2(255),
FP_DATE DATE,
FP_DYNASTY CHAR(1),
FP_MOVIE CHAR(1),
FP_FUN CHAR(1),
FP_LEARNING CHAR(1),
FP_NEWS CHAR(1),
FP_SPORTS CHAR(1),
FP_VARIETY CHAR(1),
FP_EMPEROR CHAR(1),
FP_SX1 CHAR(1),
FP_CEL CHAR(1),
LP_CHANNEL VARCHAR2(255),
LP_DATE DATE,
LP_DYNASTY CHAR(1),
LP_MOVIE CHAR(1),
LP_FUN CHAR(1),
LP_LEARNING CHAR(1),
LP_NEWS CHAR(1),
LP_SPORTS CHAR(1),
LP_VARIETY CHAR(1),
LP_EMPEROR CHAR(1),
LP_SX1 CHAR(1),
LP_CEL CHAR(1));
--truncate table RPT1120B_CHANNEL;
create or replace PROCEDURE sp_rpt1120b_new
AS
FP_CHANNEL VARCHAR2(255);
FP_DATE DATE;
LP_CHANNEL VARCHAR2(255);
LP_DATE DATE;
REC_COUNT NUMBER(3);
TYPE REC_SA IS RECORD
(AGREEMENT_NO NUMBER (9));
TYPE REC_CHANNEL IS RECORD
(CHANNEL VARCHAR2(3),
AGREEMENT_NO NUMBER (9));
BEGIN
FOR REC_SA IN (SELECT DISTINCT SUBSCRIBER_NO FROM RPT1120B_T1_new) LOOP
FP_CHANNEL := '';
LP_CHANNEL := '';
REC_COUNT := 0;
FP_DATE := '';
LP_DATE := '';
FOR REC_CHANNEL IN (SELECT distinct decode(SOC,
29990,'N',
29991,'V',
29993,'M',
29988,'F',
29989,'L',
29992,'S',The error message has an important hint: "number precision too large"
Change REC_COUNT's type from NUMBER(3) to NUMBER and see what happens. -
ERROR:number precision too large (WWV-16016)
Hi!
As I try to insert values into form items an error accurs:
ORA-06502: PL/SQL: numeric or value error: number precision too
large (WWV-16016)
P.S.-One form item inserts values into database table where
column is VARCHAR2, lenght 2000...
How can I fix this error?Thank you in advance!Table Structure:
ID NUMBER (5,0) , DATE_T1 DATE, ID_PROFESOR NUMBER(5,0), SUBJECT
VARCHAR2(50), MESSAGE VARCHAR2(2000).
The error accurs for example if I try to insert:
ID=1,DATE_T1=6.6.2001, ID_PROFESOR=3, SUBJECT="New uniforms",
MESSAGE="bla,bla,bla..."
I'm using Oracle portal version 8.1.2.
I hope, this will help you! -
THE FOLLOWING SIMPLE CODE IS GIVING ERROR even though i have given the definition (2,3) which is larger than the length of value 3.14 ?
declare
pi constant number(2,3):=3.14;
r number(5) ;
a number(5);
begin
r:=2;
a:=pi*power(r,2);
dbms_output.put_line('area is '||a);
insert into areas values(r,a);
end;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: number precision too large
ORA-06512: at line 2pi constant number(2,3):=3.14;Perhaps you meant NUMBER(3,2).
SQL> declare
2 pi constant number(3,2):=3.14;
3 begin
4 dbms_output.put_line(pi);
5 end;
6 /
3.14
PL/SQL procedure successfully completed.
SQL> declare
2 pi constant number(3,2):=3.1415926;
3 begin
4 dbms_output.put_line(pi);
5 end;
6 /
3.14 -
The oracle application express environment is created by installing the HTTP Server on the windows server and the application express 3.2.1 components on the 11.1.0.7 oracle database on UNIX. The installation is successfully and have not seen any issues during the installation. After completing all the steps, when tried to login and click the application builder or workspace components, I see the error message
report error:ORA-06502: PL/SQL: numeric or value error: character to number.
This error message is seen on most of the pages when trying to accessed and not able to understand the reasons behind it. Its a brand new environment setup and not even presented to developers to test it.
Below error message is always seen when trying to access most of the components like application builder, schema comparison and some other tabs. Please advice
report error:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
Edited by: user589320 on Jun 9, 2011 5:17 PMI think its better you use APEX 4.x version ratherthan using old version.
You will get more features and some bug fixes and also it's easy for you to get some help when you need.
* If this answer is helpfull or correct then please mark it and grant the points. -
PL/SQL: numeric or value error: character to number conversion error in TRG
Hi,
I've got strange issue with one trigger which during update of table reports (DB is 9.2.0.8):
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "UDR_LOG", line 345
ORA-04088: error during execution of trigger 'UDR_LOG'but line 345 is:
END IF;
so its kind of strange
the code looks like
343 IF nvl(to_char(:old.PKD_ID),'''') <> nvl(to_char(:new.PKD_ID),'''') THEN
344 v_zmn := v_zmn || 'PKD_ID''' || to_char(:old.PKD_ID) || '''' || to_char(:new.PKD_ID) || '''';
345 END IF;
so its concatenation not to_number usage .error is triggered by update statement on any column .
I'm sorry I cant provide You with whole trigger code .
So if You could only recommend any investigation method that would be great .
Regards
GregHi, Greg,
When there's an error in a trigger, the line numbers in the error messages are relative to the first DECLARE or BEGIN statement; often, that's a few lines after CREATE OR REPLACE TRIGGER. Post a few lines after what you already posted.
If you can't find the error, then create another table for testing this, and create a smaller trigger on that table, which does only enough to cause the error. Then you'll be able to post the complete trigger, and the code needed to re-create the problem. -
ORA-06502: PL/SQL: numeric or value error: character to number conversion e
Hi,
when I do same thing in my procedure it throws below error but it works fine as annonymus block.
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
CREATE TABLE test_table
(memberid NUMBER,
trans_date date);
DECLARE
v_num number(10,0);
v_text varchar2(100);
begin
v_text := '123456abcdef';
v_num := substr(v_text,1,5);
INSERT INTO test_table
(memberid,
trans_DATE)
VALUES
(v_num,
sysdate);
end;Thanks
SandhyaWorks fine as a procedure as well;
SQL> DECLARE
2 v_num number(10,0);
3 v_text varchar2(100);
4 begin
5 v_text := '123456abcdef';
6 v_num := substr(v_text,1,5);
7 INSERT INTO test_table
8 (memberid,
9 trans_DATE)
10 VALUES
11 (v_num,
12 sysdate);
13 end;
14
15 /
PL/SQL procedure successfully completed.
SQL> select * from test_table;
MEMBERID TRANS_DAT
12345 20-MAY-10
SQL> create or replace procedure ins_test_table as
2
3 v_num number(10,0);
4 v_text varchar2(100);
5 begin
6 v_text := '123456abcdef';
7 v_num := substr(v_text,1,5);
8 INSERT INTO test_table
9 (memberid,
10 trans_DATE)
11 VALUES
12 (v_num,
13 sysdate);
14
15 end ins_test_table;
16 /
Procedure created.
SQL>
SQL> exec ins_test_table;
PL/SQL procedure successfully completed.
SQL> select * from test_table;
MEMBERID TRANS_DAT
12345 20-MAY-10
12345 20-MAY-10 -
ORA-06502: PL/SQL: numeric or value error: character to number conversion
Hello,
I am new to Oracle Apex so I decided to read and do the tutorials that are on the apex.oracle.com site.
Now I am at the tutorial 6: How to Work with Check Boxes of the Advanced Tutorials.
At a certain point you have to add a new radio button.
At the Item Source Value you have to add SELECT 'Y' FROM DUAL WHERE :P2_LIST_PRICE*0.75=:P2_MIN_PRICE.
But when I try to create the item, I keep getting the following error:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
Error creating item.
Does anybody know what could be the problem.
Thanks in advance.CREATE OR REPLACE PROCEDURE xxbb_query (
p_branch_code XXBOB_HRMS_APPRAISALS_DATA.Branch_code%TYPE,
p_PERIOD_NAME XXBOB_HRMS_APPRAISALS_DATA.PERIOD_NAME%TYPE
IS
emp_refcur SYS_REFCURSOR;
v_deposits XXBOB_HRMS_APPRAISALS_DATA.deposits%TYPE :=0;
v_branch_code XXBOB_HRMS_APPRAISALS_DATA.branch_code%TYPE:=0;
p_query_string VARCHAR2(500);
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello' || ' ' || '...');
p_query_string := 'SELECT Avg(deposits) Dep,branch_code FROM XXBOB_HRMS_APPRAISALS_DATA WHERE ' ||
*' Branch_code = :branch_code '||*
*' AND PERIOD_NAME = SubStr( :PERIOD_NAME ,1,4))||(SubStr( :PERIOD_NAME ,InStr( :PERIOD_NAME ,'-',1,1)+3,5)) ' ||*
*' group BY SubStr(PERIOD_NAME,5),BRANCH_CODE ';*
DBMS_OUTPUT.PUT_LINE('Hi' || ' ' || '...');
OPEN emp_refcur
FOR p_query_string USING p_branch_code,v_p_PERIOD_NAME,v_p_PERIOD_NAME,v_p_PERIOD_NAME;
-- DBMS_OUTPUT.PUT_LINE('----- -------');
Here I m passing a string variable to pass the select statement for the ref cursor.
There seems some problem in the substr conversion in the statement.
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
But when i run as a independent staement passing real values in the place of placeholders
i get the result right.
The *:PERIOD_NAME* format is *'Jan-2009-10'* .
And I need to pass the *:PERIOD_NAME* to the query as *'Jan-09-10'*
Pls suggest.
Edited by: user7391361 on Jul 23, 2009 8:28 AM -
ORA-06502: PL/SQL: numeric or value error: character to number error
Hello Gurus,
I keep getting the following error:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
It happens on wizard generated tabular form.
DECLARE
v_venue_prsntd_qtr varchar2(3);
v_venue_prsntd_fy number;
BEGIN
FOR i IN 1 .. apex_application.g_f02.COUNT
LOOP
IF apex_application.g_f05 (i) IS NOT NULL THEN
v_venue_prsntd_qtr :=
Case WHEN TO_CHAR(apex_application.g_f05 (i), 'MON') IN ('OCT','NOV','DEC') THEN '1'
WHEN TO_CHAR(apex_application.g_f05 (i), 'MON') IN ('JAN','FEB','MAR') THEN '2'
WHEN TO_CHAR(apex_application.g_f05 (i), 'MON') IN ('APR','MAY','JUN') THEN '3'
ELSE '4'
END;
-- INTO v_venue_prsntd_qtr
-- FROM venue_prsntd
-- WHERE venue_prsntd_seqno = apex_application.g_f02 (i)
-- AND dfcy_seqno = apex_application.g_f03 (i)
-- AND apex_application.g_f05 (i) IS NOT NULL;
----fiscal year
-- v_venue_prsntd_fy :=
-- CASE WHEN TO_CHAR(TO_NUMBER(TO_CHAR(apex_application.g_f05(i), 'MMDD'))) < 1001 THEN --------TO_CHAR(apex_application.g_f05 (i),'YYYY')
-- ELSE TO_CHAR(TO_NUMBER(TO_CHAR(apex_application.g_f05 (i),'YYYY')) + 1)
-- END;
-- INTO v_venue_prsntd_fy
-- FROM venue_prsntd
-- WHERE venue_prsntd_seqno = apex_application.g_f02 (i)
-- AND dfcy_seqno = apex_application.g_f03 (i)
-- AND apex_application.g_f05 (i) IS NOT NULL;
---END IF;
--- IF apex_application.g_f02 (i) IS NULL AND apex_application.g_f05 (i) IS NOT NULL Then
-- INSERT INTO venue_prsntd(venue_prsntd_qtr, venue_prsntd_fy)
-- VALUES(v_venue_prsntd_qtr, v_venue_prsntd_fy);
UPDATE VENUE_PRSNTD
SET VENUE_PRSNTD_QTR = to_number(v_venue_prsntd_qtr)
-- VENUE_PRSNTD_FY = v_venue_prsntd_fy
WHERE VENUE_PRSNTD_SEQNO = APEX_APPLICATION.G_F03(i);
END IF;
END LOOP;
END;I am trying to update venue_prsntd_qtr. I have commented everything else out to see if I can limit where the error is coming from.
qtr is a number field in the database. I have gone back and forth with variable type in the code and still get the same error.
I am using oracle db 10g, apex 3.2.1
Thanks
MaryHi,
I am guessing that apex_application.g_f05 is a date field. If that is the case, you need to use to_date() before using to_char(). For example:
SELECT to_char('01-jan-10', 'MON') FROM dual -- Error!
SELECT to_char(to_date('01-jan-10'), 'MON') FROM dual -- Ok!
I hope this helps.
Luis -
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. -
We face the above error in HTMLDB (APEX) application Ver 3.1.0. This occurs when we try to display more number of rows/records in drop-down list (LOV in tabular forms). We are able to display 200 records in LOV. When the list of records exceeds 230, we face the below error
report error:ORA-06502: PL/SQL: numeric or value error: character string buffer too small
the values listed in LOV are from tables (one of the columns in table)
Could anyone give us a solution?Hi
As you are using a tabular form, you could actually do the following:
1 - In the tabular form column's attributes, set the following:
Display as: Select List (query based on LOV)
Display extra values: Yes
List of values definition: SELECT null d, null r FROM DUAL
2 - Add a new page item and set it to generate your select list
3 - Create an HTML region with no template and use the following for its source:
<script type="text/javascript">
function loadList(c, l)
var s = document.getElementsByName(c);
var lItem = document.getElementById(l);
var lLength = lItem.options.length;
var k;
var j;
var x = lItem.innerHTML;
var v;
var o;
var z;
for (k = 0; k < s.length; k++)
z = s[k];
v = z.value;
z.options.length = 0;
for (j = 0; j < lLength; j++)
o = new Option()
o.value = lItem[j].value;
o.text = lItem[j].text;
z.options[j] = o;
z.value = v;
if (z.selectedIndex == -1)
z.selectedIndex = 0;
loadList("f05", "P1_MGR");
</script>
(Change "f05" and "P1_MGR" as appropriate to your column and your new page item respectively)
Now, when you load the page, the select list contains a null entry plus the entry already on the database. The javascript kicks in automatically, loops through every entry in the "f05" column, copies the existing value, replaces the select list with the new page item version and sets its value to the copied value.
Your new page item could be in a DIV tag that has a style of "display:none" to hide it from view.
Andy -
Hi Team,
I am running one conc programme.
After running I am getting below error. I checked the issue on metalink and other, seems that it is an size related issue. I have increased the size of formula columns and placeholdder too.
But still getting issue.
My requirement is to get comma seperated values using SQL query itself. Neither i wanted to create layout of the report , since it is a XML publisher report and nor I am including it on RTF template.
I want the CF_10 formula column to be populated with comma seperated values.
MSG-00187: From Date 01-Sep-2014
REP-1401: 'cf_10formula': Fatal PL/SQL error occurred.
ORA-06502: PL/SQL: numeric or value error
And Here is my code for CF_10
function CF_10Formula return Number is
begin
SELECT NVL(TO_CHAR(sum(Amount),'99,99,99,999'),0) into :CP_5 --NVL(ROUND(sum(Amount)),0) into :CP_5
-- xxhw_Coll_cat(category) "Intercat Catg"
FROM hhxw_Region_col_v
WHERE Category IN ('Intercompany - CATV')
AND trunc(gl_date) BETWEEN TO_DATE(:P_FROM_DATE, 'DD/MM/RRRR') AND TO_DATE(:P_TO_DATE, 'DD/MM/RRRR');
RETURN ROUND(:CP_5);
end;
Anyone please suggest me.
Regards,
SachinHi,
1)Why are you selecting the value into a report item? Select into a local variable and return that
RETURN :CP_5 --> This one!!
2)And you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
AND gl_date >= To_date(:P_FROM_DATE, 'DD/MM/RRRR')
AND gl_date < To_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
I think you are taking 2 column in the Layout CF_10 and CP_5 right? if so, then use below Query.
FUNCTION cf_10formula
RETURN NUMBER
IS
v_amount NUMBER:null;
IS
BEGIN
BEGIN
SELECT nvl(round(SUM(amount)), 0)
INTO v_amount --> Retruns the value for CF_10 column
FROM hhxw_region_col_v
WHERE category IN ( 'Intercompany - CATV' )
AND gl_date >= to_date(:P_FROM_DATE, 'DD/MM/RRRR')
AND gl_date < to_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
:CP_5 := nvl(trunc(v_amount),0); --> Retruns the value for CP_5 column
EXCEPTION
WHEN OTHERS THEN
v_amount := 0;
srw.message(1003,'Error in Getting :' ||p_from_date);
END;
END;
And
If you've got a number function returning into a number field then all you should need to do to make the comma appear is to change the number format mask in field.
From 40000 to 40,000 -
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. -
Ora-06502 pl/sql numeric or value error in Report Query in oracle apex
Hello all,
I need your help...
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
I am using bi publisher to generate PDF reports in oracle apex.
We were using APEX 4.0 and migrated to 4.2 just a week ago.
Now we have apex 4.2.
When I try to Create report query,
Shared Components >> Report Queries then create.
and test a report in a create wizard I am getting a error "ORA-06502: PL/SQL: numeric or value error: character string buffer too small".
I have also applied a patch "16760897".
This issue is because of number of columns in a query is more then 26.
If I run a report with 26 or less number of columns then the is working fine, otherwise getting this error.
My before migration report queries working perfectly even now, but not new queries.
This issue is also in apex.oracle.com.
You can see
Not working - http://apex.oracle.com/pls/apex/f?p=619:4
Working - http://apex.oracle.com/pls/apex/f?p=619:2:
Please give a solution.
Thanks you.check the DB version compatibility with apex 4 or your DB version to apex 4.0 support for upgrade!
Oracle Application Express Installation Requirements for 4.0
Maybe you are looking for
-
Switching phones and activation fees
Hi everyone, I bought a new phone off e_bay (LG voyager vx10000) to replace my current phone. I realize I can switch and activate the new phone from the Verizon website but my question is.....when I activate my new phone will I still be able to use m
-
What's the safe way to do initialization and finalization?
Hi all, I have a thrid party driver for an external device to use in my CVI. I have to initialize the driver when the main panel is initialized and HAVE to release the driver upon the closing of the application. In my code, the main structure is so
-
HT204266 To stop the Visa payment for purchase of Blue Coins in Metalstorm Online game.
On 27 Dec 2013 at 1.00 am, I have made an online purchase of 1625 blue coins in the game of Metalstorm Online. I made only One purchase but finally Two purchases were shown. I request to cancel the Second purchase that was not made with my intention.
-
Faulting application name: InDesign.exe
Hi I am a systems admin trying to sort out a problem for a client. The client will be working on files in Indesign and it will crash. Also other Adobe products are crashing Here is the errors from the application logs: Faulting application name: InDe
-
Hi! I feel like I have tried everything, although I do hope I haven't. I have a file that I have uses CSS style, absolute positioning and z-index. It is a fairly simple site. This is the first time I have used absolute positioning and z-index. Since