Performance of the Insertion
Hi,
I have a procedure which inserts 3 million Records into the table.
Whole insertion process is taking 15-17 minutes .
Oracle version :- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit
I have tried using Bulk Collect with Limit 50,000 which is not making much difference as I cannot use forall for insertion.
I have also tried with Insert select which again is not making difference .
Can you please suggest me what else I can try to improve the Performance .
Befor insertion I am Disabling the primary key of the table.
For your reference I am giving code below.
--create statement
create table tmp_tab
tmp_id NUMBER,
tmp_cod VARCHAR2(32),
tmp_date DATE,
tmp_num NUMBER,
tmp_num1 NUMBER
create index Idx_tmp on tmp_tab(tmp_id,tmp_num1);
create table hs_bad
bad_seq_id NUMBER,
bad_id NUMBER,
bad_cod VARCHAR2(32),
bad_date DATE,
bad_num NUMBER,
bad_num1 NUMBER,
bad_err_code VARCHAR2(20),
bad_message VARCHAR2(500)
create table hs_corr
corr_Seq_id NUMBER not null,
corr_id NUMBER,
corr_cod VARCHAR2(32),
corr_date DATE,
corr_num NUMBER,
corr_num1 NUMBER
alter table hs_corr add constraint corr_pk primary key (corr_Seq_id);
create sequence seq_bad_id;
create sequence seq_corr_id;
----Block which inserts
declare
l_err_code varchar2(10);
l_err_message varchar2(10);
l_err_rec number ;
l_ok_rec number ;
begin
for l_cur in (select tmp_id,
tmp_cod,
tmp_date,
tmp_num,
tmp_num1,
count(*) over(partition by tmp_cod, tmp_date) cnt
from (select distinct tmp_id,
tmp_cod,
tmp_date,
tmp_num,
tmp_num1
from tmp_tab
where tmp_id = 4436
and (tmp_num1 <> 0 or tmp_num1 is null))) loop
if l_cur.tmp_num1 is null or l_cur.tmp_num1 <> 1 or
l_cur.tmp_date is null or l_cur.tmp_num is null or
l_cur.tmp_cod is null or l_cur.cnt <> 1 then
if l_cur.tmp_cod is null then
l_err_code := '00020';
l_err_message := 'error 20';
elsif (l_cur.tmp_num is null or l_cur.tmp_date is null) then
l_err_code := '00023';
l_err_message := 'error 23';
elsif (l_cur.tmp_num1 is null or l_cur.tmp_num1 <> 1) then
l_err_code := '00024';
l_err_message := 'error 24';
elsif l_cur.cnt <> 1 then
l_err_code := '00025';
l_err_message := 'error 25';
end if;
insert into hs_bad
(bad_seq_id,
bad_id,
bad_cod,
bad_date,
bad_num,
bad_num1,
bad_err_code,
bad_message)
values
(seq_bad_id.nextval,
l_cur.tmp_id,
l_cur.tmp_cod,
l_cur.tmp_date,
l_cur.tmp_num,
l_cur.tmp_num1,
l_err_code,
l_err_message);
l_err_rec := l_err_rec + 1;
else
insert into hs_corr
(corr_Seq_id, corr_id, corr_cod, corr_date, corr_num, corr_num1)
values
(seq_corr_id.nextval,
l_cur.tmp_id,
l_cur.tmp_cod,
l_cur.tmp_date,
l_cur.tmp_num,
1);
l_ok_rec := l_ok_rec + 1;
end if;
end loop;
commit;
end;
---insert statement for tmp_bad (I have 3 million such records for reference I am giving 22 records)
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('26-03-2014', 'dd-mm-yyyy'), 1.0029237, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('25-03-2014', 'dd-mm-yyyy'), 1.0009655, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('24-03-2014', 'dd-mm-yyyy'), 1.0036647, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('21-03-2014', 'dd-mm-yyyy'), 1.0007618, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('20-03-2014', 'dd-mm-yyyy'), 0.99546863, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('19-03-2014', 'dd-mm-yyyy'), 0.99925022, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('18-03-2014', 'dd-mm-yyyy'), 1.0008772, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('17-03-2014', 'dd-mm-yyyy'), 0.99927982, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('14-03-2014', 'dd-mm-yyyy'), 0.99545721, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('13-03-2014', 'dd-mm-yyyy'), 1.0035274, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('12-03-2014', 'dd-mm-yyyy'), 1.0028031, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('11-03-2014', 'dd-mm-yyyy'), 0.99607308, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('10-03-2014', 'dd-mm-yyyy'), 1.005378, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('07-03-2014', 'dd-mm-yyyy'), 1.0011711, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('06-03-2014', 'dd-mm-yyyy'), 0.99464087, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('05-03-2014', 'dd-mm-yyyy'), 1.00101, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('04-03-2014', 'dd-mm-yyyy'), 0.99421354, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('03-03-2014', 'dd-mm-yyyy'), 1.0110608, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('28-02-2014', 'dd-mm-yyyy'), 0.98747385, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('27-02-2014', 'dd-mm-yyyy'), 1.0049316, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('26-02-2014', 'dd-mm-yyyy'), 1.0042771, 1);
insert into tmp_tab (tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
values (4436, 'ABCD84043451', to_date('25-02-2014', 'dd-mm-yyyy'), null, 1);
commit;
Thanks in advance
The hs_bad part:
INSERT INTO hs_bad (bad_seq_id, bad_id, bad_cod, bad_date, bad_num, bad_num1, bad_err_code, bad_message)
SELECT seq_bad_id.nextval AS bad_seq_id
,tmp_id
,tmp_cod
,tmp_date
,tmp_num
,tmp_num1
,TO_CHAR(error_num,'FM00000')
,NULLIF('error ' || TO_CHAR(error_num),'error ')
from ( SELECT tmp_id
,tmp_cod
,tmp_date
,tmp_num
,tmp_num1
,CASE
WHEN tmp_cod IS NULL THEN 20
WHEN tmp_num IS NULL OR tmp_date IS NULL THEN 23
WHEN tmp_num1 IS NULL OR tmp_num1 <> 1 THEN 24
WHEN cnt <> 1 THEN 25
END AS error_num
FROM (SELECT tmp_id
, tmp_cod
, tmp_date
, tmp_num
, tmp_num1
, COUNT(*) over(partition BY tmp_cod, tmp_date) cnt
FROM tmp_tab
WHERE tmp_id = 4436
AND (tmp_num1 <> 0 OR tmp_num1 IS NULL)
GROUP BY tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
WHERE tmp_num1 IS NULL
OR tmp_num1 <> 1
OR tmp_date IS NULL
OR tmp_num IS NULL
OR tmp_cod IS NULL
OR cnt <> 1);
the hs_corr part:
INSERT INTO hs_corr (corr_Seq_id, corr_id, corr_cod, corr_date, corr_num, corr_num1)
SELECT seq_corr_id.nextval AS bad_seq_id
,tmp_id
,tmp_cod
,tmp_date
,tmp_num
,tmp_num1
FROM (SELECT tmp_id
, tmp_cod
, tmp_date
, tmp_num
, tmp_num1
, COUNT(*) over(partition BY tmp_cod, tmp_date) cnt
FROM tmp_tab
WHERE tmp_id = 4436
AND (tmp_num1 <> 0 OR tmp_num1 IS NULL)
GROUP BY tmp_id, tmp_cod, tmp_date, tmp_num, tmp_num1)
WHERE NOT ( tmp_num1 IS NULL
OR tmp_num1 <> 1
OR tmp_date IS NULL
OR tmp_num IS NULL
OR tmp_cod IS NULL
OR cnt <> 1);
hth
Similar Messages
-
How to increase the performance of an insert query?
Hi,
I am using oracle database for our application where we executes one insert query and need the performance of 300 insert queries to be executed per second.
As of now we are getting only 30/sec.We are not knowing how to tune the database for getting this performance.
we are doing all this though C programming under both linux and solaris environment.
Can u guide me in this issue.
Regards,
vamsi krishnaPerformance tuning issue is not something you can get a straight forward answer for.
You need to look at various aspects of the system to get close to or increase the performance of your application. Tuning just the database might not give you want you want.
So, you need to look at the Application codes, Mermory, Disk IO, etc. Have a look at the Performance Tuning Guide from the Oracle Documentation Library for your Oracle Release and Operating System
http://www.oracle.com/technology/documentation/index.html#previous -
To improve the system performance of the code
Please help me to improve the system performance of the following program. its very urgent
report zsdr0125
no standard page heading
* LINE-SIZE 170 " SIR 061880
line-size 210 " SIR 061880
line-count 58
message-id zz.
** Report header ******************************************************
** Report name: Activity Costing Report
** Report id: RO-01148
** Designed/Coded. Tori Chandler. Reporting Team.
** Date: March 01, 2000.
** Original SIR: 016113
** Application Area: V - Sales & Distribution (OTC)
** Correction/Transport: D10K951579
** Description: It is normal business practice for logistics
** operations to charge business units for the activity
** incurred on their behalf. This is consistent with
** activity based costing principles between BU and
** shared resources. The activities involved are picking
** storage, shipping and receiving. The purpose of this
** report is to provide data for the first 3.
** QRB2 - 03/13/2000 - Tracy, Antoine, Christian, Tori
** History:
* 06/14/2001 SIR 032383 CTS Antoine Dailly
* A plant (WERKS) can have several Distrib points (VSTEL)
* SIGN = 032383
* Modification History:
* Date Modified by SIR CTS Description
*11/14/2001 J.CAMPION 034606 D10K979189 Logistics Activity report
* Logistics Activity reports
* We added fields ship to customer and country and we also make another
* total
* QRB2 Tracy L. Obrien
* Modification History:
* Date Modified by SIR CTS Description
*11/14/2001 J.CAMPION 37838 D10K982890 Select only
* material type HALB
*06/12/2002 T OBrien 38784 D10K988181
* Allow option to get material weight from Master data or
* from the delivery.
* Modified by SIR CTS Date
* Jim Harwood 42730 D10K993119 10 Oct 2002
* Description: Code amended to default the Goods Issue Date range to
* the previous month. Also amended to print out the Select Options.
* Modified by SIR CTS Date
* Jim Harwood 44381 D10K994598 18 Nov 2002
* Description: Correct date range processing. APPEND statement added
* so that record is added ot internal table S_WADAT. Also S_VKORG
* removed as it was NO DISPLAY and nothing was assigned to it. It's use
* in an SQL call may be causing the wrong optimization.
* Modified by SIR CTS Date
* Tori Chandler 45567 D10K995875 03 Jan 2003
* Description: Correct reporting of weights for non-pickable items
* when the Material Master Data radiobutton is selected. Also found
* from SIR 37838, that material type is hardcoded on the LIPS. I
* created a new select option and the person needing the report
* can control if they want only HALB or all line items. Also,
* because of this the delivery weight is obtain from header,
* changing to accumulate from LIPS to match which lines are selected
* QRB2: 1/15/2003: Eileen, Jerome and Tori
*{ INSERT D11K901833 1
* Modified by Sir CTS Date
* Sue Kastan 48712/054042 D11K901833 28 Aug, 2003
* Fix overcounting of records from LIPS
*} INSERT
* Modified by SIR CTS Date *
* Vijay Andea 061880 D11K918628 04/20/2006 *
* D11K946194 *
* Description: Enhence ZSDR0125 Activity Cost Driver Report to allow *
* Analysis by Product Groupings. *
*} INSERT
* Modified by SIR CTS Date *
* Prakash Arunachalam 091510 D11K950288 09/26/2006 *
* Description: Correct Activity Cost report - material weight *
* calculation *
* Modified by SIR CTS Date *
* Murali Krishna 301978 D50K903293 01/20/2008
* Description: Improve the system performance of this report and
* clean-up of code into various form routine
* Table declaration.
tables: likp, " SD Document: Delivery Header Data
lips, " SD document: Delivery: Item data
vepo, " SD Document: Shipping Unit Item (Content)
vekp, " SD Document: Shipping Unit Header
knvv, " Customer Master Sales Data
kna1, " General Data in Customer Master SIR 34606
marm, " Units of Measure
mara, " Material Master: General Data SIR 38784
t001l, " Stge locs
t001k, " Valuation area
tvswz, " Shipping Points per Plant
t134, " Material types
z0234. " Alternative Unit of Measure
*** Selection screen.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like t001l-werks obligatory memory id wrk.
select-options: s_lgort for t001l-lgort,
* S_VKORG FOR TVKO-VKORG NO-DISPLAY ," SIR 34606, 42730
* S_WADAT FOR LIKP-WADAT_IST OBLIGATORY NO-EXTENSION,
s_wadat for likp-wadat_ist no-extension, " SIR 42730
s_mtart for t134-mtart, " SIR 45567
s_lfart for likp-lfart no-display no intervals.
selection-screen skip 2.
selection-screen comment 1(21) text-002. " SIR 38784
parameters: p_delwt radiobutton group grp1, " SIR 38784
p_mstwt radiobutton group grp1. " SIR 38784
*--------------------------------------------------*Start of SIR 061880
selection-screen skip 2.
selection-screen comment 1(21) text-006.
parameters: p_voldl radiobutton group 2, " Volume from Delivery
p_volmd radiobutton group 2. " Volume from Master Data
*-----------------------------------------------------End of SIR 061880
selection-screen end of block b1.
*--------------------------------------------------*Start of SIR 061880
selection-screen begin of block b2 with frame title text-007.
select-options: s_cbuun for knvv-kvgr1 no intervals, " Customer BU
s_mbuun for mara-prdha+1(2) no intervals, " Material BU
s_lobus for mara-prdha+3(3) no intervals, " LOB
s_pac1 for mara-prdha+6(3) no intervals. " PAC1
selection-screen end of block b2.
*----------------------------------------------------*End of SIR 061880
*---Type Declaration for Internal Tables------------------------------*
types: begin of t_likp,
vbeln like likp-vbeln, " delivery
vstel like likp-vstel, " shipping point
lfart like likp-lfart, " delivery type
vkorg like likp-vkorg, " Sales organization
kunag like likp-kunag, " sold-to party
kunnr like likp-kunnr, " ship to party SIR 34606
btgew like likp-btgew, " Delivery weight
gewei like likp-gewei, " Unit of weight
anzpk like likp-anzpk, " Number of Packages SIR 61880
volum like likp-volum, " Delivery Volume SIR 61880
voleh like likp-voleh, " Volume Unit SIR 61880
vtwiv like likp-vtwiv, " Distribution channel
spaiv like likp-spaiv, " Division
wadat_ist like likp-wadat_ist, " actual goods issue date
del_flg(1) type c, "(+) SIR 301978
end of t_likp.
types: begin of t_lips,
vbeln like lips-vbeln, " delivery
posnr like lips-posnr, " delivery line
matnr like lips-matnr, " material
lgort like lips-lgort, " storage location
prodh like lips-prodh, " product hierarchy
meins like lips-meins, " base UoM
brgew like lips-brgew, " Material weight
gewei like lips-gewei, " Unit of weight
volum like lips-volum, " Material Volume SIR 61880
voleh like lips-voleh, " Volume Unit SIR 61880
lgmng like lips-lgmng, " actual delivery quantity
komkz like lips-komkz, " Indicator for picking control
mtart like lips-mtart, " Material type " SIR 37838
del_flg(1) type c, "(+) SIR 301978
end of t_lips.
types: begin of t_vepo,
venum like vepo-venum, " shipping unit number
vbeln like vepo-vbeln, " delivery
end of t_vepo.
types: begin of t_vekp,
venum like vekp-venum, " shipping unit number
brgew like vekp-brgew, " actual weight
gewei_max like vekp-gewei_max, " unit of weight
vpobjkey like vekp-vpobjkey, " key for assigned object
end of t_vekp.
types: begin of t_knvv,
kunnr like knvv-kunnr, " customer number
ktgrd like knvv-ktgrd, " acct assign group
kvgr1 like knvv-kvgr1, " customer group 1
end of t_knvv.
types: begin of t_kna1, " SIR 34606
kunnr like kna1-kunnr, " customer number " SIR 34606
land1 like kna1-land1, " contry " SIR 34606
end of t_kna1. " SIR 34606
types: begin of t_marm,
matnr like marm-matnr, " material
meinh like marm-meinh, " Alt unit of measure 032383
umrez like marm-umrez, " numerator
umren like marm-umren, " denominator
end of t_marm.
types: begin of t_mara, " SIR 38784
matnr like mara-matnr, " material " SIR 38784
prdha like mara-prdha, " Product Hierarchy " SIR 61880
brgew like lips-brgew, " gross weight " SIR 38784
gewei like mara-gewei, " Unit of weight " SIR 38784
volum like mara-volum, " Volume " SIR 61880
voleh like mara-voleh, " Volume Unit " SIR 61880
del_flg(1) type c, "(+) SIR 301978
end of t_mara. " SIR 38784
types: begin of t_tvswz,
vstel like tvswz-vstel, " shipping point
end of t_tvswz.
types: begin of t_z0234, "032383
vstel like z0234-vstel, " shipping point 032383
zpaluom like z0234-zpaluom," pallet unit of measure 032383
zcsuom like z0234-zcsuom," Case unit of measure 032383
end of t_z0234. "032383
types: begin of t_output_dt,
wadat_ist like likp-wadat_ist, " Goods issue date
ktgrd like knvv-ktgrd," acct assign group
bu like knvv-kvgr1," business unit
kunnr like kna1-kunnr," ship to location SIR 34606
land1 like kna1-land1," ship to location SIR 34606
d_btgew like likp-btgew," delivery weight
m_brgew like lips-brgew," material weight
a_brgew like vekp-brgew," actual weight of ship unit
num_del type i, " counter of deliveries
num_pallets type i, " number of pallets
num_cases type i, " number of cases
num_loose type i, " loose quantity
num_delln type i, " counter of delivery lines
* packages like likp-anzpk," Number of Packages " SIR 61880
packages(3) type p, " Number of Packages " SIR 61880
volume like lips-volum," Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_dt.
types: begin of t_output_ag,
ktgrd like knvv-ktgrd," acct assign group
bu like knvv-kvgr1," business unit
land1 like kna1-land1," country SIR 34606
d_btgew like likp-btgew," delivery weight
m_brgew like lips-brgew," material weight
a_brgew like vekp-brgew," actual weight of ship unit
num_del type i, " counter of deliveries
num_pallets type i, " number of pallets
num_cases type i, " number of cases
num_loose type i, " loose quantity
num_delln type i, " counter of delivery lines
* packages like likp-anzpk," Number of Packages " SIR 61880
packages(3) type p, " Number of Packages " SIR 61880
volume like lips-volum," Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_ag.
types: begin of t_output_gs, " SIR 34606
ktgrd like knvv-ktgrd," acct assign group " SIR 34606
bu like knvv-kvgr1," business unit " SIR 34606
d_btgew like likp-btgew," delivery weight " SIR 34606
m_brgew like lips-brgew," material weight " SIR 34606
a_brgew like vekp-brgew," actual weight " SIR 34606
num_del type i, " counter of deliv " SIR 34606
num_pallets type i, " number of pallets " SIR 34606
num_cases type i, " number of cases " SIR 34606
num_loose type i, " loose quantity " SIR 34606
num_delln type i, " counter of deliv " SIR 34606
* packages like likp-anzpk, " Number of Package " SIR 61880
packages(3) type p, " Number of Packages" SIR 61880
volume like lips-volum, " Volume " SIR 61880
lobus(3) type c, " Line of Business " SIR 61880
pac1(3) type c, " PAC1 " SIR 61880
end of t_output_gs. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* Material Type
types: begin of t_mtart,
mtart like t134-mtart, " Material Type
end of t_mtart.
* Customer Business Unit.
types: begin of t_kvgr1,
kvgr1 like knvv-kvgr1, " Customer Group 1
end of t_kvgr1.
* sales Organization.
types: begin of t_lgort,
lgort like t001l-lgort, " Sales Organization
end of t_lgort.
* Begin of SIR 301978
* Header: Material Document
types: begin of t_mkpf,
vgart type mkpf-vgart,
xblnr type likp-vbeln,
end of t_mkpf.
* End of SIR 301978
*---------------------------------------------------* End of SIR 061880
*---Internal Tables---------------------------------------------------*
data: i_likp type t_likp occurs 0 with header line,
i_temp_likp type t_likp occurs 0 with header line,
v_likp type t_likp,
i_lips type t_lips occurs 0 with header line,
i_temp_lips type t_lips occurs 0 with header line,
v_lips type t_lips,
i_vepo type t_vepo occurs 0,
* V_VEPO TYPE T_VEPO,
i_vekp type t_vekp occurs 0,
v_vekp type t_vekp,
i_knvv type t_knvv occurs 0 with header line,
v_knvv type t_knvv,
i_kna1 type t_kna1 occurs 0, " SIR 34606
v_kna1 type t_kna1, " SIR 34606
i_z0234 type t_z0234 occurs 0, " 032383
v_z0234 type t_z0234, " 032383
i_z0234_uom type t_z0234 occurs 0, " 032383
v_z0234_uom type t_z0234, " 032383
i_marm type t_marm occurs 0 with header line," SIR 61880
i_marm_pallet type t_marm occurs 0 with header line,
v_marm_pallet type t_marm,
i_marm_case type t_marm occurs 0 with header line,
v_marm_case type t_marm,
*-------------------------------------------------* Begin of SIR 061880
* I_MARA TYPE T_MARA OCCURS 0, " SIR 38784
i_mara1 type t_mara occurs 0 with header line,
i_mtart type t_mtart occurs 0 with header line,
i_kvgr1 type t_kvgr1 occurs 0 with header line,
i_lgort type t_lgort occurs 0 with header line,
v_kvgr1 type t_kvgr1,
*---------------------------------------------------* End of SIR 061880
v_mara type t_mara, " SIR 38784
i_tvswz type t_tvswz occurs 0,
v_tvswz type t_tvswz, "(+) SIR 301978
i_output_dt type t_output_dt occurs 0,
v_output_dt type t_output_dt,
i_output_ag type t_output_ag occurs 0,
v_output_ag type t_output_ag,
i_output_gs type t_output_gs occurs 0, " SIR 34606
v_output_gs type t_output_gs, " SIR 34606
i_mkpf type table of t_mkpf with header line."SIR 301978
*** Data Declarations *
data: v_page(3) type c, " Page Counter
v_comp like t001k-bukrs, " zbsn0001 company code
v_title(24) type c, " zbsn0001 report title
v_rpttyp type c, " report type
v_ok type c, " control While... endwhile
v_diff_date type p, " days between selection
v_werks like t001l-werks, " plant
* v_z0234_zpaluom like z0234-zpaluom, " Pallet Unit of Measure
* v_z0234_zcsuom like z0234-zcsuom, " Case Unit of Measure
v_palwto type p decimals 6, " SIR 091510
* "like likp-btgew, " Weight after conversion
v_vekp_tabix like sy-tabix, " index on read
v_vekp_sum_brgew like vekp-brgew, " actual weight
v_pallet_qty like lips-lgmng, " calculated pallet qty
v_pallet_integer type i, " true pallet qty
v_case_qty like lips-lgmng, " calculated case qty
v_case_integer type i, " true case qty
v_qty_not_pallets like lips-lgmng, " calculated
v_num_pallets like lips-lgmng, " calculated nbr of pallets
v_num_pallets_int type i, " true nbr of pallets
v_num_cases like lips-lgmng, " calculated nbr of cases
v_num_cases_int type i, " true nbr of cases
v_total_case_qty like lips-lgmng, " case quantity
v_loose_qty type i, " calculated loose quantity
*-------------------------------------------------* Begin of SIR 061880
v_volume like lips-volum, " Volume After Convertion
v_cbuun like knvv-kvgr1, " Customer BU
v_mbuun like knvv-kvgr1, " Material BU
v_lobus(3) type c, " Line of Business
v_pac1(3) type c, " PAC1
v_flag type c. " Flag Indicator for No Data
*---------------------------------------------------* End of SIR 061880
* Begin of SIR 301978
* Ranges
ranges : r_vstel for tvswz-vstel.
* End of SIR 301978
* Constants
data: c_uom(3) type c value 'KG'. " Kilogram Unit of Meas.
data : c_vom like mara-voleh value 'M3'. " Metter Cube. " SIR 061880
constants : c_wl(2) type c value 'WL'. "(+) SIR 301978
* Initialization.
initialization.
s_lfart-sign = 'I'.
s_lfart-option = 'EQ'.
s_lfart-low = 'LF '.
append s_lfart.
s_lfart-low = 'NL '.
append s_lfart.
s_lfart-low = 'NLCC'.
append s_lfart.
s_lfart-low = 'ZLFI'.
append s_lfart.
* AT SELECTION-SCREEN.
at selection-screen.
* SIR 42730 - If no Goods Issue Date has been specified in the
* Select Options set the range to the previous month.
if s_wadat-low is initial.
s_wadat-sign = 'I'.
s_wadat-option = 'BT'.
s_wadat-high = sy-datum. " Today's date
s_wadat-high+6(2) = '01'. " First of this month
s_wadat-high = s_wadat-high - 1. " End of last month
s_wadat-low = s_wadat-high. " End of last month
s_wadat-low+6(2) = '01'. " First of last month
append s_wadat.
endif. " SIR 42730 IF S_WADAT-LOW IS INITIAL.
clear v_werks. "(+) SIR 301978
* Validate Plant/Storage Location from selection screen
select werks up to 1 rows into v_werks from t001l
where werks = p_werks and
lgort in s_lgort.
endselect.
if sy-subrc ne 0.
message e045 with text-e01.
endif.
* Validate Storage Location
if not s_lgort[] is initial.
select lgort from t001l into table i_lgort where lgort in s_lgort.
if sy-subrc ne 0.
message e045 with text-e09.
endif.
endif.
* Validate date range. do not allow more that 31 days
if not s_wadat-high is initial.
v_diff_date = s_wadat-high - s_wadat-low.
if v_diff_date >= '31'.
message e045 with text-e02.
endif.
endif.
*-------------------------------------------------* Begin of SIR 061880
* Validation for Material Type in Selection Screen
if not s_mtart[] is initial.
select mtart from t134 into table i_mtart where mtart in s_mtart.
if sy-subrc ne 0.
message e045 with text-e07.
endif.
endif.
at selection-screen on block b2.
* Validation for Material Business Unit and Customer Business Unit.
if s_cbuun-low is not initial and s_mbuun-low is not initial.
message e045 with text-e05.
endif.
* Validation for Possible combinations of Material BU, Line of Business
* and PAC1
if ( s_mbuun-low is not initial and s_lobus-low is not initial
and s_pac1-low is not initial )
or ( s_mbuun-low is not initial and s_lobus-low is not initial )
or ( s_lobus-low is not initial and s_pac1-low is not initial )
or ( s_mbuun-low is not initial and s_pac1-low is not initial ).
message e045 with text-e06.
endif.
* Validation for Customer Business Unit.
if not s_cbuun[] is initial.
select kvgr1 from tvv1 into table i_kvgr1 where kvgr1 in s_cbuun.
if sy-subrc ne 0.
message e045 with text-e08.
endif.
* free: i_kvgr1.
endif.
*---------------------------------------------------- End of SIR 061880
* TOP-OF-PAGE
* Top of the page routine to print the headers and columns
top-of-page.
format color col_heading on.
if v_rpttyp = 'D'.
v_title = text-h01.
else.
v_title = text-h02.
endif.
perform zbsn0001_standard_header " Standard Report Heading Form
using v_comp v_title 'U' v_page.
skip.
if v_rpttyp = 'D'.
perform write_dtlvl_headings.
else.
perform write_aglvl_headings.
endif.
* FORM WRITE_DTLVL_HEADINGS *
* for date detail level, print the column headers *
form write_dtlvl_headings.
write: /001 text-h03, " Acct
038 text-h04, " ------ P I C K I N G ------
105 text-h05, " ----- S H I P P I N G -----
/001 text-h06, " Group
007 text-h07, " Date
017 text-h08, " BU
021 text-h17, " ship to party 34606
030 text-h18, " country
039 text-h09, " Pallets
057 text-h10, " Cases
075 text-h11, " Loose
093 text-h12, " Lines
105 text-h13, " Material Kg
124 text-h16, " Delivery Kg
143 text-h14, " Actual Kg
161 text-h15, " Deliveries
*----------------------------------------------------Start of SIR 61880
173 text-h20, " Packages
189 text-h21, " Volume
201 text-h22, " LOB
207 text-h23. " PAC1
*-----------------------------------------------------*End of SIR 61880
skip.
endform. " end of write_dtlvl_headings.
* FORM WRITE_AGLVL_HEADINGS *
* for account group detail level, print the column headers *
form write_aglvl_headings.
write: /001 text-h03, " Acct
038 text-h04, " ------ P I C K I N G ------
105 text-h05, " ----- S H I P P I N G -----
/001 text-h06, " Group
017 text-h08, " BU
030 text-h18, " country SIR 34606
039 text-h09, " Pallets
057 text-h10, " Cases
075 text-h11, " Loose
093 text-h12, " Lines
105 text-h13, " Material Kg
124 text-h16, " Delivery Kg
143 text-h14, " Actual Kg
161 text-h15, " Deliveries
*---------------------------------------------------*Start of SIR 61880
173 text-h20, " Packages
189 text-h21, " Volume
201 text-h22, " LOB
207 text-h23. " PAC1
*-----------------------------------------------------*End of SIR 61880
skip.
endform. " end of write_aglvl_headings.
*-------------------------- SUBBROUTINES -----------------------------*
include zbsn0001. " Include to print all Standard Report Titles
include zsdn0004. " Print the Select Options
*** MAIN SELECTION. *
start-of-selection.
refresh: i_likp, i_temp_likp, i_lips, i_temp_lips, i_vepo,
i_vekp, i_knvv, i_marm_pallet, i_marm_case, i_tvswz,
i_output_dt, i_output_ag, i_mara1.
clear: v_likp, v_lips, v_vekp, v_knvv, v_mara,
v_marm_pallet, v_marm_case, v_output_dt, v_output_ag.
v_rpttyp = 'D'.
* SIR 42730 - Echo the Select Options to the output listing and print
* the Goods Issue Date range being used.
write: /,/. " SIR 43730 - Skip a couple of lines to centre it.
perform zsdn0004_print_select_options using sy-cprog ' '.
if s_wadat-high is initial.
write: /,/, text-003, 34 s_wadat-low.
else.
write: /,/, text-003, 34 s_wadat-low, 44 text-004, 47 s_wadat-high.
endif.
new-page.
* Main Processing. *
perform get_data.
if not i_lips[] is initial.
perform create_output.
endif.
* END-OF-SELECTION
end-of-selection.
*-------------------------------------------------* Start of SIR 061880
* PERFORM WRITE_REPORT.
if not i_output_dt[] is initial and not i_output_ag[] is initial and
not i_output_gs[] is initial.
perform write_report.
else.
skip 2.
write:/ text-e03.
skip 2.
uline.
clear: v_flag.
endif.
*---------------------------------------------------* End of SIR 061880
* FORM GET_DATA *
* build all of the internal tables needed for the report *
* selects on t001k, z0234, likp, lips, vepo, vekp, knvv & marm, mara *
form get_data.
perform get_data_t001k. " SIR 301978
perform get_data_tvswz. " SIR 301978
if sy-subrc = 0. " Build shipping point range
perform get_data_Z0234. " SIR 301978
if sy-subrc ne 0.
v_flag = 'X'.
* stop.
else.
sort i_z0234 by vstel. " 032383
endif.
* Begin of SIR 301978
* The data retrievalfrom LIKP has been modified for performance
* reasons
perform get_data_mkpf. " SIR 301978
if sy-subrc eq 0.
* Deleting data other than Goods issued for delivery
delete i_mkpf where vgart ne c_wl.
sort i_mkpf by xblnr.
endif.
* Deleting the data from the internal table i_likp by comparing
* shipping point
r_vstel-sign = 'I'.
r_vstel-option = 'EQ'.
clear : v_tvswz.
loop at i_tvswz into v_tvswz.
r_vstel-low = v_tvswz-vstel.
append r_vstel.
endloop.
if not i_mkpf[] is initial.
perform get_data_likp. " SIR 301978
endif.
if sy-subrc = 0.
delete i_likp where not lfart in s_lfart.
* End of SIR 301978
* Get data for the delivery lines
if not i_likp[] is initial.
perform get_data_lips. " SIR 301978
* Begin of SIR 301978
if i_lips[] is initial.
v_flag = 'X'.
message i089 with text-i02.
leave list-processing.
endif. " Return code for LIPS select
* End of SIR 301978
endif.
*-------------------------------------------------* Begin of SIR 061880
* Get Data From MARA (Material Master) to Read Material Weight and
* Material Voluem from Master Data.
if not i_lips[] is initial.
* Begin of SIR 301978
* Delete the duplicate material from delivery item table
i_temp_lips[] = i_lips[].
sort i_temp_lips by matnr.
delete adjacent duplicates from i_temp_lips comparing matnr.
perform get_data_mara. " SIR 301978
if sy-subrc = 0.
sort i_mara1 by matnr.
clear i_temp_lips.
refresh i_temp_lips.
* End of SIR 301978
else.
v_flag = 'X'.
message i089 with text-i01.
leave list-processing.
endif.
endif.
* Filter I_LIPS and I_MARA1 When Either material BU or Line of
* Business (LOB) or PAC1 are not left Balnk
perform filter_data_for_prdha.
* Get data for the sold-to customer
perform i_knvv_fill_data.
* Filter I_LIKP & I_LIPS & I_MARA for Cust-BU, When Cust-Bu is not
* left Blank.
perform filter_likp_lips_mara_custbu.
*---------------------------------------------------- End of SIR 061880
*-------------------------------------------------* Begin of SIR 034606
* Get data for the ship to party
i_temp_likp[] = i_likp[].
sort i_temp_likp by kunnr.
delete adjacent duplicates from i_temp_likp comparing kunnr.
perform get_data_kna1. " SIR 301978
if sy-subrc = 0.
sort i_kna1 by kunnr.
endif.
*---------------------------------------------------* End of SIR 034606
else.
v_flag = 'X'.
message i089 with text-i04.
leave list-processing.
endif. " return code to LIKP select
* endif. " SIR 061880
free: i_temp_likp.
endif. " return code for TVSWZ select
* Process table LIPS
if not i_lips[] is initial.
i_temp_lips[] = i_lips[].
sort i_temp_lips by vbeln.
delete adjacent duplicates from i_temp_lips comparing vbeln.
* Get actual weight
perform get_data_vepo. " SIR 301978
if sy-subrc = 0.
sort i_vepo by venum.
delete adjacent duplicates from i_vepo comparing venum.
perform get_data_vekp. " SIR 301978
sort i_vekp by vpobjkey.
endif.
free: i_vepo, i_temp_lips.
i_temp_lips[] = i_lips[].
sort i_temp_lips by matnr.
delete adjacent duplicates from i_temp_lips comparing matnr.
* Get Units of Measure for Material
perform read_data_from_marm. " SIR 061880
* Begin of SIR 032383
i_z0234_uom = i_z0234.
sort i_z0234_uom by zpaluom.
delete adjacent duplicates from i_z0234_uom comparing zpaluom.
* End of SIR 032383
clear i_marm_pallet. " SIR 061880
refresh i_marm_pallet. " SIR 061880
loop at i_z0234_uom into v_z0234_uom. "LOOP Z0234 032383
*-------------------------------------------------* Begin of SIR 061880
* Get Alternative Unit of Measure for Pallets
perform i_marm_pallet_fill.
endloop. "ENDLOOP Z0234 032383
** get alternative UoM for pallets
* SELECT MATNR " material
* MEINH " Alt unit of measure " 032383
* UMREZ " numerator
* UMREN " denominator
** into table i_marm_pallet " 032383
* APPENDING TABLE I_MARM_PALLET "032383
* FROM MARM
* FOR ALL ENTRIES IN I_TEMP_LIPS
* WHERE MATNR = I_TEMP_LIPS-MATNR AND
** meinh = v_z0234_zpaluom. " 032383
* MEINH = V_Z0234_UOM-ZPALUOM. " 032383
*---------------------------------------------------* End of SIR 061880
sort i_marm_pallet by matnr meinh.
free i_z0234_uom. "032383
i_z0234_uom = i_z0234. "032383
sort i_z0234_uom by zcsuom. "032383
delete adjacent duplicates from i_z0234_uom comparing zcsuom."32383
clear i_marm_case. " SIR 061880
refresh i_marm_case. " SIR 061880
loop at i_z0234_uom into v_z0234_uom. "LOOP Z0234 032383
*-------------------------------------------------* Begin of SIR 061880
* Get Alternative Unit of Measure for Cases
perform i_marm_case_fill.
endloop. "ENDLOOP Z0234 032383
*---------------------------------------------------* End of SIR 061880
sort i_marm_case by matnr meinh.
else.
v_flag = 'X'.
message i089 with text-i02.
* leave list-processing.
endif. " table LIPS is empty
endform. " get_data
* FORM CREATE_OUTPUT *
* process internal table LIPS, for each delivery/delivery lines create*
* an output record and collect into i_output internal table. Fields *
* used for header are goods issue date, acct assign, BU for customer, *
* total weight, total weight for shipping unit and count of *
* deliveries, the remaining fields will have a value of zero for the *
* collect. For each delivery line, fields used are goods issue date, *
* acct assign, BU for material, number of pallets, number of cases, *
* loose quantity and number of delivery lines. The remaining header *
* fiels will be zero for the collect. *
form create_output.
*-------------------------------------------------* Begin of SIR 061880
sort i_mara1 by matnr.
sort i_lips by vbeln posnr matnr.
sort i_likp by vbeln.
sort i_z0234 by vstel.
sort i_knvv by kunnr.
sort i_kna1 by kunnr.
sort i_vekp by vpobjkey.
sort i_marm_pallet by matnr meinh.
sort i_marm_case by matnr meinh.
* LOOP AT I_LIPS INTO V_LIPS.
loop at i_lips.
clear v_lips.
v_lips = i_lips.
*---------------------------------------------------* End of SIR 061880
at new vbeln.
perform collect_header_data.
endat.
if not v_lips-komkz is initial. " SIR 45567
perform collect_item_data.
endif. " SIR 45567
endloop.
endform. " create_output
* FORM COLLECT_HEADER_DATA *
* Fields used for header are goods issue date, acct assign, *
* BU for customer, total weight, total weight for shipping unit *
* and count ofdeliveries, the remaining fields will have a value of *
* zero for the collect. *
form collect_header_data.
clear: v_likp, v_knvv, v_vekp, v_vekp_sum_brgew.
v_ok = 'Y'.
read table i_likp into v_likp with key vbeln = v_lips-vbeln
binary search.
if sy-subrc = 0. " SIR 061880
clear v_z0234. "(+) SIR 301978
read table i_z0234 into v_z0234 "32383
with key vstel = v_likp-vstel "32383
binary search. "32383
read table i_knvv into v_knvv with key kunnr = v_likp-kunag
binary search.
if sy-subrc ne 0.
select single ktgrd kvgr1 into (v_knvv-ktgrd, v_knvv-kvgr1)
from knvv where kunnr = v_likp-kunag and
vkorg = v_likp-vkorg and
vtweg = '01' and " intercompany values
spart = '01'. " intercompany values
endif.
clear v_kna1. " SIR 34606
read table i_kna1 into v_kna1 " SIR 34606
with key kunnr = v_likp-kunnr " SIR 34606
binary search. " SIR 34606
read table i_vekp into v_vekp
with key vpobjkey(10) = v_likp-vbeln
binary search.
if sy-subrc = 0.
v_vekp_tabix = sy-tabix.
while v_ok = 'Y'.
if v_vekp-gewei_max ne c_uom.
perform z_unit_conversion
using v_vekp-brgew v_vekp-gewei_max c_uom v_palwto.
v_vekp_sum_brgew = v_vekp_sum_brgew + v_palwto.
else.
v_vekp_sum_brgew = v_vekp_sum_brgew + v_vekp-brgew.
endif.
v_vekp_tabix = v_vekp_tabix + 1.
read table i_vekp into v_vekp
index v_vekp_tabix.
if sy-subrc = 0.
if v_vekp-vpobjkey(10) ne v_likp-vbeln.
v_ok = 'N'.
endif.
else.
v_ok = 'N'.
endif.
endwhile.
endif.
endif. " SIR 061880
* populate output tables
clear: v_output_dt, v_output_ag,v_output_gs. " SIR 34606
v_output_dt-wadat_ist = v_likp-wadat_ist.
v_output_dt-ktgrd = v_knvv-ktgrd.
v_output_ag-ktgrd = v_knvv-ktgrd.
v_output_gs-ktgrd = v_knvv-ktgrd. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* V_OUTPUT_DT-BU = V_KNVV-KVGR1.
* V_OUTPUT_AG-BU = V_KNVV-KVGR1.
* V_OUTPUT_GS-BU = V_KNVV-KVGR1. " SIR 34606
* Populate Business Unit,Line of Busness and PAC1 Values in Header Data
perform get_busunit_lobus_pac1_data1.
*---------------------------------------------------* End of SIR 061880
v_output_dt-kunnr = v_kna1-kunnr. " SIR 34606
* V_OUTPUT_AG-KUNNR = V_KNA1-KUNNR. " SIR 34606
v_output_dt-land1 = v_kna1-land1. " SIR 34606
v_output_ag-land1 = v_kna1-land1. " SIR 34606
v_output_dt-a_brgew = v_vekp_sum_brgew.
v_output_ag-a_brgew = v_vekp_sum_brgew.
v_output_gs-a_brgew = v_vekp_sum_brgew. " SIR 34606
if s_mbuun[] is initial and " SIR 61880
s_lobus[] is initial and " SIR 61880
s_pac1[] is initial. " SIR 61880
v_output_dt-num_del = 1.
v_output_ag-num_del = 1.
v_output_gs-num_del = 1. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* Number of Packages
v_output_dt-packages = v_likp-anzpk.
v_output_ag-packages = v_likp-anzpk.
v_output_gs-packages = v_likp-anzpk.
else.
clear: v_output_dt-num_del,
v_output_ag-num_del,
v_output_gs-num_del,
v_output_dt-packages,
v_output_ag-packages,
v_output_gs-packages.
endif.
*---------------------------------------------------* End of SIR 061880
collect v_output_dt into i_output_dt.
collect v_output_ag into i_output_ag.
collect v_output_gs into i_output_gs. " SIR 34606
endform. " collect_header_data
* FORM COLLECT_ITEM_DATA *
* For each delivery line, fields used are goods issue date, *
* acct assign, BU for material, number of pallets, number of cases, *
* loose quantity and number of delivery lines. The remaining header *
* fiels will be zero for the collect. *
form collect_item_data.
clear: v_pallet_qty, v_pallet_integer,
v_case_qty, v_case_integer,
v_num_pallets, v_num_pallets_int,
v_num_cases, v_num_cases_int,
v_qty_not_pallets, v_total_case_qty, v_loose_qty.
read table i_marm_pallet into v_marm_pallet
with key matnr = v_lips-matnr
meinh = v_z0234-zpaluom binary search."32382
if sy-subrc = 0.
v_pallet_qty = v_marm_pallet-umrez / v_marm_pallet-umren.
* round down partial pallets
v_pallet_integer = v_pallet_qty - '.499'.
endif.
read table i_marm_case into v_marm_case
with key matnr = v_lips-matnr
meinh = v_z0234-zcsuom binary search."32382
if sy-subrc = 0.
v_case_qty = v_marm_case-umrez / v_marm_case-umren.
* round down partial cases
v_case_integer = v_case_qty - '.499'.
endif.
if v_pallet_integer > 0.
v_num_pallets = v_lips-lgmng / v_pallet_integer.
v_num_pallets_int = v_num_pallets - '.499'.
endif.
v_qty_not_pallets = v_lips-lgmng -
( v_num_pallets_int * v_pallet_integer ).
if v_case_integer > 0.
v_num_cases = v_qty_not_pallets / v_case_integer.
v_num_cases_int = v_num_cases - '.499'.
endif.
v_total_case_qty = v_num_cases_int * v_case_integer.
if v_qty_not_pallets = v_total_case_qty.
v_loose_qty = 0.
else.
v_loose_qty = 1.
endif.
* populate output tables
clear: v_output_dt, v_output_ag, v_output_gs. " SIR 34606
v_output_dt-wadat_ist = v_likp-wadat_ist.
v_output_dt-ktgrd = v_knvv-ktgrd.
v_output_ag-ktgrd = v_knvv-ktgrd.
v_output_gs-ktgrd = v_knvv-ktgrd. " SIR 34606
v_output_dt-kunnr = v_kna1-kunnr. " SIR 34606
* V_OUTPUT_AG-KUNNR = V_KNA1-KUNNR. " SIR 34606
v_output_dt-land1 = v_kna1-land1. " SIR 34606
v_output_ag-land1 = v_kna1-land1. " SIR 34606
*-------------------------------------------------* Begin of SIR 061880
* V_OUTPUT_DT-BU = V_LIPS-PRODH+1(2).
* V_OUTPUT_AG-BU = V_LIPS-PRODH+1(2).
* V_OUTPUT_GS-BU = V_LIPS-PRODH+1(2). " SIR 34606
* Populate Business Unit,Line of Business and PAC1 Values for Item Data.
perform get_busunit_lobus_pac1_data2.
if V_OUTPUT_DT-BU is initial.
clear V_OUTPUT_DT.
exit.
endif.
*---------------------------------------------------* End of SIR 061880
* get delivery weight from delivery lines instead of header " SIR 45567
if v_lips-gewei = c_uom.
v_output_dt-d_btgew = v_lips-brgew.
v_output_ag-d_btgew = v_lips-brgew.
v_output_gs-d_btgew = v_lips-brgew. " SIR 34606
else.
perform z_unit_conversion
using v_lips-brgew v_lips-gewei c_uom v_palwto.
v_output_dt-d_btgew = v_palwto.
v_output_ag-d_btgew = v_palwto.
v_output_gs-d_btgew = v_palwto. " SIR 34606
endif.
* Get material weight from delivery (LIPS)(IF P_DELWT = 'X')" SIR 38784
if p_delwt = 'X'. " SIR 38784
if v_lips-gewei = c_uom.
v_output_dt-m_brgew = v_lips-brgew.
v_output_ag-m_brgew = v_lips-brgew.
v_output_gs-m_brgew = v_lips-brgew. " SIR 34606
else.
perform z_unit_conversion
using v_lips-brgew v_lips-gewei c_uom v_palwto.
v_output_dt-m_brgew = v_palwto.
v_output_ag-m_brgew = v_palwto.
v_output_gs-m_brgew = v_palwto. " SIR 34606
endif.
else. " SIR 38784
* Get material weight from Master data (MARA) " SIR 38784
read table i_mara1 into v_mara " SIR 38784
with key matnr = v_lips-matnr " SIR 38784
binary search. " SIR 38784
if v_mara-gewei = c_uom. " SIR 38784
v_output_dt-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
v_output_ag-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
v_output_gs-m_brgew = v_mara-brgew * v_lips-lgmng. " SIR 38784
else. " SIR 38784
perform z_unit_conversion " SIR 38784
using v_mara-brgew v_mara-gewei c_uom v_palwto. " SIR 38784
v_output_dt-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
v_output_ag-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
v_output_gs-m_brgew = v_palwto * v_lips-lgmng. " SIR 38784
endif. " SIR 38784
endif. " SIR 38784
*-------------------------------------------------* Begin of SIR 061880
* To Get the Volume Data.
perform get_volume_data.
*---------------------------------------------------* End of SIR 061880
v_output_dt-num_pallets = v_num_pallets_int.
v_output_ag-num_pallets = v_num_pallets_int.
v_output_gs-num_pallets = v_num_pallets_int. " SIR 34606
v_output_dt-num_cases = v_num_cases_int.
v_output_ag-num_cases = v_num_cases_int.
v_output_gs-num_cases = v_num_cases_int. " SIR 34606
v_output_dt-num_loose = v_loose_qty.
v_output_ag-num_loose = v_loose_qty.
v_output_gs-num_loose = v_loose_qty. " SIR 34606
*{ INSERT D11K901833 1
* Sir 054042/48712 insert code to put in 0 instead of 1 for collect
* value for delivery lines
if v_lips-lgmng = 0.
v_output_dt-num_delln = 0.
v_output_ag-num_delln = 0.
v_output_gs-num_delln = 0.
else.
* end of insert for 054042/48712
*} INSERT
v_output_dt-num_delln = 1.
v_output_ag-num_delln = 1.
v_output_gs-num_delln = 1.Since this is your first post, let me clue you in. This forum is meant for asking very short and specific questions. For example, if you've asked, how could you improve a particular one SELECT statement, I'm sure many people would have helped you.
But you cannot seriously expect someone on this forum to spend his/her time and review such a long program. For this people are normally getting paid, you know. -
How to improve Performance of the Statements.
Hi,
I am using Oracle 10g. My problem is when i am Execute & fetch the records from the database it is taking so much time. I have created Statistics also but no use. Now what i have to do to improve the Performance of the SELECT, INSERT, UPDATE, DELETE Statements.
Is it make any differents because i am using WindowsXP, 1 GB RAM in Server Machine, and WindowsXP, 512 GB RAM in Client Machine.
Pls. Give me advice for me to improve Performance.
Thank u...!What and where to change parameters and values ?Well, maybe my previous post was not clear enough, but if you want to keep your job, you shouldn't change anything else on init parameter and you shouldn't fall in the Compulsive Tuning Disorder.
Everyone who advise you to change some parameters to some value without any more info shouldn't be listen.
Nicolas. -
How to generate the insert staments of all schema tables with one DBPROC
[code]CREATE DBPROC SCHEMA_INSERT_SCRIPT
AS
VAR L_STATEMENT VARCHAR(500) ;
L_COL_NAME VARCHAR(50);
L_ALL_TAB_COLS VARCHAR(400);
L_TAB_NAME VARCHAR(50);
L_SQL VARCHAR(1000);
TRY
SET L_ALL_TAB_COLS = ' ';
DECLARE C_TAB_CUR CURSOR
FOR
SELECT T.TABLENAME,C.COLUMNNAME
FROM DOMAIN.TABLES T, DOMAIN.COLUMNS C
WHERE T.OWNER='SCOTT2'
AND T.TABLENAME = C.TABLENAME
AND T.TABLENAME='DEPT';
WHILE $RC = 0 DO
BEGIN
FETCH C_TAB_CUR INTO :L_TAB_NAME, :L_COL_NAME;
SET L_ALL_TAB_COLS = L_ALL_TAB_COLS || L_COL_NAME || ',';
DELETE FROM SCOTT2.QUERY;
INSERT INTO SCOTT2.QUERY VALUES
('insert into '||TRIM( :L_TAB_NAME) ||
'(' || SUBSTR(:L_ALL_TAB_COLS,1,LENGTH(:L_ALL_TAB_COLS)-1)||
INSERT INTO SCOTT2.QUERY VALUES( 'values (');
END;
CATCH
CLOSE C_TAB_CUR;[/code]
till now i am getting output as
insert into DEPT(DEPTNO,DNAME,LOC)
values (
but i want output from this procedure as
insert into DEPT(DEPTNO,DNAME,LOC)
values (10,'SALES','NEWYORK')
so kindly help me out how can i access the data from tables and create the insert statements of the table.
with this above Procedure,i want to generate the insert statments of the table.
please advice me how can i go.
thanks,BhupinderHi,
from what I understand from your post, the thing that's missing is the retrieval of the data from the tables and its types. This could be done very similar to your already done tablespecs, just perform a select, use a cursor again and in there, make sure that character (etc.) fields get surrounded by '' and integers not.
Regards,
Roland -
How to tune the Insert statement?
Hi ,
I am using 10.2.0.4.0 version of oracle.
i am having one insert statement , which comes almost all the time in the TOP of my AWR elapsed time section.
And its somewhat similar to as below.
Query:
INSERT INTO a (InvoicePK, CheckPK)
SELECT DISTINCT ih.InvoicePK, cd.CheckPK
FROM at,
cd,
ih,
rd
WHERE at.AttachmentPK = :1
AND cd.CheckPK = at.CheckPK
AND at.AttachmentPK = rd.AttachPK
AND ih.PAYPK = cd.PAYEEPAYPK
AND ih.PayerNS = cd.PayerNS
AND ih.PayerPayId = cd.PayerPayId
AND ih.UpperInvoiceNum = rd.UPPERINVNUM
AND ih.InvoiceStatusCD NOT IN ('REJ', 'DNY');
Below is the plan for the 'Select ' statement i.e. used in the insert statement.
Execution Plan:
Plan hash value: 2232002808
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 1 | 193 | 9 (23)| 00:00:01 | | |
| 1 | HASH UNIQUE | | 1 | 193 | 9 (23)| 00:00:01 | | |
|* 2 | HASH JOIN | | 1 | 193 | 8 (13)| 00:00:01 | | |
| 3 | NESTED LOOPS | | 10 | 1740 | 4 (0)| 00:00:01 | | |
| 4 | NESTED LOOPS | | 1 | 85 | 3 (0)| 00:00:01 | | |
| 5 | TABLE ACCESS BY INDEX ROWID | at | 1 | 16 | 2 (0)| 00:00:01 | | |
|* 6 | INDEX UNIQUE SCAN | atpk1 | 1 | | 1 (0)| 00:00:01 | | |
| 7 | TABLE ACCESS BY INDEX ROWID | cd | 7359K| 484M| 1 (0)| 00:00:01 | | |
|* 8 | INDEX UNIQUE SCAN | cdpk1 | 1 | | 1 (0)| 00:00:01 | | |
|* 9 | TABLE ACCESS BY GLOBAL INDEX ROWID| ih | 10 | 890 | 2 (0)| 00:00:01 | ROWID | ROWID |
|* 10 | INDEX RANGE SCAN | IH_PAYPK_PAYERNS_PAYID | 5 | | 1 (0)| 00:00:01 | | |
| 11 | TABLE ACCESS BY INDEX ROWID | rd | 9 | 171 | 3 (0)| 00:00:01 | | |
|* 12 | INDEX RANGE SCAN | IDX_rd | 9 | | 2 (0)| 00:00:01 | | |
Predicate Information (identified by operation id):
2 - access("IH"."UPPERINVOICENUM"="RD"."UPPERINVNUM")
6 - access("AT"."ATTACHMENTPK"=7794833983)
8 - access("CD"."CHECKPK"="AT"."CHECKPK")
9 - filter("IH"."INVOICESTATUSCD"<>'REJ' AND "IH"."INVOICESTATUSCD"<>'DNY')
10 - access("IH"."PAYPK"="CD"."PAYEEPAYPK" AND "IH"."PAYERNS"="CD"."PAYERNS" AND "IH"."PAYERPAYID"="CD"."PAYERPAYID")
12 - access("RD"."ATTACHPK"=7794833983)
Statistics
1 recursive calls
0 db block gets
71 consistent gets
0 physical reads
0 redo size
316 bytes sent via SQL*Net to client
240 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
3 rows processed
The 'select' Statement executes with in seconds resulting 3 distinct records, but the insert statement takes ~20sec(Elaps time per execution
as shown in AWR report) for one time execution, so what must be the reason , and how should i proceed to resolve this performance issue?You can do as follows:
- Enable trace
- execute the insert statement
- use tkprof (and put the results here) to see where's its taking long
Also, while insert is being executed, what are the wait events you see ?
I dont think there is problem with plan. -
Performance issue with insert query !
Hi ,
I am using dbxml-2.4.16, my node-storage container is loaded with a large document ( 54MB xml ).
My document basically contains around 65k records in the same table ( 65k child nodes for one parent node ). I need to insert more records in to my DB, my insert XQuery is consuming a lot of time ( ~23 sec ) to insert one entry through command-line and around 50sec through code.
My container is indexed with "node-attribute-equality-string". The insert query I used:
insert nodes <NS:sampleEntry mySSIAddress='70011' modifier = 'create'><NS:sampleIPZone1Address>AABBCCDD</NS:sampleIPZone1Address><NS:myICMPFlag>1</NS:myICMPFlag><NS:myIngressFilter>1</NS:myIngressFilter><NS:myReadyTimer>4</NS:myReadyTimer><NS:myAPNNetworkID>ggsntest</NS:myAPNNetworkID><NS:myVPLMNFlag>2</NS:myVPLMNFlag><NS:myDAC>100</NS:myDAC><NS:myBcastLLIFlag>2</NS:myBcastLLIFlag><NS:sampleIPZone2Address>00000000</NS:sampleIPZone2Address><NS:sampleIPZone3Address>00000000</NS:sampleIPZone3Address><NS:sampleIPZone4Address>00000000</NS:sampleIPZone4Address><NS:sampleIPZone5Address>00000000</NS:sampleIPZone5Address><NS:sampleIPZone6Address>00000000</NS:sampleIPZone6Address><NS:sampleIPZone7Address>00000000</NS:sampleIPZone7Address></NS:sampleEntry> into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable)
If I modify my query with
into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:sampleTable/NS:sampleEntry[@mySSIAddress='1']
insted of
into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable)
Time taken reduces only by 8 secs.
I have also tried to use insert "after", "before", "as first", "as last" , but there is no difference in performance.
Is anything wrong with my query, what should be the expected time to insert one record in a DB of 65k records.
Has anybody got any idea regarding this performance issue.
Kindly help me out.
Thanks,
Kapil.Hi George,
Thanks for your reply.
Here is the info you requested,
dbxml> listIndexes
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
Index: node-attribute-equality-string for node {}:mySSIAddress
2 indexes found.
dbxml> info
Version: Oracle: Berkeley DB XML 2.4.16: (October 21, 2008)
Berkeley DB 4.6.21: (September 27, 2007)
Default container name: n_b_i_f_c_a_z.dbxml
Type of default container: NodeContainer
Index Nodes: on
Shell and XmlManager state:
Not transactional
Verbose: on
Query context state: LiveValues,Eager
The insery query with update takes ~32 sec ( shown below )
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS';insert nodes <NS:sampleEntry mySSIAddress='70000' modifier = 'create' ><NS:sampleIPZone1Address>AABBCCDD</NS:sampleIPZone1Address><NS:myICMPFlag>1</NS:myICMPFlag><NS:myIngressFilter>1</NS:myIngressFilter><NS:myReadyTimer>4</NS:myReadyTimer><NS:myAPNNetworkID>ggsntest</NS:myAPNNetworkID><NS:myVPLMNFlag>2</NS:myVPLMNFlag><NS:myDAC>100</NS:myDAC><NS:myBcastLLIFlag>2</NS:myBcastLLIFlag><NS:sampleIPZone2Address>00000000</NS:sampleIPZone2Address><NS:sampleIPZone3Address>00000000</NS:sampleIPZone3Address><NS:sampleIPZone4Address>00000000</NS:sampleIPZone4Address><NS:sampleIPZone5Address>00000000</NS:sampleIPZone5Address><NS:sampleIPZone6Address>00000000</NS:sampleIPZone6Address><NS:sampleIPZone7Address>00000000</NS:sampleIPZone7Address></NS:sampleEntry> into doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable"
Time in seconds for command 'query': 32.5002
and the query without the updation part takes ~14 sec ( shown below )
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS'; doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//NS:NS//NS:sampleTable"
Time in seconds for command 'query': 13.7289
The query :
time query "declare namespace foo='MY-SAMPLE';declare namespace NS='NS'; doc('dbxml:/n_b_i_f_c_a_z.dbxml/doc_Running-SAMPLE')//PMB:sampleTable/PMB:sampleEntry[@mySSIAddress='1000']"
Time in seconds for command 'query': 0.005375
is very fast.
The Updation of the document seems to consume much of the time.
Regards,
Kapil. -
Performance issue when inserting into spatial indexed table with JDBC
We have a table named 'feature' which has a "sdo_geometry" column, and we created spatial index on that column,
CREATE TABLE feature ( id number, desc varchar, oshape sdo_gemotry)
CREATE INDEX feature_sp_idx ON feature(oshape) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
Then we executed the following SQL to insert about 800 records into that table(We tried this by using DB visualizer and
our Java application, both of them were using JDBC driver to connect to the oracle 11gR2 database) .
insert into feature(id,desc,oshape) values (1001,xxx,xxxxx);
insert into feature (id,desc,oshape) values (1002,xxx,xxxxx);
insert into feature (id,desc,oshape) values (1800,xxx,xxxxx);
We encoutered the same problem as this topic
Performance of insert with spatial index
It takes nearly 1 secs for inserting one record,compare to 50 records inserted per sec without spatial index,
which is 50x drop in peformance when doing insertion with spatial index.
However, when we copy and paste those insertion scripts into Oracle Client(same test and same table with spatial index), we got a totally different performance result:
more than 50 records inserted in 1 secs, just as fast as the insertion without building spatial index.
Is it because Oracle Client is not using JDBC? Perhaps JDBC was got something wrong when updating those spatial indexed tables.
Edited by: 860605 on 19/09/2011 18:57
Edited by: 860605 on 19/09/2011 18:58
Edited by: 860605 on 19/09/2011 19:00Normally JDBC use auto-commit. So each insert can causes a commit.
I don't know about Oracle Client. In sqlplus, insert is just a insert,
and you execute "commit" to explicitly commit your changes.
So maybe this is the reason. -
Need to disable the insert edit in Timeline.
I'm piecing together a video to music right now and am finding that, when I drop and drag clips from the viewer to the timeline, I accidentally use the insert edit, only to find later on that some of my clips have been unknowingly moved around. Is there any way to disable the insert edit arrow in the timeline and only have the overwrite edit arrow active?
Thanks!If you prefer dragging directly to the timeline, then you'll need to pay attention to where your mouse pointer is located in the appropriate video track before you release the mouse button. If you look at an empty video track, you'll notice a line that runs just above the center of the track. If you drag a clip and your mouse is above that divider line, you'll perform an Insert Edit, if your mouse is below that divider, then you'll perform an Overwrite Edit. You'll see the mouse pointer change indicating the edit that you're about to perform.
From the FCP Users Manual:
http://dl.getdropbox.com/u/19589/Timeline%20Edit%20Zones.png
I will second the advice that was already given, performing edits with the keyboard or the Canvas overlays is MUCH more accurate than dragging directly to the timeline. -
Low Performance from FORALL Insert
Hi,
I have to insert some bulk records into a table so I create a index by table variable
type mytabletype mytable%rowtype index by binary_integer;
mytablevariable mytabletype;
Then I populate the data after processing into this variable by running in a loop:
loop
--process and generate column values here
mytablevariable(idx).column1:=value1;
mytablevariable(idx).column2:=value2;
idx:=idx+1;
end loop;
then i use a forall to do the bulk insert
forall newidx in mytablevariable.first .. mytablevariable.last
insert into mytable values mytablevariable(newidx);
I printed the time taken for various steps and found that forall is the bottle neck . For inserting some 50000 records it is taking almost 4 mins!!. Is there something wrong in the way I am populating data into table variable?
-SumitSumit Chauhan wrote:
I did a kind of similar operation for testing whereby I did a BULK COLLECT into a nested table variable and inserted the same data by using FORALL into another table (with same schema). The insert took close to 10 secs.Using elapsed time as a baseline for measuring database performance is totally flawed. I often post the following example here. The very same SQL. Same execution plan. Same data. Executed within seconds of one another. But vastly different execution times. So if the very same SQL has variable execution times, how do you expect to measure different techniques and SQLs and execution plans and the like using time?
SQL> set timing on
SQL> select count(*) from all_objects;
COUNT(*)
65121
Elapsed: 00:00:23.31
SQL> select count(*) from all_objects;
COUNT(*)
65121
Elapsed: 00:00:01.53The major reason for the difference in this example is physical I/O (1st SQL) and logical I/O (2nd SQL). The second query benefited from the I/O done by the first query, loading data into the buffer cache.
If you want to measure, you need to measure work. The amount of work that needs to be done and not how long it took to do that work. As the above example clearly shows that a query doing the same amount of work, can do it in different elapsed execution times.
Moreover, I kind of need to pull data from one table do some time consuming processing and store the results into another table so as to save the processing time , when results of calculation are used.The best way to do this, is to only use the SQL engine. As soon as you use the PL language, you introduce another software layer and increase the number of moving parts.
Thus the mantra of Maximize SQL and Minimize PL/SQL+.
No other language is as fast and as capable as SQL when it comes to crunching database data. If you do need to add PL into the mix because SQL is simply not capable of performing the required processing, then you will use bulk collection.
Bulk collection does one and one thing only. It creates a bigger "+communication pipe+" between the SQL and PL engines. So instead of PL getting a single row at a time from the SQL engine, it gets a batch of a 100. Instead of it sending a single row at a time to the SQL engine, it sends a 100.
This reduces the number of context switches between the two - and increases performance. However, this is not a linear increase. It does not mean that the bigger the communication pipe, the faster the bulk processing.
Also, the bigger you make this pipe, the more expensive non-shared memory (PGA) is needed.
So there is a very real limit to the performance improvement you will see with bulk processing. And there is a direct cost, in terms of expensive PGA, associated with it.
The PL engine's default bulk processing limit is a 100 rows. You may found slight performance improvement when using a limit of a 1000 rows. Beyond that, unlikely to see any performance improvement. In fact, you may see the opposite as the amount of private memory consumed can negatively impact server memory, increase swapping, and slow the entire server down. -
Problems with the "INSERT" button.
Hi,
I have a problem in my homework. I am required to do the following:
'original numbers' array contains zeros. Let LabVIEW fill an array "original numbers" by random integers from 10 to 90 at a rate 1 number/0.5 seconds by replacing each zero at a time from top to bottom. (DONE)
user fills in 10numbers in an array 'numbers to be probably inserted'. Then the user decides if he needs to change a generated number that he doesn't like by changing the 'Insert' array.
Then he presses the INSERT button and a resulting array would appear containing the elements the user changed......
This video might clarify:
http://www.youtube.com/watch?v=dDXo2ABqNM4
The problem I am facing is the INSERT button. In the video, the moment it is switched the program will continue to the last part.
I am attaching the vi. I think there are no logical mistakes in the program except the INSERT case structure.
Thank You.
P.S. The version is LabView2010 ; I'm getting error trying to save to previous versions sorry.
Solved!
Go to Solution.
Attachments:
INSERT.vi 18 KBA.A.A. wrote:
What does it mean to disable auto-indexing?
I didn't understand why we used the reshape array palette. What are the dimensions of the input and the output? Very nice way how you made a length 10 zero array. (i'll use that when i figure the solution of the dimension problem.)
Did you use the 100ms wait in order not to affect computer performance or for other reason?
How where you able to connect the 'changed numbers' array to Not Equal Palette?
From where did you get the "replace" button? I think my "insert" button does the oppositeof what it should do.
Your code sitll has major flaws. Your questions are very basic and I recommend to do a few tutorials.
If you wire an array across a loop boundary, the tunnel can have two modes (plain (solid square) or autoindexing (contains a small set of square brackets)). In your case, you are autoidenxing the 1D array, creating a 2D array (double-line) at the output of the first loop. You are generating 10x too much data! (create an 10x10 indicator on the 2D array to see what you are actually doing!). You can right-click a tunnel to switch between indexing modes. A plain tunnel transports the array data unchanged. An autoindexing output tunnel, creates an array with a higher dimension, in your case a 2D array from a 1D array with one new row per iteration. If you autoiindex a scalar, you get a 1D array with one element per iteration. An autoidexing input tunnel does the reverse. If you wire a 1D array to a FOR loop using autoindexing, you get a scalar per iteration and the FOR loop will stop once the array runs out of elements. Is it equavalent (with some important differences) to wiring without autoidenxing, then using "index array" with the index wired to [i] as you currently do. In your case, you chould get the 1D array from the shift register of the first loop, it has all the information(!), and disable autoidexing at the boundary of the second loop and the outcome would be the same, except you use only 10% of the memory.
Once you are autoidexing at a loop boundary, a FOR loop iteration count will be determined by the size of the smallest autoindexing array. This would be a problem if you later want to change the code to operate on e.g. 20 elements, because the other two arrays in my code would force the loop to stop after 10 iterations. "Resize array" can be used for padding/trimming arrays and in this case we are forcing them to be the lenght on the main array to ensure that the FOR loop does not stop prematurely. In your case, the replace and switch arrays are empty by default, so the loop would not spin at all unless you would enter some values. "resize array" brings them up to size.
Yes, you need a small wait either inside the other case or elsewhere in the while loop. Without a wait, the basically empty loop will spin millions of times per second, consuming all CPU in the process while doing nothing. No human can click a button with that kind of time resolution, so a 100ms wait is not noticeable, but will drop the CPU use to negligible levels. Your computer has dozens of processes running at any given time. Imagine how well it would work if all programs would consume all CPU they can possibly get?
I am comparing two arrays, and the output will be a boolean array. You are only comparing two scalars and you won't get an array. You also don't need the "AND", because if the values are different it has to be true anyway. In your case you would need to carry a boolean array similar to the number array, replacing elements as you go.
A button is a button is a button. There should be no difference. You can change the label, boolean text, default value, and mechanical action to match your requirements.
A.A.A. wrote:
I have done so to initialize the arrays full of zeros yet the way you did it way easier. How did u initialize them to zeros?(from where did you get the palettes? I have attached a picture clarifing my question.
These are local variables. You don't need to find them in the palettes. Simply right-click a terminal and "create local variable". Voila!
(Local variables can be used to read from an indicator or write to a control. However, because they break dataflow, you can generate dangerous race conditions. They also force extra data copies in memory. Don't use them like "variables" in text based code. Except for initialization and user interface interactions, they should be used sparingly and are rarely needed. In principle, my code has a theoretical race condition because the order of operations is not determined between the three independent code sections. For example if the initializion would happen after the second loop executes, you would get an unexpected result. It will never happen in this particular case, but in other scenarios it could be a problem.)
LabVIEW Champion . Do more with less code and in less time . -
Hello,
I have deployed the BC4J application on Oracle 9iAS.When i insert data quiery or for that matter do any query with the database as Oracle9i I have to wait longer time (35 seconds) before i receive the thankyou page.I was running the same insert page in JRun and it submits instantly. Can anyone let me know why is this so and what do i need to do.?I thought 9i is real quick??
Thanks in advance.
nikhilTo help narrow down your problem, I'd recommend the following:
[list=1]
[*]Create a new project
[*]Default an EO, VO, AM for the EMP sample table in the SCOTT schema
[*]Default a BC4J JSP Browse-Edit page for the "EmpView"
[*]Test it in the local JDeveloper, and try the insert
[*]Deploy to OC4J
[*]Repeat the test above
[list]
Does even this simple one-table app have insert performance issues in your environment?
We're not seeing a general problem of insert performance here. Thanks. -
How to improve the write performance of the database
Our application is a write intense application, maybe will write 2M/second data to the database, how to improve the performance of the database? We mainly write to 5 tables of the database.
Currently, the database get no response and the CPU is 100% used.
How to tuning this? thanks in advance.Your post says more by what is not provided than by what is provided. The following is the minimum list of information needed to even begin to help you.
1. What hardware (server, CPU, RAM, and NIC and HBA cards if any pointing to storage).
2. Storage solution (DAS, iSCSCI, SAN, NAS). Provide manufacturer and model.
3. If RAID which implementation of RAID and on how many disks.
4. If NAS or SAN how is the read-write cache configured.
5. What version of Oracle software ... all decimal points ... for example 11.1.0.6. If you are not fully patched then patch it and try again before asking for help.
6. What, in addition to the Oracle database, is running on the server?
2MB/sec. is very little. That is equivalent to inserting 500 VARCHAR2(4000)s. If I couldn't do 500 inserts per second on my laptop I'd trade it in.
SQL> create table t (
2 testcol varchar2(4000));
Table created.
SQL> set timing on
SQL> BEGIN
2 FOR i IN 1..500 LOOP
3 INSERT INTO t SELECT RPAD('X', 3999, 'X') FROM dual;
4 END LOOP;
5 END;
6 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.07
SQL>Now what to do with the remaining 0.93 seconds. <g> And this was on a T61 Lenovo with a slow little 7500RPM drive and 4GB RAM running Oracle Database 11.2.0.1. But I will gladly repeat it using any currently supported version of the product. -
Read a CSV file and dynamically generate the insert
I have a requirement where there are multiple csv's which needs to be exported to a sql table. So far, I am able to read the csv file and generate the insert statement dynamically for selected columns however, the insert statement when passed as a parameter
to the $cmd.CommandText
does not evaluate the values
How to evaluate the string in powershell
Import-Csv -Path $FileName.FullName | % {
# Insert statement.
$insert = "INSERT INTO $Tablename ($ReqColumns) Values ('"
$valCols='';
$DataCols='';
$lists = $ReqColumns.split(",");
foreach($l in $lists)
$valCols= $valCols + '$($_.'+$l+')'','''
#Generate the values statement
$DataCols=($DataCols+$valCols+')').replace(",')","");
$insertStr =@("INSERT INTO $Tablename ($ReqColumns) Values ('$($DataCols))")
#The above statement generate the following insert statement
#INSERT INTO TMP_APPLE_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )
$cmd.CommandText = $insertStr #does not evaluate the values
#If the same statement is passed as below then it execute successfully
#$cmd.CommandText = "INSERT INTO TMP_APL_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )"
#Execute Query
$cmd.ExecuteNonQuery() | Out-Null
jyeragiHi Jyeragi,
To convert the data to the SQL table format, please try this function out-sql:
out-sql Powershell function - export pipeline contents to a new SQL Server table
If I have any misunderstanding, please let me know.
If you have any feedback on our support, please click here.
Best Regards,
Anna
TechNet Community Support -
We have the SharePoint Server 2010 with SP1 environment on which the custom SP2010 designer pages were working as expected before the
August 13, 2013 CU has installed. But, getting the below exception while trying to add the new item after the CU has installed.
Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteInsert(IDictionary values) at
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
06/19/2014 16:49:37.65 w3wp.exe (0x1240) 0x1300 SharePoint Foundation
Runtime tkau Unexpected Microsoft.SharePoint.WebPartPages.DataFormWebPartException: The data source control
failed to execute the insert command. 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc at Microsoft.SharePoint.WebPartPages.DataFormWebPart.InsertCallback(Int32 affectedRecords, Exception ex) at System.Web.UI.DataSourceView.Insert(IDictionary
values, DataSourceViewOperationCallback callback) at Microsoft.SharePoint.WebPartPages.DataFormWebPart.FlatCommit() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.HandleOnSave(Object sender, EventArgs e)
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean
inclu... 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
06/19/2014 16:49:37.65* w3wp.exe (0x1240) 0x1300 SharePoint Foundation
Runtime tkau Unexpected ...deStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3b64c3a0-48f3-4d4a-af54-d0a2fc4553cc
I have tried changing the "DataSourceMode" as below, now the insert command is working, but update command is not working.
<SharePoint:SPDataSource runat="server" DataSourceMode="ListItem" />
Also, the lookup dropdown fields are displaying the value as "<a href="Daughterhttp://cpsp10/sites/Employees/_layouts/listform.aspx?PageType=4&ListId={8F62F444-FB6A-4F03-9522-C4696B45DCD1}&ID=10&RootFolder=*">Daughter</a>"
instead of only "Daughter".
Please provide the solution to get rid of this issue.
Thanks
RamasubbuTry below:
http://social.technet.microsoft.com/Forums/en-US/ae910269-3a0c-4506-844b-e8bc89d95b71/data-source-control-failed-to-execute-the-insert-command
http://blog.jussipalo.com/2012/01/sharepoint-2010-data-source-control.html
While there can be many causes for this generic error message, in my case the first parameter or ddwrt:DataBind function inside the SharePoint:FormFields element was
'i' and I was working with an Edit Form. Changing it to
'u' as it was with every other FormField fixed the issue.
<SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="Edit" FieldName="Esittaja" __designer:bind="{ddwrt:DataBind('u',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Esittaja')}"
/>
Explanation:
DataBind operation type parameters (the first parameter) are listed below:
'i' stands for INSERT,
'u' stands for UPDATE,
'd' stands for DELETE.
http://webcache.googleusercontent.com/search?q=cache:d9HHY4I7omgJ:thearkfloats.blogspot.com/2014/03/sharepoint-2010-data-source-control.html+&cd=4&hl=en&ct=clnk&gl=in
If this helped you resolve your issue, please mark it Answered
Maybe you are looking for
-
Invoice without referencing Purchase Order
Hi When an invoice comes with out referencing purchase order then accounts payable does not have a way to look up the supplier and see if there is any PO issue against it . This causes as some invoices are being paid manually instead of from the issu
-
Dear all, I have a report format : Field 1 Field 2 Field 3 XXX XXXXX XXXX XXX XXXXX XXXX XXX XXXXX XXXX I want to change this format to : Field 1 Field 2
-
What happens with Typekit license, if cc subscription doesn't exist any more?
If I use Typekit fonts to create a website for a customer in Adobe Muse, and I then cancel my CC subscription (let's say, because I am retiring), what happens to the website of my customer. Will the fonts still show up?
-
hi, the fowwing error is doing while post the invoice " " enter your Tax code " i have tried all the default ( f4) tax codes tried , but saying error " your input is high " pls explain ? where i did wrong ? - explain step by step ? ali Edited by: mo
-
Possible to execute complex query in ExecuteSQL method in DI Server??
Hi All, Is it Possible to execute complex query in ExecuteSQL Method in DI Server? Regards, G.Suresh