How to serch a character string in a BLOB (case insensitive)
Hi
Could somebody help me with this please.
I need to search for the existance of a character string in a BLOB column of a table.
I can do it in the below way.
PROCEDURE search (in_search VARCHAR2) IS
lob_doc BLOB;
Pattern VARCHAR2(30);
Position INTEGER := 0;
Offset INTEGER := 1;
Occurrence INTEGER := 1;
BEGIN
Pattern := utl_raw.cast_to_raw(in_search);
SELECT BLOB_CONTENT INTO lob_doc
FROM documents WHERE ein = '702265981';
DBMS_LOB.OPEN (lob_doc, DBMS_LOB.LOB_READONLY);
Position := DBMS_LOB.INSTR(lob_doc, Pattern, Offset, Occurrence);
IF Position = 0 THEN
DBMS_OUTPUT.PUT_LINE('Pattern not found');
ELSE
DBMS_OUTPUT.PUT_LINE('The pattern occurs at '|| position);
END IF;
DBMS_LOB.CLOSE (lob_doc);
END search;
But the problem is, it does a case sensitive search.
I need a case-insensitive search
Thanks in Advance
The best way would be to use Oracle Text.
However, if you want a quick and dirty solution, I would convert to CLOB, and (assuming 9i) you can use LOWER on the CLOB.
Click on this link for a blob_to_clob function.
Re: BLOB to CLOB?
Similar Messages
-
How to change one character string to char
hi all
i got string but only one character
i got 1,2,3,E
since i got 'E' here..........
i need to convert to it to character....
but how to change it.... i only know String to integer using Integer.parseInt() method....
but i don't know about char...................You should really check the API first:
http://java.sun.com/j2se/1.4.2/docs/api/index.html
Take a look at String.charAt(int index) method.
/Kaj -
Hi Everyone
In the block diagram of the posted VI, thru serial comm, byte #2 is either 00 or 01 (Hex). This byte should dictate which case to execute. If Hex value = 00 executes case #1, If Hex value = 01 executes case #2. If neither, nothing should execute.
How can I do this? I am fairly new to LabVIEW any feedback is highly appreciated.
Thanks
Mahir
Solved!
Go to Solution.
Attachments:
testing whole string Bank A & B.vi 24 KBeasier to just wire in the integer to the case structure rather than convert to string.
Then just go up to the case selector and type what you want.
Paul <--Always Learning!!!
sense and simplicity.
Browse my sample VIs? -
How to find number of characters in a character string
Hi,
Can anyone please tell me about how to find the number of characters in a character string type variable.
Reagards,
Sivahi,
Use STRLEN for Calculating String Length..
Assign it to integer variable for Further Use.Suppse u need to find string length for "hai".. this piece of code will help u
data: var type string value 'hai',
len type i.
len = strlen(var).
write len. -
How to replace a character in a string with blank space.
Hi,
How to replace a character in a string with blank space.
Note:
I have to change string CL_DS_1===========CM01 to CL_DS_1 CM01.
i.e) I have to replace '=' with ' '.
I have already tried with <b>REPLACE ALL OCCURRENCES OF '=' IN temp_fill_string WITH ' '</b>
Its not working.Hi,
Try with this..
call method textedit- >replace_all
exporting
case_sensitive_mode = case_sensitive_mode
replace_string = replace_string
search_string = search_string
whole_word_mode = whole_word_mode
changing
counter = counter
exceptions
error_cntl_call_method = 1
invalid_parameter = 2.
<b>Parameters</b> <b> Description</b> <b> Possible values</b>
case_sensitive_mode Upper-/lowercase false Do not observe (default value)
true Observe
replace_string Text to replace the
occurrences of
SEARCH_STRING
search_string Text to be replaced
whole_word_mode Only replace whole words false Find whole words and
parts of words (default
value)
true Only find whole words
counter Return value specifying how
many times the search string
was replaced
Regards,
Jayaram... -
How to use execute immediate for character string value 300
how to use execute immediate for character string value > 300 , the parameter for this would be passed.
Case 1: When length = 300
declare
str1 varchar2(20) := 'select * from dual';
str2 varchar2(20) := ' union ';
result varchar2(300);
begin
result := str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || ' ';
dbms_output.put_line('length : '|| length(result));
execute immediate result;
end;
/SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
length : 300
PL/SQL procedure successfully completed.
Case 2: When length > 300 ( 301)
SQL> set serveroutput on size 2000;
declare
str1 varchar2(20) := 'select * from dual';
str2 varchar2(20) := ' union ';
result varchar2(300);
begin
result := str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || str2 ||
str1 || ' ';
dbms_output.put_line('length : '|| length(result));
execute immediate result;
end;
/SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 6result varchar2(300);Answer shouldn't be here ? In the greater variable ?
Nicolas. -
How to convert character string into ascii format correctly
dear all
I'm using encryption technique in my application(oracle formas 6i). character stream convert to the ascii format and add some numeric value and again convert to the character format
>>>>
here I'm using ASCII and CHR functions.
>>>>
.net program also using same algorithm to encrypt this password.....finally both the character strings are not equel.(This happens if the character string's ascii value greater than 127. otherwise both are equel).
pls give me a solution for this
thanks and regards
buddhikehir dear
do u want to encrypt & dcrypt your password.which version of oracle you are using
first store these procedure in Oracle Databases: dbms_obfuscation_toolkit, dbms_crypto, Transparent Data Encryption
now u can use these procedure to encrypt & dcrypt your password
if you any query about those procedures you can ask me
best regard
amk -
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. -
How to search a special string in txt file and return it's position in txt file?
How to search a special string in txt file and return it's position in txt file?
I just posted a solution for a similar question here: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=362699#M362699
The top portion can search for the location of a string, while the bottom portion is to locate the position of a character. Both can search for a character.
The position of the character within the file is displayed in the indicator(s).
R -
ORA-06502 (character string buffer too small) on import application via script
Running apex 4.2.2.00.11
oracle 10.2.0.5
I'm using a script to import my development application to a few production applications.
It worked great on apex 4.1.1, but now I get an 'ORA-06502 PL/SQL numeric of value error: character string buffer too small'
In the command window, I see that the script fails after it starts on the plugins.
My question: is this a bug in 4.2.2?
I could be a incompatible plugin, but how can I found out which plugin?
My script is quite simple:
In a command window I run
sqlplus SCHEMA/PASSWORD@SPIEU10 @_IMPORT_F102.sql
The script is
declare
l_workspace_id number;
begin
-- determine the workspace id for the workspace FM in the target system
select workspace_id into l_workspace_id from apex_workspaces where workspace = 'BY_APEX_SHARED';
-- set the context for the target workspace
apex_application_install.set_workspace_id( l_workspace_id );
-- override the original application id 102
apex_application_install.set_application_id ( 102 );
-- set a different application name and alias, it should be unique within an APEX instance
apex_application_install.set_application_alias( 'MY_ALIAS' );
apex_application_install.set_application_name( 'MY_APP_NAME' );
-- Use fixed offset
apex_application_install.set_offset( p_offset => 0);
-- override the original parsing schema FM with a different value
apex_application_install.set_schema( 'BY_SCHEMA' );
end;
-- install the original application export, now the values for the workspace
@f102.sql
exit;
Error message from command window:
...ui types
...plugins
begin
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 3
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64
bit Production
With the Partitioning, Data Mining and Real Application Testing optionsListAGG throws an ORA-01489 for varchar2 > 4000 bytes
OP has an ORA-06502 --> the IR is running into a 4k/32k limit.
quick solution: wrap USER_COMMENTS ListAGG in a substr( ...., 1, 4000)
Longer solution, use a subquery to modify the comments based on ROW_NUMBER() (ie after nth row, change it to NULL)
with
-- simulating data
t as (select task_id, sysdate - lv as date_entered
,round(dbms_random.value(1,24)) hours
, '-*' || lv || '.' || task_id || '*-' as user_comments
from ( select level as task_id from dual connect by level <=10 ), (select level lv from dual connect by level < 1000)
-- modify data
modified_data as (
select task_id, hours, date_entered
,case
when row_number() over (partition by task_id order by date_entered desc) < 5
then user_comments
else null
end USER_COMMENTS
from t)
select task_id, sum(hours) total_hours,
listagg( user_comments ) within group (order by date_entered desc)
|| case when count(*) >= 5 then '! MORE COMMENTS !' else null end
as user_comments
from modified_data
group by task_id; -
How to insert special character from Oracle form builder 10g
Dear all,
I need help. how to insert special character like 'Superscript or Subscript ' from oracle form builder 10g. I had try in Oracle form builder 6i with press ALT+ASCII code in the text item and it work, but in the oracle form builder 10g this method doesn't work... would you like to help me...somebody please...
Best Regard,
Dedy P.T.What do you mean by insert ... from Forms Builder? Do you mean you want to add it as text in a string of pl/sql code or as part of boiler plate text (label) or a value on the Property Palette?
For special characters you would need set NLS_LANG to something that would support the characters you want to use. For the Builder to see the change, you would need to set NLS_LANG to something like:
NLS_LANG=AMERICAN_AMERICA.UTF8
This can be done in the Windows Registry or system. As I mentioned, this will only apply to the Builder and will have nothing to do with a running form. For running forms you would need to set this in default.env. As for things like super and sub scripts, these are font formats and not necessarily characters. For the most part, I don't believe these are supported in Forms. -
Character string buffer too small (select list query based LOV)
Hi,
Using the select list query based LOV with a select witch is too big, you get this error.
report error:
ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
When using the Popup LOV query based LOV) then it works nice.
Can that be solved somehow?
With the Popup LOV the return value is displayed in stead of the description.Hi Andy,
How do I incorporate your suggestion on a report ?
Example : I have
select apex_item.display_and_save(1,column1,5) col1,
apex_item.display_and_save(2,column2,5) col2 ,
apex_item.popup_from_query(3, emp_name, 'select user_name, name empname from table2) col3
Table 2 is a long list , and I'm getting string buffer too small due to this.
Your suggestion with HTP is good but I'm not sure how to implement it for reports as I'll like the user to change the values with the select_list.
I'm not using forms as they want mulit-record on the same page.
Hope to hear back from you soon.
Thanks very much. -
How to handle national character set datatypes in oracle?
Hi
Can anyone tell me how to handle national character set datatypes in oracle?
Thanks in advanceAnd for data manipulation, append "N" the literal values being used in the command.
The "N" indicates that the string is to be treated as Unicode Text.
For Example: insert into TableName (ColumnName) values (N'ValueToBeInserted'); -
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 -
ASCII character/string processing and performance - char[] versus String?
Hello everyone
I am relative novice to Java, I have procedural C programming background.
I am reading many very large (many GB) comma/double-quote separated ASCII CSV text files and performing various kinds of pre-processing on them, prior to loading into the database.
I am using Java7 (the latest) and using NIO.2.
The IO performance is fine.
My question is regarding performance of using char[i] arrays versus Strings and StringBuilder classes using charAt() methods.
I read a file, one line/record at a time and then I process it. The regex is not an option (too slow and can not handle all cases I need to cover).
I noticed that accessing a single character of a given String (or StringBuilder too) class using String.charAt(i) methods is several times (5 times+?) slower than referring to a char of an array with index.
My question: is this correct observation re charAt() versus char[i] performance difference or am I doing something wrong in case of a String class?
What is the best way (performance) to process character strings inside Java if I need to process them one character at a time ?
Is there another approach that I should consider?
Many thanks in advance>
Once I took that String.length() method out of the 'for loop' and used integer length local variable, as you have in your code, the performance is very close between array of char and String charAt() approaches.
>
You are still worrying about something that is irrevelant in the greater scheme of things.
It doesn't matter how fast the CPU processing of the data is if it is faster than you can write the data to the sink. The process is:
1. read data into memory
2. manipulate that data
3. write data to a sink (database, file, network)
The reading and writing of the data are going to be tens of thousands of times slower than any CPU you will be using. That read/write part of the process is the limiting factor of your throughput; not the CPU manipulation of step #2.
Step #2 can only go as fast as steps #1 and #3 permit.
Like I said above:
>
The best 'file to database' performance you could hope to achieve would be loading simple, 'known to be clean', record of a file into ONE table column defined, perhaps, as VARCHAR2(1000); that is, with NO processing of the record at all to determine column boundaries.
That performance would be the standard you would measure all others against and would typically be in the hundreds of thousands or millions of records per minute.
What you would find is that you can perform one heck of a lot of processing on each record without slowing that 'read and load' process down at all.
>
Regardless of the sink (DB, file, network) when you are designing data transport services you need to identify the 'slowest' parts. Those are the 'weak links' in the data chain. Once you have identified and tuned those parts the performance of any other step merely needs to be 'slightly' better to avoid becoming a bottleneck.
That CPU part for step #2 is only rarely, if every the problem. Don't even consider it for specialized tuning until you demonstrate that it is needed.
Besides, if your code is properly designed and modularized you should be able to 'plug n play' different parse and transform components after the framework is complete and in the performance test stage.
>
The only thing that is fixed is that all input files are ASCII (not Unicode) characters in range of 'space' to '~' (decimal 32-126) or common control characters like CR,LF,etc.
>
Then you could use byte arrays and byte processing to determine the record boundaries even if you then use String processing for the rest of the manipulation.
That is what my framework does. You define the character set of the file and a 'set' of allowable record delimiters as Strings in that character set. There can be multiple possible record delimiters and each one can be multi-character (e.g. you can use 'XyZ' if you want.
The delimiter set is converted to byte arrays and the file is read using RandomAccessFile and double-buffering and a multiple mark/reset functionality. The buffers are then searched for one of the delimiter byte arrays and the location of the delimiter is saved. The resulting byte array is then saved as a 'physical record'.
Those 'physical records' are then processed to create 'logical records'. The distinction is due to possible embedded record delimiters as you mentioned. One logical record might appear as two physical records if a field has an embedded record delimiter. That is resolved easily since each logical record in the file MUST have the same number of fields.
So a record with an embedded delimiter will have few fields than required meaning it needs to be combined with one, or more of the following records.
>
My files have no metadata, some are comma delimited and some comma and double quote delimited together, to protect the embedded commas inside columns.
>
I didn't mean the files themselves needed to contain metadata. I just meant that YOU need to know what metadata to use. For example you need to know that there should ultimately be 10 fields for each record. The file itself may have fewer physical fields due to TRAILING NULLCOS whereby all consecutive NULL fields at the of a record do not need to be present.
>
The number of columns in a file is variable and each line in any one file can have a different number of columns. Ragged columns.
There may be repeated null columns in any like ,,, or "","","" or any combination of the above.
There may also be spaces between delimiters.
The files may be UNIX/Linux terminated or Windows Server terminated (CR/LF or CR or LF).
>
All of those are basic requirements and none of them present any real issue or problem.
>
To make it even harder, there may be embedded LF characters inside the double quoted columns too, which need to be caught and weeded out.
>
That only makes it 'harder' in the sense that virtually NONE of the standard software available for processing delimited files take that into account. There have been some attempts (you can find them on the net) for using various 'escaping' techniques to escape those characters where they occur but none of them ever caught on and I have never found any in widespread use.
The main reason for that is that the software used to create the files to begin with isn't written to ADD the escape characters but is written on the assumption that they won't be needed.
That read/write for 'escaped' files has to be done in pairs. You need a writer that can write escapes and a matching reader to read them.
Even the latest version of Informatica and DataStage cannot export a simple one column table that contains an embedded record delimiter and read it back properly. Those tools simply have NO functionality to let you even TRY to detect that embedded delimiters exist let alone do any about it by escaping those characters. I gave up back in the '90s trying to convince the Informatica folk to add that functionality to their tool. It would be simple to do.
>
Some numeric columns will also need processing to handle currency signs and numeric formats that are not valid for the database inpu.
It does not feel like a job for RegEx (I want to be able to maintain the code and complex Regex is often 'write-only' code that a 9200bpm modem would be proud of!) and I don't think PL/SQL will be any faster or easier than Java for this sort of character based work.
>
Actually for 'validating' that a string of characters conforms (or not) to a particular format is an excellent application of regular expressions. Though, as you suggest, the actual parsing of a valid string to extract the data is not well-suited for RegEx. That is more appropriate for a custom format class that implements the proper business rules.
You are correct that PL/SQL is NOT the language to use for such string parsing. However, Oracle does support Java stored procedures so that could be done in the database. I would only recommend pursuing that approach if you were already needing to perform some substantial data validation or processing the DB to begin with.
>
I have no control over format of the incoming files, they are coming from all sorts of legacy systems, many from IBM mainframes or AS/400 series, for example. Others from Solaris and Windows.
>
Not a problem. You just need to know what the format is so you can parse it properly.
>
Some files will be small, some many GB in size.
>
Not really relevant except as it relates to the need to SINK the data at some point. The larger the amount of SOURCE data the sooner you need to SINK it to make room for the rest.
Unfortunately, the very nature of delimited data with varying record lengths and possible embedded delimiters means that you can't really chunk the file to support parallel read operations effectively.
You need to focus on designing the proper architecture to create a modular framework of readers, writers, parsers, formatters, etc. Your concern with details about String versus Array are way premature at best.
My framework has been doing what you are proposing and has been in use for over 20 years by three different major nternational clients. I have never had any issues with the level of detail you have asked about in this thread.
Throughout is limited by the performance of the SOURCE and the SINK. The processing in-between has NEVER been an issu.
A modular framework allows you to fine-tune or even replace a component at any time with just 'plug n play'. That is what Interfaces are all about. Any code you write for a parser should be based on an interface contract. That allows you to write the initial code using the simplest possible method and then later if, and ONLY if, that particular module becomes a bottlenect, replace that module with one that is more performant.
Your intital code should ONLY use standard well-established constructs until there is a demonstrated need for something else. For your use case that means String processing, not byte arrays (except for detecting record boundaries).
Maybe you are looking for
-
Poor follow up from Customer Service
Customer Service has very poor follow up. Multiple times I have called with phone not properly working and the initial person was not able to help. After an hour of being on the phone with him he said he would have to have someone else call me back.
-
IPhoto slideshow in iDVD project
I have some questions on problems creating a iDVD project of an iPhoto slideshow: 1. Is it possible (how ?) to create buttons for scene selections, as in iMovie ? My project contains one continuous slideshow (942 still pictures) which I want to divid
-
When importing numerical in order tracks some tracks are out of sequence
When I import into iTunes my accompaniment CDs which have multiple tracks in numerical order, some tracks are out of sequence in the "Date Added" sort order. This has been happening for quite sometimes with different versions and even on different c
-
I need help with a personal site that would be my Safari start page. I would like to have layers of HTML snippets that when clicked, would change the layer of the page to make that HTML snippet the top layer, so like dynamic tabs that would not chang
-
How to install Jetspeed2.0 with the help of installer
Dear All, i am having Jetspeed2.0-MultiDb-install.jar file for Jetspeed2.0 install i tried to run it with the following command and get the exception everytime i am attaching the details of the errors along with the problem can anyone please let me k