How 2 convert numeric value to character value?
Hi friends,
I want to convert numeric value to the character value.
Is there any FM available?
Points rewared soon.
Regards
Ronn
REPORT ZSPELL.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
Similar Messages
-
How to Change Numeric Value into Character Value in Reports at run-time?
Hi,
I am creating some reports, in which i am facing a problem.
i have an AMOUNT field of "NUMBER" data type in a table, I want to show the AMOUNT value in Character at run-rime.
For example, if AMOUNT is 12000 then it should be converted into Character like "Twelve Thosand".
Please help me to make it clear.
Thanking you in advance.u can get decimal points through this function
FUNCTION amt_2_word(amt varchar2) RETURN Char IS
BEGIN
declare
--TYPE v_arr IS VARRAY(6) of varchar2(3);
len number;
i number;
t_amt varchar2(100);
t_word varchar2(20000);
last_3rd varchar2(1);
main varchar2(1000); -- number in format main.sub
--v_main v_arr := v_arr('00','0','00','00','000');
v_main1 varchar2(3) := '00';
v_main2 varchar2(3) := '0';
v_main3 varchar2(3) := '00';
v_main4 varchar2(3) := '00';
v_main5 varchar2(3) := '000';
sub varchar2(1000);
res_1 varchar2(32000);
res_2 varchar2(32000);
res_3 varchar2(32000);
res_4 varchar2(32000);
res_5 varchar2(32000);
res varchar2(32000);
begin
t_amt := lpad(amt, 10, '0');
len := length(amt);
i := instr(amt, '.');
if i = 0 then
main := lpad(amt, 10, '0');
sub := '';
else
main := lpad(left(amt, instr(amt, '.')-1), 10, '0');
sub := rpad(right(amt, len - instr(amt, '.')), 2, '0');
end if;
v_main1 := right(main, 2);
v_main2 := left(right(main, 3), 1);
v_main3 := left(right(main, 5), 2);
v_main4 := left(right(main, 7), 2);
v_main5 := left(main, 3);
if v_main1 <> '00' then
res_1 :=getTwo(v_main1);
end if;
if v_main2 <> '0' then
res_2 := getOne(v_main2) || ' Hundred ';
end if;
if v_main3 <> '00' then
res_3 := getTwo(v_main3) || ' Thousand ';
end if;
if v_main4 <> '00' then
res_4 := getTwo(v_main4) || ' Lac ';
end if;
if v_main5 <> '000' then
last_3rd := left(right(v_main5, 3), 1);
if last_3rd <> '0' then
res_5 := getOne(last_3rd) || ' Hundred ';
end if;
res_5 := res_5 || getTwo(right(v_main5, 2)) || ' Crore ';
end if;
res := 'Rupees ' || res_5 || res_4 || res_3 || res_2 || res_1 || ' ';
if sub is null then
res := res || 'Only';
else
res_1 := getTwo(sub);
res := res || 'and Paise ' || res_1 || ' Only';
end if;
return res;
end;
END;
u write this PL SQL in ur databse and u can use this function and get amount to word -
How do I display the character value of a particular character in a string?
I tried to make a sample code, both charAt(index) and charValue() methods returned the same thing. So, I guess my earlier suggestion was wrong...
What therefore do you mean when you say character value? Is it for example String "Hello" is composed of character values 'H', 'e', 'l', 'l', and 'o'? -
Function module to convert character value of month into numeric value?
Hi Experts,
I need to convert a character value of a month in three alphabets to its numeric value.
e.g. 'jun' should be converted into '06' and 'jan' into '01' using a function module.Can anybody please provide me a similar function module?
TIA
Abhishektry this code:
DATA: text(20) TYPE c,
date TYPE sy-datum.
text = '06. Jul 06'.
TRANSLATE text TO UPPER CASE.
TRANSLATE text USING '. '.
CONDENSE text NO-GAPS.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
EXPORTING
input = text
IMPORTING
output = date.
WRITE date USING EDIT MASK '__.__.____'.
Regards,
Dara. -
How to convert character value to_date?
I want to change the time (hours) in sysdate to '10' and then save this new date into a date column for that i've written the following command
(TO_CHAR(SYSDATE,'DD-MON-RRRR')||' 10:'||TO_CHAR(SYSDATE,'MI:SS AM'))this command will remove the actual hours in sysdate and change it with the value '10'. but the result of this command is a character value. and i want a date value to insert into a date column. for that i've converted this command to_date as follows
TO_DATE(TO_CHAR(SYSDATE,'DD-MON-RRRR')||' 10:'||TO_CHAR(SYSDATE,'MI:SS AM'))but it gives the following error
ORA-01830: date format picture ends before converting entire input string
how to do this?Gul wrote:
I want to change the time (hours) in sysdate to '10' and then save this new date into a date column for that i've written the following command
(TO_CHAR(SYSDATE,'DD-MON-RRRR')||' 10:'||TO_CHAR(SYSDATE,'MI:SS AM'))this command will remove the actual hours in sysdate and change it with the value '10'. but the result of this command is a character value. and i want a date value to insert into a date column. for that i've converted this command to_date as follows
TO_DATE(TO_CHAR(SYSDATE,'DD-MON-RRRR')||' 10:'||TO_CHAR(SYSDATE,'MI:SS AM'))but it gives the following error
ORA-01830: date format picture ends before converting entire input string
how to do this?TO_DATE(TO_CHAR(SYSDATE,'DD-MON-YYYY')||' 10:'||TO_CHAR(SYSDATE,'MI:SS AM'),'DD-MON-YYYY HH:MI:SS AM') -
How do you convert numeric values into english words?
I am interested in creating a field in adobe acrobat that references a total dollar amount field. I want the java script to convert the numeric number into a written word, such as $59.59 as Fifty Nine and 59/100. I have no experience writing java script code and would really like some help on how this can get done. Its also important to embed in the programming that if their is no numeric value to reference, then nothing get referenced. This means an empty text box. Thanks for any help.
Im using the below script...... I'm a complete novice at this and helping a friend out with it.
Any info is appreciated.
aTens = [ "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
aOnes = [ "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine",
"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen",
"Nineteen" ];
function ConvertToHundreds(num)
var cNum, nNum;
var cWords = "";
num %= 1000;
if (num > 99) {
/* Hundreds. */
cNum = String(num);
nNum = Number(cNum.charAt(0));
cWords += aOnes[nNum] + " Hundred";
num %= 100;
if (num > 0)
cWords += " and "
if (num > 19) {
/* Tens. */
cNum = String(num);
nNum = Number(cNum.charAt(0));
cWords += aTens[nNum - 2];
num %= 10;
if (num > 0)
cWords += "-";
if (num > 0) {
/* Ones and teens. */
nNum = Math.floor(num);
cWords += aOnes[nNum];
return cWords;
function ConvertToWords(num)
var aUnits = [ "Thousand", "Million", "Billion", "Trillion", "Quadrillion" ];
var cWords = (num >= 1 && num < 2) ? "Dollar and " : "Dollars and ";
var nLeft = Math.floor(num);
for (var i = 0; nLeft > 0; i++) {
if (nLeft % 1000 > 0) {
if (i != 0)
cWords = ConvertToHundreds(nLeft) + " " + aUnits[i - 1] + " " + cWords;
else
cWords = ConvertToHundreds(nLeft) + " " + cWords;
nLeft = Math.floor(nLeft / 1000);
num = Math.round(num * 100) % 100;
if (num > 0)
cWords += ConvertToHundreds(num) + " Cents";
else
cWords += "Zero Cents";
return cWords;
You can use the following script for the custom calculation for the words field when the number field is named "Number":
event.value = "";
var f = this.getField("Number");
if(f.valueAsString != "") {
event.value = ConvertToWords(f.value); -
Error while assigning a character value to a numeric variable.
I fire a sql statement and check the number of rows returned by the sql.
I check this result with the application logs.
The application logs keeps the sqls fired by the application and the no of rows returned, in the example below the sql returned 8454 rows.
My script compares the two results.
***********Application Log***********
4/14/2008 11:15:01 AM: 0059 SQL SELECT "CLUSTER_CD",
4/14/2008 11:15:01 AM: 0060 "PRODUCT_DESC",
4/14/2008 11:15:01 AM: 0061 "TEAM_CD"
4/14/2008 11:15:01 AM: 0062 FROM "OPS$TMS"."MAP_CLUSTER_TEAM_PROD"
4/14/2008 11:15:01 AM: 3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD, 8,454 lines fetched
***********Application Log***********
My script:
#!/bin/ksh
typeset -i resA
typeset -i resB
opstms_conn_string="abc/[email protected]"
set `sqlplus -s $opstms_conn_string << EOF
set pages 0
WHENEVER SQLERROR CONTINUE
SELECT count(*)
FROM MAP_CLUSTER_TEAM_PROD;
exit
EOF`
resA=$1 ##returns 8454
resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}'`
##resB returns 8,454
## here i get syntax error
if [ $resA -eq $resB ]; then
echo "QA passed for sql1"
else
echo "QA failed for sql1"
fi
The problem is as resB is integer variable it does not accept character value: 8,454 so returns a syntax error:
How do I change the value assigned to resB into a numeric variable?
error:
+ grep 3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD, BCVP_Main_Loader.qvw.log
run.ksh[52]: 8,454: syntax errorChange:
resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}'`
to this:
resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}' | tr -d ,`
to drop the comma. Or you could do it in awk(1):
resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{ gsub( /,/, "", $10 ); print $10}'`
Or you could to it all in awk(1):
resB=`awk '
/3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD/ {
gsub( /,/, "", $10 )
print $10
' BCVP_Main_Loader.qvw.log`
(This example was not tested, it's just for a model.)
Someone more of an SQL guru than I can probably tell you how to change your numeric locale to avoid presenting those commas in the first place and avoid the problem.
HTH -
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,
How can I convert HEX value to CHAR value.
The Code in <b>non Unicode</b> system is:
DATA: t_text LIKE tline OCCURS 0 WITH HEADER LINE.
constants: c_hex_20a5(2) TYPE x VALUE '20A5'.
t_text-tdline = 'seller of the item so listed. A legend of the Seller Code(s) is as'.
TRANSLATE t_text-tdline USING c_hex_20a5.
The same code give error in <b>Uni-Code</b> system:
<b>error is "c_hex_20a5 must be an character type object (C, N, D, T or String type)."</b>
If anyone know, what is the solution, please let me know.
Thanks!
Puneet.Hi,
Try declaring the Hex chars using the ABAP char utilities. This is just a sample piece of code on how to declare and use:
CLASS cl_abap_char_utilities DEFINITION LOAD.
DATA: ws_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf.
data: c_newline TYPE x VALUE '0D'. [ it is zero D, for carriage return ]
ws_lf = c_newline.
CONCATENATE it_tab-maktx
ws_lf
ws_template
INTO it_notificatn-template.
Hope this helps...
Regards
Subramanian -
PL/SQL: numeric or value error (character string buffer too small)
Hi All,
Below is the procedure used to send notifications. It was working fine in previous DB version :- 10.1.0.5.0 and there was recent upgrade to 11.2.0.2.0.
I complies fine, but when executing it throws the error.
PROCEDURE PROC_STATUS_MAIL_UNADJ IS
K_BOUNDARY CONSTANT VARCHAR2(1000) := 'a1b2c3d4e3f2g1';
l_analysis_report VARCHAR2(32767); --empty_clob; --clob :=
l_header VARCHAR2(1000);
l_footer VARCHAR2(200);
cnxn UTL_SMTP.connection;
cursor cloc is select location_id from locations order by location_id asc;
loc_id cloc%rowtype;
BEGIN
dbms_output.enable (1000000);
FOR loc_id in cloc
loop
l_analysis_report := '<style type="text/css">
<!--.style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #FF0000}-->
<!--.sidebar1 { font-family: Arial, Helvetica, sans-serif; font-size: 10px}-->
<!--.text { font-family: Arial, Helvetica, sans-serif; font-size: 12px}-->
</style>
<center><b><font face="Arial">Run Summary Report'
|| TO_CHAR(SYSDATE, 'DD-MON-YYYY HH:MI AM') || '<br><br></font></b></center>'
|| ' <div align="center"><table width="95%" border="1" cellspacing="0" cellpadding="1" </div>'
|| '<span style="font-size: 10pt; font-family: Arial"> </span> '
|| '<tr bgcolor=b4b4b4><td align="center"> <font size="3"> <b>'
|| 'Analysis</b></td><td align="center"><font size="3"> <b>'
|| 'Start Time</b></td><td align="center"><font size="3"> <b>'
|| 'End Time</b></td><td align="center"><font size="3"> <b>'
|| 'Run Duration (mins)</b></td><td align="center"><font size="3"> <b>'
|| 'Status</b></font></td></tr> ' || UTL_TCP.CRLF;
FOR curr_refresh IN (SELECT AN.ANALYSIS_ID,AN.NAME ANALYSIS_NAME,TO_CHAR(ARH.RUN_START_TIME,'DD/MM/YYYY HH:MI:SS') START_TIME,
TO_CHAR(ARH.RUN_END_TIME,'DD/MM/YYYY HH:MI:SS')END_TIME,
ROUND(((ARH.RUN_END_TIME-ARH.RUN_START_TIME)*24*60),2) RUN_TIME_SECS,ARH.JOB_STATUS STATUS
FROM
RUN_HISTORY ARH,ANALYSES AN
WHERE
AN.ANALYSIS_ID=ARH.ANALYSIS_ID
AND AN.CYCLE_IND_ID IN (1,3)
AND ARH.RUN_START_TIME>TO_DATE(SYSDATE-30)
AND ARH.JOB_NAME LIKE 'RHS_QU%'
AND AN.LOCATION_ID = loc_id.location_id
AND ARH.JOB_STATUS='Completed'
ORDER BY ARH.RUN_START_TIME DESC)
LOOP
l_analysis_report := l_analysis_report ||'<tr><td align="center">'|| curr_refresh.analysis_name
|| '</td><td align="center">' || curr_refresh.start_time || '</td><td align="center">'
|| curr_refresh.end_time || '</td><td align="center">'|| curr_refresh.RUN_TIME_SECS ||
'</td><td align="center">'|| curr_refresh.status ||
'</td> </tr>' || UTL_TCP.CRLF;
exit when length (l_analysis_report) > 32500;
END LOOP;
l_analysis_report := l_analysis_report || '</table><br><br>';
l_footer := UTL_TCP.CRLF ||'<b> Note: This is an auto generated email. Please do not reply to it. Contact the IT team for any further information.</b>'|| UTL_TCP.CRLF;
FOR curr_email IN (SELECT GLOBAL_NAME INSTANCE_NAME,
EU.EMAIL_USER_LAST_NAME last_name, EU.EMAIL_USER_FIRST_NAME ACNAME,
EU.EMAIL_USER_EMAIL_ID,loc.LOCATION_NAME LOC_NAME,
'[email protected]' MAIL_FROM
FROM
RHS_EMAIL_USER EU,LOCATIONS LOC,GLOBAL_NAME
WHERE EU.LOCATION_ID=LOC.LOCATION_ID
AND EU.LOCATION_ID=loc_id.location_id
) LOOP
cnxn := UTL_SMTP.open_connection('smtprelay.inc.com', 25);
UTL_SMTP.helo(cnxn, 'smtprelay.inc.com');
UTL_SMTP.mail(cnxn, '[email protected]');
UTL_SMTP.rcpt(cnxn, curr_email.EMAIL_USER_EMAIL_ID);
l_header := 'MIME-Version: 1.0'||'
To: ' || curr_email.last_name || ' <' || curr_email.EMAIL_USER_EMAIL_ID || '>
From: ' || curr_email.mail_from || '
Subject: Un-Adjusted Analysis Report for ' || curr_email.loc_name || ' Location from' || curr_email.instance_name || ' on ' || to_char(sysdate, 'DD-MON-YYYY') || '
Reply-To: [email protected]
Content-Type: text/html;' || UTL_TCP.CRLF || UTL_TCP.CRLF;
UTL_SMTP.data(cnxn, l_header || l_analysis_report || l_footer);
UTL_SMTP.quit(cnxn);
END LOOP;
END LOOP;
END PROC_STATUS_MAIL_UNADJ;
Error :-
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.UTL_SMTP", line 591
ORA-06512: at "SYS.UTL_SMTP", line 497
ORA-06512: at "SYS.UTL_SMTP", line 503
ORA-06512: at "RISK_HISTORY.PKG_RHS_EMAIL_NOTIFY", line 206
ORA-06512: at "RISK_HISTORY.PKG_RHS_EMAIL_NOTIFY", line 414
ORA-06512: at line 2Can you please let me know if there is any issue with code or any upgrade issue ?
Regards,
Sunny
Edited by: k_17 on Oct 13, 2011 12:07 PMHi Helios,
Many thanks for your reply.
I am able to figure out the issue. In the code we have
l_analysis_report := l_analysis_report ||'<tr><td align="center">'|| curr_refresh.analysis_name
|| '</td><td align="center">' || curr_refresh.start_time || '</td><td align="center">'
|| curr_refresh.end_time || '</td><td align="center">'|| curr_refresh.RUN_TIME_SECS ||
'</td><td align="center">'|| curr_refresh.status ||
'</td> </tr>' || UTL_TCP.CRLF;
exit when length (l_analysis_report) > 32500;where "l_analysis_report VARCHAR2(32767);"
The issue is report has more characters, and when executing it throws the error " ORA-06502: PL/SQL: numeric or value error: character string buffer too small ".
Can you please let me know how to have more characters/data in the report. Will CLOB help if yes, please let me know how to use it.
Kindly suggest some options.
Regards,
Sunny -
Excel converts numeric values to date
Hi,
I have a JSP page which is sending data to excel.
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;filename=\"a.xls\"");
I am using codes above. But excel converts numeric values to date. for example I send "18.5" but excel convert it to "18.May". But when I add " " before the value there is no problem. But I dont want to use this
how can I fix it. Thanks in advance.hi,
the problem is not with your jsp encoding but with excel settings
enter the mathe-statistics block in your excel program change setting from date to numbers
that is all -
I use sqlplus to run a query statement with the SEM_MATCH function, and got the following error:
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "MDSYS.RDF_MATCH_IMPL_T", line 176
ORA-06512: at line 1
Could it be a bug in the MDSYS.RDF_MATCH_IMPLE_T? I find the MDSYS.RDF_MATCH_IMPL_T in Oracle SQL Developer, but the code is not readable.
Thanks.It is not likely to be a bug, but an issue of how SEM_MATCH is used. It would be best to contact Oracle Support with your sample SEM_MATCH query that causes the error.
Melli -
Report error: numeric or value error: character string buffer too small.
Full Details:
report error:
ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small.
MS Access runs this query but when I try to call a 'List of Values' in APEX that is in excess of 800 the error above displays. If I use a 'Pop Up' it will work but splits the list at 500. This is annoying and slower as I would like to be able to display all 850+ items in a named list of values. How do I increase the buffer size?
Kind Regards,
SteveSteve,
Could you please post the query you're using? You're most like hitting one of two possible varchar2 limitations. If you're calling the apex_item API in your SQL query to render the select list, then you're limited to 8000 characters, this your option values and HTML code used to render this. In this case using the "XL" versions of the APIs might help, e.g. select_list_from_query_xl, because those return CLOBs. If you're already using those or if you're using the built-in display type "select list", then you could potentially hit the 32k character limit of varchar2 values in PL/SQL. In that case the best alternative is using a popup LOV instead.
Regards,
Marc -
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 string buffer too sma
Hi Everybody,
Please, I Need of Your Help.
We have a table with the following characteristics:
PS_NAMES ( EMPLID VARCHAR2(33), NAME VARCHAR2(150), ... )
In this table a Trigger exists...
CREATE OR REPLACE TRIGGER TG_NAMES
BEFORE UPDATE ON PS_NAMES
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
Declare
vemplid ps_names.emplid%type;
vname ps_names.name%type;
Begin
vname := substr(:new.name,1,45);
end;
When the register is updated and the field PS_NAMES.NAMES has a bigger or equal content that 45 characters and with a character special, happen the error: "ORA- 06502: PL/SQL: numeric or value error: character string buffer too small".
This happens for any bigger or equal name the 45 characters and that it contains a character special.
Thanks,
Márcio Ap. Silveirapaddy wrote:
Hi,
I have check that part. The out parameter is getting populated correctly. I tried even removing the out parameter. Still it failed.And still you haven't provided all the details.
What about col1, col2, and the actual definition/declaration for ot_MY_OBJECT_TYPE?
How can we see any of the datatypes and where the issue could be if you don't bother to supply us with the information. Our crystal balls are broken and in the shop for fixing at the minute.
Maybe you are looking for
-
How do I change the default phone number for imessage on my MacBook Pro?
-
I have a tablemodel that holds the headers and the amount of rows and then inputted into a Jtable.what im trying to do is gather information in certain columns(ie integers) and add them up with the end result displaying the total at the end of the co
-
ME23N: Source of error 199(06)
Hello experts. I am taking care of giving access to people in my area but there is something I have searched for a few days now and I can't seem to get the hand on it. Actually, a user tries to modify a standard PO but each time she clicks on Modify,
-
Getting rid of leading whitespace in headings
Hi, I got some leading whitespace before my heading numbering, just curious if there's any way to get rid of those? I tried setting some negative values here and there in "Indents and Spacing" but that didn't work. I've attached a screenshot to expla
-
I am using the config man mib to get trap notifications when a change is made to the config of our Cisco switches. The trap OID is .1.3.6.1.4.1.9.9.43.2.0.1. I am receiving the traps fine, but I want to know if there is a way to include the usernam