Removing Null values from character string
Hi All,
Can i remove NULL values (hexadecimal - 0000) from character string. I am uploading a file from presentation layer (shared server) and getting NULL values in many fields which i want to remove.
please assist.
Thanks for you help..
Regards,
Mohaiyuddin
Hi,
Most likely, nobody needed it, but if anybody in future will need the solution for related problem - here's solution:
data: lv_nullchar type xstring value '0'.
shift lv_xstring right deleting trailing lv_nullchar in byte mode.
shift lv_xstring left deleting leading lv_nullchar in byte mode.
This hack deleting null chars in lv_xstring at end file and at begining of file. Works perfect for me, where i also worked with files.
Similar Messages
-
Hi All;
Below is my query and the output and i need to remove null values from the output
Any help regarding same is much appreciated
Thanks
; WITH CTE AS
select a.opportunityid,a.new_entrypoint_displayname,c.parentcustomerid,c.contactid,c.fullname,a.new_mainprogramme_idname,
a.new_subprogramme_idname,
a.owneridname,
a.new_dateofapplication,count(appt.activityid) as NoOfAppointments,
ap.scheduledstart,
ap.scheduleddurationminutes
from opportunity a
left join contact c on (c.contactid = a.parentcontactid)
inner join activitypointer ap on ( ap.regardingobjectid = c.contactid )
inner join appointment appt on (appt.activityid = ap.ActivityId)
where
appt.new_didmeetingtakeplace = 1
and appt.statecode = 1 and
(a.SCRIBE_DELETEDON is null and c.SCRIBE_DELETEDON is null and ap.SCRIBE_DELETEDON is null and appt.SCRIBE_DELETEDON is null)
group by a.opportunityid,a.new_entrypoint_displayname,c.parentcustomerid, c.contactid,c.fullname,a.owneridname,
a.new_mainprogramme_idname,a.new_subprogramme_idname,
a.new_dateofapplication,ap.scheduledstart,
ap.scheduleddurationminutes
union
select a.opportunityid,a.new_entrypoint_displayname,c.parentcustomerid,c.contactid,c.fullname,
a.new_mainprogramme_idname,a.new_subprogramme_idname,a.owneridname,
a.new_dateofapplication,count(appt.activityid) as NoOfAppointments,
ap.scheduledstart,
ap.scheduleddurationminutes
from opportunity a
left join contact c on (c.contactid = a.parentcontactid)
inner join activitypointer ap on (ap.regardingobjectid = a.opportunityid)
inner join appointment appt on (appt.activityid = ap.ActivityId)
where
appt.new_didmeetingtakeplace = 1
and appt.statecode = 1 and
(a.SCRIBE_DELETEDON is null and c.SCRIBE_DELETEDON is null and ap.SCRIBE_DELETEDON is null and appt.SCRIBE_DELETEDON is null)
group by a.opportunityid,a.new_entrypoint_displayname,c.parentcustomerid,c.contactid,a.owneridname,
a.new_mainprogramme_idname,a.new_subprogramme_idname,
c.fullname,a.new_dateofapplication,
ap.scheduledstart,
ap.scheduleddurationminutes
CTE2 As
select opportunityid,parentcustomerid,new_entrypoint_displayname,contactid,fullname,
new_mainprogramme_idname,new_subprogramme_idname,cte.owneridname,
ac.new_businessstartdate,new_dateofapplication,(NoOfAppointments),
case when ac.new_businessstartdate > = CTE.scheduledstart
then (CTE.scheduleddurationminutes) end as PreStartHours,
case when ac.new_businessstartdate < CTE.scheduledstart
then (CTE.scheduleddurationminutes) end as PostStartHours
pp.new_outputs,
case when po.new_outputsname = 'Pre Start Assist'
then 'Yes' else 'No' end as Precheck,
case when po.new_outputsname = 'Business Assist'
then 'Yes' else 'No' end as Buscheck
from CTE
join account ac on (ac.accountid = CTE.parentcustomerid)
join dbo.new_programmeoutput as po on (CTE.opportunityid = po.new_relatedopportunity)
join dbo.new_programmeprofile pp on (
po.new_mainprogrammeid = pp.new_mainprogrammeid and
po.new_subprogrammeid = pp.new_subprogrammeid
and pp.new_claimstartdate = po.new_claimdate
and pp.new_outputsname = po.new_outputsname)
where (ac.SCRIBE_DELETEDON is null)
group by opportunityid,parentcustomerid,new_entrypoint_displayname,contactid,fullname,ac.new_businessstartdate,new_dateofapplication,NoOfAppointments,
scheduledstart,new_mainprogramme_idname,new_subprogramme_idname,cte.owneridname,scheduleddurationminutes
select opportunityid,parentcustomerid,new_entrypoint_displayname,contactid,fullname,
new_mainprogramme_idname,new_subprogramme_idname,cte2.owneridname,
new_businessstartdate,new_dateofapplication,(NoOfAppointments),
PreStartHours, PostStartHours,po.new_programmeoutputid,
case when (new_outputsname) = 'Pre Start Assist'
then 'Yes' else 'No' end as Precheck,
case when (new_outputsname) = 'Business Assist'
then 'Yes' else 'No' end as Buscheck --po.*
from cte2
left join dbo.new_programmeoutput as po on (cte2.opportunityid = po.new_relatedopportunity)
where po.new_claimmonthidname is not null and po.statuscode_displayname = 'claimed'
group by opportunityid,parentcustomerid,new_entrypoint_displayname,contactid,fullname,
new_mainprogramme_idname,new_subprogramme_idname,cte2.owneridname,
new_businessstartdate,new_dateofapplication,(NoOfAppointments),
PreStartHours, PostStartHours,po.new_programmeoutputid,new_outputsname
--where new_claimmonthidname is not null --and CTE2.PreStartHours is not null and CTE2.PostStartHours is not null
Pradnya07i need to remove null values from the output
Hello,
What exactly do you mean with "remove", to filter the rows out from result set or to replace the null value by an other value e.g. 0? This can be done with the
ISNULL function:
ISNULL(case when ac.new_businessstartdate > = CTE.scheduledstart
then (CTE.scheduleddurationminutes) end, 0) as PreStartHours, ...
Olaf Helper
[ Blog] [ Xing] [ MVP] -
How to remove null values from list?
I had created a list in forms 6i and I am getting list values at run time using add_list_item function. The problem is I am getting null value at end of the list. In the property pallet I kept required yes and set the initial value but it is not removing null value. Can any one help me. Thank you.......
Hello
Sorry mis-read question on first reply.
1. Have you set a default value?
2. Is this default value still in your list?
3. What happens if you default the list's value to a value you know exists after you have populated it?
Cheers
Q
Message was edited by:
Q_STEPHENSON -
Remove null values from string array
Hi ,
I have a string array in a jsp page which I save some values inside. After I store the values I want to print only those who are not null. How can I do this? Is there a way to delete the null values?Thank you but because I am new in programming what do you mean to use continue. Can you explain it a little bit further?<%
//go through the array to check all the values
for(int i=0; i<array.length();i++) {
//If array is null, nothing happen
if(array==null){
//leave here blank; instead use continue like:
//this will skip the statements next to it, and increments the value of i in for loop and continues to execute the body of for loop.
//The same will be repeated till the last iteration.
continue;
//If array not null, then print value in a new line
else{
out.print(array+"<br>"); //don't change the logic here
%> -
How to remove NULL values from crosstab sheet in Viewer/Plus.
I created a worksheet as crosstab. The sheet shows blanks in Desktop when there is no data in the cell, but the same sheet is showing NULL in Viewer. Is there any solution to make NULL as 0 or blank in Viewer?
Thank you.Here you can find solution for this issue and its works for me......
Show null values as -
Removing null values from a chart
Hello,
I have a chart embedded in a Crystal report. (v.11.5). The data set essentially is a value per date, but because of the way the stored procedure is written, I have null values returned. Is there anyway to have the chart ignore null values?
Thanks
RayEven if the SP returns null values, in your record selection criteria couldnt you just say NOT ISNULL() and thus eliminate null values?
-
Removing duplicate values from selectOneChoice bound to List Iterator
I'm trying to remove duplicate values from a selectOneChoice that i have. The component binds back to a List Iterator on the pageDefinition.
I have a table on a JSF page with 5 columns; the table is bound to a method iterator on the pageDef. Then above the table, there are 5 separate selectOneChoice components each one of which is bound to the result set of the table's iterator. So this means that each selectOneChoice only contains vales corresponding to the columns in the table which it represents.
The selectOneChoice components are part of a search facility and allow the user to select values from them and restrict the results that are returned. The concept is fine and i works. However if i have repeating values in the selectOneChoice (which is inevitable given its bound to the table column result set), then i need to remove them. I can remove null values or empty strings using expression language in the rendered attribute as shown:
<af:forEach var="item"
items="#{bindings.XXXX.items}">
<af:selectItem label="#{item.label}" value="#{item.label}"
rendered="#{item.label != ''}"/>
</af:forEach>
But i dont know how i can remove duplicate values easily. I know i can programatically do it in a backing bean etc.... but i want to know if there is perhaps some EL that might do it or another setting that ADF gives which can overcome this.
Any help would be appreciated.
Kind RegardsHi,
It'll be little difficult removing duplicates and keeping the context as it is with exixting standard functions. Removing duplicates irrespective of context changes, we can do with available functions. Please try with this UDF code which may help you...
source>sort>UDF-->Target
execution type of UDF is Allvalues of a context.
public void UDF(String[] var1, ResultList result, Container container) throws StreamTransformationException{
ArrayList aList = new ArrayList();
aList.add(var1(0));
result.addValue(var1(0));
for(int i=1; i<var1.length; i++){
if(aList.contains(var1(i)))
continue;
else{
aList.add(var1(i));
result.addValue(var1(i));
Regards,
Priyanka -
How to remove gaps/null values from set of columns in a row
Im trying to implement a solution for removing null value columns from a row.
Basically in below example i have five codes and corresponding id's for that codes.What im trying to achive here is if
i have a null code then i have to move next not null code and id into its new location.
Example:
'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 So here cd4 and id4 should take positions of cd3 and id3.
Output should look like this
cd1 cd2 cd3 cd4 cd5 id1 id2 id3 id4 id5
A1 A2 A4 i1 i2 i4Any help would be highly appreciated for below example:
with temp_table as
(select 'A1'cd1,'A2'cd2,null cd3,'A4'cd4,null cd5,'i1'id1,'i2'id2,null id3,'i4' id4,null id5 from dual union all
select 'A11',null,null,'A44','A55','id11',null,null, 'id44','id55' from dual union all
select null,'A111',null,null,'A555',null,'id111',null, null,'id555' from dual union all
select 'A',null,null,'A1111','E55','id11',null,null, 'id111','id1111' from dual )
select * from temp_table;Edited by: GVR on Dec 1, 2010 8:27 AMI like case expression B-)
The same question of my homepage http://www.geocities.jp/oraclesqlpuzzle/7-81.html
with temp_table(cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5) as(
select 'A1' ,'A2' ,null,'A4' ,null ,'i1' ,'i2' ,null,'i4' ,null from dual union all
select 'A11',null ,null,'A44' ,'A55' ,'id11',null ,null,'id44' ,'id55' from dual union all
select null,'A111',null,null ,'A555',null ,'id111',null,null ,'id555' from dual union all
select 'A' ,null ,null,'A1111','E55' ,'id11',null ,null,'id111','id1111' from dual)
select
case when SumCD1 = 1 then CD1
when SumCD1+SumCD2 = 1 then CD2
when SumCD1+SumCD2+SumCD3 = 1 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 1 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 1 then CD5 end as CD1,
case when SumCD1+SumCD2 = 2 then CD2
when SumCD1+SumCD2+SumCD3 = 2 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 2 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 2 then CD5 end as CD2,
case when SumCD1+SumCD2+SumCD3 = 3 then CD3
when SumCD1+SumCD2+SumCD3+SumCD4 = 3 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 3 then CD5 end as CD3,
case when SumCD1+SumCD2+SumCD3+SumCD4 = 4 then CD4
when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 4 then CD5 end as CD4,
case when SumCD1+SumCD2+SumCD3+SumCD4+SumCD5 = 5 then CD5 end as CD5,
case when SumID1 = 1 then ID1
when SumID1+SumID2 = 1 then ID2
when SumID1+SumID2+SumID3 = 1 then ID3
when SumID1+SumID2+SumID3+SumID4 = 1 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 1 then ID5 end as ID1,
case when SumID1+SumID2 = 2 then ID2
when SumID1+SumID2+SumID3 = 2 then ID3
when SumID1+SumID2+SumID3+SumID4 = 2 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 2 then ID5 end as ID2,
case when SumID1+SumID2+SumID3 = 3 then ID3
when SumID1+SumID2+SumID3+SumID4 = 3 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 3 then ID5 end as ID3,
case when SumID1+SumID2+SumID3+SumID4 = 4 then ID4
when SumID1+SumID2+SumID3+SumID4+SumID5 = 4 then ID5 end as ID4,
case when SumID1+SumID2+SumID3+SumID4+SumID5 = 5 then ID5 end as ID5
from (select cd1,cd2,cd3,cd4,cd5,id1,id2,id3,id4,id5,
nvl2(cd1,1,0) as SumCD1,
nvl2(cd2,1,0) as SumCD2,
nvl2(cd3,1,0) as SumCD3,
nvl2(cd4,1,0) as SumCD4,
nvl2(cd5,1,0) as SumCD5,
nvl2(id1,1,0) as SumID1,
nvl2(id2,1,0) as SumID2,
nvl2(id3,1,0) as SumID3,
nvl2(id4,1,0) as SumID4,
nvl2(id5,1,0) as SumID5
from temp_table)
order by cd1,cd2,cd3,cd4,cd5;
CD1 CD2 CD3 CD4 CD5 ID1 ID2 ID3 ID4 ID5
A A1111 E55 null null id11 id111 id1111 null null
A1 A2 A4 null null i1 i2 i4 null null
A11 A44 A55 null null id11 id44 id55 null null
A111 A555 null null null id111 id555 null null nullMy SQL articles of OTN-Japan
http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/1/otnj-sql-image1.html
http://www.oracle.com/technology/global/jp/pub/jp/ace/sql_image/2/otnj-sql-image2.html -
Removing leading zeros from a string value
Hi All,
i have a Requirement like , i need remove leading zeros from a string value,
like , 00Raj00Shekar==>Raj00shekar,
how can i do this ?
if it is only with the custom functions ,where can add the fuction in Jdeveloper and SOA Middle ware?
Thanks in Advance,
RajHi Raj,
you can use below function to get the desired output in xsl.
<xsl:value-of select='translate(oraext:left-trim(translate(<inpString>,"0"," "))," ","0")'/>
HTH,
Regards,
Vikas Manchanda -
ORA-06502 nuemeric or value error: character string buffer too small
i am getting above error while doing
ORA-06502 nuemeric or value error: character string buffer too small
ORA-06512 itw_item_add_ch at line 17
plz urgent
CREATE OR REPLACE procedure itw_item_add_ch (header_id1 number, folio out varchar2,tariff out varchar2) as
cursor item_add(header_id1 number) is
SELECT
DISTINCT c.attribute4 item_tariff_no,
c.attribute5 item_folio
FROM OE_ORDER_LINES_ALL b,
mtl_system_items c
WHERE b.flow_status_code not in ('SHIPPED','FULFILLMENT','CLOSED')
and b.inventory_item_id = c.inventory_item_id
and b.ship_from_org_id = c.organization_id
and b.header_id = header_id1;
begin
for item_att in item_add(header_id1) loop
if folio is null then
folio := item_att.item_folio;
else
folio := folio||'/'||item_att.item_folio;
end if;
if tariff is null then
tariff := item_att.item_tariff_no;
else
tariff := tariff||'/'||item_att.item_tariff_no;
end if;
end loop;
end;if you want to find out which of your two variables are causing the problem, then use pragma exception_init along with "begin end exception" blocks within the loop.
I've removed the procedure specification, so you can test this in SQL Plus. You need to supply a number to the Header_id1 variable something like this:
set serveroutput on
begin
header_id1 number := 1; -- supply your own parameter here
cursor Item_Add(Header_Id1 number) is
select
distinct c.Attribute4 Item_Tariff_No
,c.Attribute5 Item_Folio
from Oe_Order_Lines_All b
,MTL_System_Items c
where b.Flow_Status_Code not in ('SHIPPED','FULFILLMENT','CLOSED')
and b.Inventory_Item_Id = c.Inventory_Item_Id
and b.Ship_From_Org_Id = c.Organization_Id
and b.Header_Id = Header_Id1;
exception TOO_MANY_CHARS;
exception TOO_TARIFF_CHARS;
pragma exception_init(TOO_MANY_CHARS, -6502);
l_Folio varchar2(32747);
l_Tariff varchar2(32747);
l_Folio_Continue boolean := true;
l_Tariff_Continue boolean := true;
begin
for Item_Att in Item_Add(Header_Id1) loop
if (l_Folio_Continue) then
begin
if l_Folio is null then
l_Folio := Item_Att.Item_Folio;
else
l_Folio := l_Folio||'/'||Item_Att.Item_Folio;
end if;
exception
when TOO_MANY_CHARS then
dbms_output.put_line ('Foilio has too many values ');
l_Folio_Continue := false;
exit;
end;
end if;
if (l_Tariff_Continue) then
begin
if l_Tariff is null then
l_Tariff := Item_Att.Item_Tariff_No;
else
l_Tariff := l_Tariff||'/'||Item_Att.Item_Tariff_No;
end if;
exception
when TOO_MANY_CHARS then
dbms_output.put_line ('Tariff has too many values ');
l_Tariff_Continue := false;
exit;
end if;
end loop;
end;
/this is untested, so please sort out any compilation errors yourself. -
How to replace NULL values from main table
Dear all,
I like to remove the NULL values from a main table field. Or the question is how to replace any part of the string field in MDM repository main table field.
e.g. I have a middle name field partly the value is NULL in some hundreds of records, I like to replace NULL values with Space
any recommendation.
Regards,
NaeemHi Naeem,
You can try using Workflows for automatically replacing NULLs with any specific value.
What you can do is: Create a workflow and set trigger action as Record Import, Record Create and Record Update. So, that whenever any change will occur in the repository; that workflow will trigger.
Now create an assignment expression for replacing NULLs with any specific value and use that assignment expression in your workflow by using Assign Step in workflow.
For exiting records, you will have to replace NULLs manually using the process given by Preethi else you can export those records in an Excel spreadsheet which have NULLs and then replace all NULLs with any string value and then reimport those records in your MDM repository.
Hope this will solve your problem.
Regards,
Varun
Edited by: Varun Agarwal on Dec 2, 2008 3:12 PM -
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 -
ORA-06502: numeric or value error: character string buffer too small
I have a stored proc with a parameter pio_med_rec_nbr patient.med_rec_nbr%TYPE
where patient.med_rec_nbr is a varchar2(12) .
character set is we8mswin1252 semantics are bytes
the stored proc retrieves max(med_rec_nbr) into nTmp( number) from a reference table
and does pio_med_rec_nbr := lpad(TO_CHAR(nTmp),12,'0')
which throws the ORA-06502: PL/SQL: numeric or value error: character string buffer too smallwhen I check the length, I get length(pio_med_rec_nbr) = 12
I can pass one digit or null but no more. Any idea what I need to do to debug this? I can do xxtmp := lpad(TO_CHAR(nTmp),12,'0') where xxtmp varchar2(255), so I know the assignments are okay.
Thanks,Do, pio_med_rec_nbr := trim(lpad(TO_CHAR(nTmp),12,'0') )
-
LOV - PL/SQL: numeric or value error: character string buffer too small
I have a field set to 'text field with autocomplete' and now that the data that is used for the LOV has increased dramatically it returns the following error 'ORA-06502: PL/SQL: numeric or value error: character string buffer too small'. Through trial and error I determined that if I restricted the number of rows returned using rownum < nnn then it would work. I then determined that I could use the trim and substring functions and remove the rownum restriction and it would work. Below is the LOV query. I have seen a couple of other posts similar to my problem and one of them asked if there was a way to increase the buffer size, but it was never answered. Is there a way, such as a parameter setting, that I could increase the buffer size for LOVs?
select distinct substr(trim(item_requested),1,50) d
from consolidated_components
order by 1
Thank you.Hi Scott
Thanks very much for jumping in here.
No, I didn't use the wizard to create the page. It was a manual operation but to tell you the truth the page has been changed so many times as I was working on different functionality and appearance that anything could have happened. I ended up having to manually create row processing processes and delete other processes, creating and hiding buttons, changing the way I'm passing item values, etc. I realize regardless of what I do as a developer the software should be able to handle all changes through it's interface but I've been in this business long enough to be realistic.
I also could have done something blatantly stupid as I continue to learn this product. For those of us not yet totally comfortable with all the web development technology, Javascript, AJAX, etc., but are asked to develop applications that work best using those technologies sometimes we make elementary blunders.
Thanks very much for your help. It is indeed appreciated.
-gary
Maybe you are looking for
-
Error -Container element 'ZBUS2081' is not used
Hi All, I have transported a workflow from one SAP installation to another. In the new System when i checked the transported workflow it's giving an error "Container 'ZBUS2081' is not in used. How to solve this problem . If I diagnose the problem its
-
Big Problem Downgrading From Leaopard!
Greetings, I was having big problems with iPhoto 6.06 in 10.5.1 and so decided to Archive and Install back to Tiger. After the installer finished I was asked to create a new user instead of seeing my usual log-in screen with all the users listed. Aft
-
If you have both the new X11 voice control remote AND a Yamaha RX-V663 receiver and IF you have been successful in getting the X11 to both turn the receiver on and off AND control its vloume, PLEASE share with me your secret. I have been a programmer
-
? control volume on the HTC Rhyme blue tooth mode?
How does one control the volume when the HTC Rhyme is in the charging dock station (blue tooth mode? I just purchased an HTC Rhyme and unfortunately at night need to receive calls while the Rhyme is in it's docking station the ring is obnoxiously lo
-
8600plus (OS X) will not accept print request from the registered add at hpconnect
HP 8600 plus OS X, will not accept a print request from the registered address at hpconnect but will print a request from the address that comes on the printer. I have tried to change the factory settings and i get a message from Hp connect that ther