Query simplification
Hi Gurus,
i am trying to get the result data(only one records based on multiple record combination) for the following query from only one table where combination presents in records, can any one help me making the following query to simple
SELECT result0.routing_group_id
FROM (SELECT routing_group_id, routing_rule_id
FROM workflow_routing_assoc
WHERE routing_rule_value = 'test-example') result0,
(SELECT routing_group_id, routing_rule_id
FROM workflow_routing_assoc
WHERE routing_rule_value = '12') result1,
(SELECT routing_group_id, routing_rule_id
FROM workflow_routing_assoc
WHERE routing_rule_value = 'sep') result2,
(SELECT routing_group_id, routing_rule_id
FROM workflow_routing_assoc
WHERE routing_rule_value = '2010') result3
WHERE result0.routing_rule_id = 8
AND result1.routing_rule_id = 5
AND result2.routing_rule_id = 2
AND result3.routing_rule_id = 9
AND result0.routing_group_id = result1.routing_group_id
AND result1.routing_group_id = result2.routing_group_id
AND result2.routing_group_id = result3.routing_group_idThanks in advance
Parthiban Kumar
hi all,
Thanks for the strict yet kindfull information and i hope the following information will be sufficent .
Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
/* Formatted on 10/11/2011 6:54:19 PM (QP5 v5.126) */
CREATE TABLE workflow_routing_assoc
wf_routing_assoc_id NUMBER, -- unique id
routing_group_id NUMBER, -- common id for the four combination
routing_rule_id NUMBER, -- this column differnciates the information provided eg: date,day,month,year
routing_rule_value VARCHAR2 (50 BYTE), -- this column contains the information for the routing_rule_id(third column) eg: 01(date),wed(day),month(sep),year(2011)
created_by VARCHAR2 (50 BYTE), --created user name
created_date timestamp (6), --created date
modified_by VARCHAR2 (50 BYTE), -- modifying user name
modified_date timestamp (6)
) --modified date
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (1,
55,
8,
'test-example');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (2,
55,
5,
'12');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (3,
55,
2,
'sep');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (4,
55,
9,
'2010');
COMMIT;
SQL> SELECT result0.routing_group_id
2 FROM (SELECT routing_group_id, routing_rule_id
3 FROM workflow_routing_assoc
4 WHERE routing_rule_value = 'test-example') result0,
5 (SELECT routing_group_id, routing_rule_id
6 FROM workflow_routing_assoc
7 WHERE routing_rule_value = '12') result1,
8 (SELECT routing_group_id, routing_rule_id
9 FROM workflow_routing_assoc
10 WHERE routing_rule_value = 'sep') result2,
11 (SELECT routing_group_id, routing_rule_id
12 FROM workflow_routing_assoc
13 WHERE routing_rule_value = '2010') result3
14 WHERE result0.routing_rule_id = 8
15 AND result1.routing_rule_id = 5
16 AND result2.routing_rule_id = 2
17 AND result3.routing_rule_id = 9
18 AND result0.routing_group_id = result1.routing_group_id
19 AND result1.routing_group_id = result2.routing_group_id
20 AND result2.routing_group_id = result3.routing_group_id;
op:
ROUTING_GROUP_ID
55parthiban kumar
Similar Messages
-
Need help on query simplification...!!
Hi All,
I need help on below query simplification using idempotence rules.
SELECT ENO FROM AGS WHERE RESP = "Analyst" AND NOT (PNO = "P2" OR DUR = 12) AND PNO != "P2" AND DUR = 12;
Thanks.928351 wrote:
Hi All,
I need help on below query simplification using idempotence rules.
SELECT ENO FROM AGS WHERE RESP = "Analyst" AND NOT (PNO = "P2" OR DUR = 12) AND PNO != "P2" AND DUR = 12;
Thanks.How do we know what the correct result set is?
Handle: 928351
Status Level: Newbie
Registered: Apr 17, 2012
Total Posts: 4
Total Questions: 3 (3 unresolved)
ZERO for three! STRIKE 3 you are out! -
Help for efficient/better query
DB Details:
Oracle 11g R2 - 11.2.0.1
CREATE TABLE workflow_routing_assoc
wf_routing_assoc_id NUMBER, -- unique id
routing_group_id NUMBER, -- common id for the four combination
routing_rule_id NUMBER, -- this column differnciates the information provided eg: date,day,month,year
routing_rule_value VARCHAR2 (50 BYTE), -- this column contains the information for the routing_rule_id(third column) eg: 01(date),wed(day),month(sep),year(2011)
created_by VARCHAR2 (50 BYTE), --created user name
created_date timestamp (6), --created date
modified_by VARCHAR2 (50 BYTE), -- modifying user name
modified_date timestamp (6)
) --modified date
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (1,
55,
8,
'test-example');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (2,
55,
5,
'12');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (3,
55,
2,
'sep');
INSERT INTO workflow_routing_assoc (wf_routing_assoc_id,
routing_group_id,
routing_rule_id,
routing_rule_value)
VALUES (4,
55,
9,
'2010');
COMMIT;
-- NEED A BETTER QUERY INSTEAD OF THIS
*SQL> SELECT result0.routing_group_id*
*2 FROM (SELECT routing_group_id, routing_rule_id*
*3 FROM workflow_routing_assoc*
*4 WHERE routing_rule_value = 'test-example') result0,*
*5 (SELECT routing_group_id, routing_rule_id*
*6 FROM workflow_routing_assoc*
*7 WHERE routing_rule_value = '12') result1,*
*8 (SELECT routing_group_id, routing_rule_id*
*9 FROM workflow_routing_assoc*
*10 WHERE routing_rule_value = 'sep') result2,*
*11 (SELECT routing_group_id, routing_rule_id*
*12 FROM workflow_routing_assoc*
*13 WHERE routing_rule_value = '2010') result3*
*14 WHERE result0.routing_rule_id = 8*
*15 AND result1.routing_rule_id = 5*
*16 AND result2.routing_rule_id = 2*
*17 AND result3.routing_rule_id = 9*
*18 AND result0.routing_group_id = result1.routing_group_id*
*19 AND result1.routing_group_id = result2.routing_group_id*
*20 AND result2.routing_group_id = result3.routing_group_id;*
op:
ROUTING_GROUP_ID
55Thanks in advanceHi,
What's wrong with the solution in the other thread?
Query simplification
Point out where it's getting the wrong results, and explain how you get the right results in those places. Post some new sample data and results if necessary. -
Believe the bug to be related to the new cardinality estimator. In my case joining 7 tables it took 4 seconds to see the query execution plan, with 8 tables it took 1 minute and with 9 tables 15
minutes! the actual processing of the query plan was sub second. (each table has only two records...)
It looks as if there is a workload in the cardinality estimator that escalates as the number of tables and join columns increases.
We have a number of these queries in our application and the bug is a showstopper for our customers. They will have to set compatibility level to 110 (sqlserver 2012) to run the app. Then they should
probably not upgrade from 2012...
Is this a known bug? What is the bug number? How can I follow the bug to see when it is fixed?
Here is my testcase: (first building tables and data, and then the query with some comments. A version spending 15 minutes in the optimizer, takes 0 seconds to complete with the hint "option (QUERYTRACEON 9481) ". we can't use this
hint in the application because no dba will allow an application like ours to run as sysadmin...
SCRIPT:
-- Example has one table containing 25 rows. another containing 2 rows.
-- The one with two rows is joined in several times.
-- In the original query each of these joins were to separate tables.
-- I use this simplification because it makes it easier to build the testcase.
------------ CREATE TEST CASE ----------
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[oleclient](
[acc_f_agio] [varchar](25) NOT NULL DEFAULT (' '),
[acc_f_dag] [varchar](25) NOT NULL DEFAULT (' '),
[acc_notes_ap] [varchar](25) NOT NULL DEFAULT (' '),
[acc_notes_ar] [varchar](25) NOT NULL DEFAULT (' '),
[acc_per_cost] [varchar](25) NOT NULL DEFAULT (' '),
[acc_per_inc] [varchar](25) NOT NULL DEFAULT (' '),
[acc_reverse] [varchar](25) NOT NULL DEFAULT (' '),
[acc_undec_ap] [varchar](25) NOT NULL DEFAULT (' '),
[acc_undec_ar] [varchar](25) NOT NULL DEFAULT (' '),
[acc_vat_pay] [varchar](25) NOT NULL DEFAULT (' '),
[attr_id_balance] [varchar](4) NOT NULL DEFAULT (' '),
[bal_acc_v2] [varchar](25) NOT NULL DEFAULT (' '),
[bal_acc_v3] [varchar](25) NOT NULL DEFAULT (' '),
[balance_acc] [varchar](25) NOT NULL DEFAULT (' '),
[bank_fee_acc] [varchar](25) NOT NULL DEFAULT (' '),
[bflag] [int] NOT NULL DEFAULT ((0)),
[client] [varchar](25) NOT NULL DEFAULT (' '),
[client_name] [varchar](255) NOT NULL DEFAULT (' '),
[comp_reg_no] [varchar](25) NOT NULL DEFAULT (' '),
[compress_flag] [tinyint] NOT NULL DEFAULT ((0)),
[country] [varchar](255) NOT NULL DEFAULT (' '),
[country_code] [varchar](25) NOT NULL DEFAULT (' '),
[cur_client] [varchar](25) NOT NULL DEFAULT (' '),
[cur_item] [tinyint] NOT NULL DEFAULT ((0)),
[cur_type] [varchar](25) NOT NULL DEFAULT (' '),
[cur_type_tri] [varchar](25) NOT NULL DEFAULT (' '),
[curr_period] [int] NOT NULL DEFAULT ((0)),
[currency] [varchar](25) NOT NULL DEFAULT (' '),
[currency_tri] [varchar](25) NOT NULL DEFAULT (' '),
[currency_v2] [varchar](25) NOT NULL DEFAULT (' '),
[currency_v3] [varchar](25) NOT NULL DEFAULT (' '),
[diff_acc_v2] [varchar](25) NOT NULL DEFAULT (' '),
[diff_acc_v3] [varchar](25) NOT NULL DEFAULT (' '),
[diff_account] [varchar](25) NOT NULL DEFAULT (' '),
[diff_chk_v2] [tinyint] NOT NULL DEFAULT ((0)),
[diff_chk_v3] [tinyint] NOT NULL DEFAULT ((0)),
[dim_v2_type] [varchar](25) NOT NULL DEFAULT (' '),
[dim_v3_type] [varchar](25) NOT NULL DEFAULT (' '),
[employer_id] [varchar](12) NOT NULL DEFAULT (' '),
[header] [varchar](30) NOT NULL DEFAULT (' '),
[header2] [varchar](30) NOT NULL DEFAULT (' '),
[headquarter] [varchar](25) NOT NULL DEFAULT (' '),
[language] [varchar](2) NOT NULL DEFAULT (' '),
[last_update] [datetime] NOT NULL DEFAULT (CONVERT([datetime],'19000101 00:00:00:000',(9))),
[leg_act_cli] [varchar](25) NOT NULL DEFAULT (' '),
[max_inv_diff] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[max_inv_diff_v2] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[max_inv_diff_v3] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[max_pay_diff] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[max_pay_diff_v2] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[max_pay_diff_v3] [decimal](28, 3) NOT NULL DEFAULT ((0.0)),
[municipal] [varchar](25) NOT NULL DEFAULT (' '),
[overrun_pct] [decimal](28, 8) NOT NULL DEFAULT ((0.0)),
[pay_client] [varchar](25) NOT NULL DEFAULT (' '),
[pay_diff_acc_g] [varchar](25) NOT NULL DEFAULT (' '),
[pay_diff_acc_l] [varchar](25) NOT NULL DEFAULT (' '),
[pay_ref] [varchar](25) NOT NULL DEFAULT (' '),
[period_no] [smallint] NOT NULL DEFAULT ((0)),
[remind_ref] [varchar](20) NOT NULL DEFAULT (' '),
[rev_vat_disc_ap] [tinyint] NOT NULL DEFAULT ((0)),
[rev_vat_disc_ar] [tinyint] NOT NULL DEFAULT ((0)),
[sys_setup_code] [varchar](2) NOT NULL DEFAULT (' '),
[tax_office_no] [varchar](50) NOT NULL DEFAULT (' '),
[tax_office_ref] [varchar](20) NOT NULL DEFAULT (' '),
[tax_system] [varchar](25) NOT NULL DEFAULT (' '),
[user_id] [varchar](25) NOT NULL DEFAULT (' '),
[vat_reg_no] [varchar](25) NOT NULL DEFAULT (' '),
[agrtid] [bigint] IDENTITY(1,1) NOT NULL,
UNIQUE NONCLUSTERED
[agrtid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8081','8181',' ',' ','2442','1481','9998',' ',' ','1320',' ','9998',' ',' ','8110','0','UK','Agresso Demo UK','987654321012','0','United Kingdom','GB','UK','1','1','EU','200409','GBP','EUR','EUR','USD','9998','9998','9998','1','0','EU','$',' ','Agresso
demo','Corporate Office','NO','EN','2004-09-27 12:39:00.000','UK',0.020,0.000,0.000,0.100,0.000,0.000,'0301',0.00000000,'UK','9998','9998','Jim Smith','12','Mike Anderson','0','0','EN','Bristol Brunel','V123/123',' ','JOSUTTON','123456789101');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8060','8160',' ',' ','2960','1480','1490',' ',' ',' ',' ',' ',' ',' ','7770','0','N1','N1 - Énklient','971332421','0','Norway','NO','N1','0','1',' ','200701','NOK',' ','EUR',' ',' ',' ','9999','0','0','E',' ','971332421','Agresso Demo Norge (NO)','Agresso
Demo Norge (NO)','NO','NO','2007-01-26 08:31:00.000','N1',0.050,0.000,0.000,0.500,0.000,0.000,'0301',5.00000000,'N1','9999','9999',' ','12',' ','0','0','NO',' ',' ',' ','SYSNO','971332421');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('900000','900000',' ',' ',' ',' ','900100',' ',' ',' ',' ',' ',' ',' ','470000','0','BE','DEMO Belgie',' ','0','Belgium','BE','BE','0','1',' ','200208','EUR',' ','USD','GBP',' ',' ','900100','0','0','2','3',' ',' ','Agresso Business World','BE','EN','2005-11-18
17:07:00.000','BE',0.050,0.000,0.000,0.050,0.000,0.000,'2018',0.00000000,'BE','900100','900100',' ','12',' ','0','0','BT',' ',' ',' ','SYSBE','BE461149381');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8030','8040',' ',' ','1250','2450','9998',' ',' ',' ',' ',' ',' ',' ','8060','0','A99','Seneca N.V. - Reporting / Intellagent',' ','0',' ','NL','A99','0','1',' ','201105','EUR',' ','USD',' ',' ',' ','9998','0','0','2',' ',' ','Seneca N.V. - Report / Intell','Seneca
N.V. - Report / Intell','A01','EN','2011-05-19 12:19:59.000','A99',0.010,0.000,0.000,5.000,0.000,0.000,' ',0.00000000,'A99','9998','9998',' ','12',' ','0','0','EN',' ',' ',' ','SYSTEM',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('766000','666000','445860','445870','486000','487000',' ','445806','445807','445806',' ',' ','DEVISES',' ',' ','3','FR','Agresso Demo France',' ','0','France','FR','FR','1','1','1','200509','EUR','EUR',' ','FRF',' ','DEVISES','471000','0','1',' ','1',' ','Agresso
demo France','Agresso demo France','FR','FR','2005-08-30 09:27:00.000','FR',0.100,0.000,0.500,10.000,0.000,0.000,'92',0.00000000,'FR',' ',' ',' ','12',' ','0','0','FR',' ',' ',' ','SYSFR','FR12345678');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ','9999',' ',' ',' ',' ',' ',' ',' ',' ','0','AU','Agresso Australia','123456789','0','Australia','AU','AU','0','1',' ','200708','AUD',' ',' ',' ',' ',' ','9999','0','0',' ',' ',' ','Agresso demo Australia','Corporate Office','AU','AU','2007-04-19
12:40:00.000','AU',0.000,0.000,0.000,0.000,0.000,0.000,' ',0.00000000,'AU','9999','9999',' ','12',' ','0','0','AU',' ',' ',' ','SYSAU','123456789')
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8060','8160',' ',' ','2960','1480','1490',' ',' ',' ',' ',' ',' ',' ','7770','0','NO','Agresso Demo Norge (NO)','971332425','0','Norway','NO','NO','0','1',' ','201401','NOK',' ','EUR',' ',' ',' ','9999','0','0','E',' ','971332425','Agresso Demo Norge (NO)','Agresso
Demo Norge (NO)','NO','NO','2014-01-11 12:34:54.000','NO',0.050,0.000,0.000,0.500,0.000,0.000,'0301',5.00000000,'NO','9999','9999',' ','12',' ','0','0','NO',' ',' ',' ','SYSNO','971332425');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('9999','9999',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','9999','0','SF','Agresso Demo SF',' ','0','Finland','SF','SF','0',' ',' ','0','FIM',' ',' ',' ',' ',' ','9999','0','0',' ',' ',' ','Agresso Demo','Hovedkontoret','SF','SE','1996-01-18 03:25:00.000','SF',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'SF','9999','9999',' ','12',' ','0','0','SF',' ',' ',' ','SYSTEM',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','US','Agresso Demo Corp.',' ','0',' ','US','US','1',' ',' ','199702','USD',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ','Agresso Demo Corp.','Headquarter','US','US','1997-01-21 02:45:00.000','US',0.020,0.000,0.000,5.000,0.000,0.000,'
',0.00000000,'US',' ',' ','John Smith','12','Elsa Beskow','0','0','EN',' ',' ',' ','SYSNO',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8081','8181',' ',' ','2442','1481','9998',' ',' ','1320',' ','9998',' ',' ','8110','0','EN','Agresso Demo','987654321012','0','United Kingdom','GB','EN','1','1','EU','201401','GBP','EUR','EUR','USD','9998','9998','9998','1','0','EU','$',' ','Agresso demo','Corporate
Office','NO','EN','2014-01-06 10:20:58.000','EN',0.020,0.010,0.000,0.100,0.000,0.000,'0301',0.00000000,'EN','9998','9998','Jim Smith','12','Mike Anderson','0','0','EN',' ',' ',' ','SYSEN','123456789101');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','10','Test company 10 (for multiclient)',' ','0',' ','GB','EN','0','1',' ','200801','GBP',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ','Test company 10 (multiclient)','Test company 10 (multiclient)','EN','EN','2008-05-07
10:57:51.000','EN',0.010,0.000,0.000,1.000,0.000,0.000,' ',0.00000000,'EN',' ',' ',' ','12',' ','0','0','EN',' ',' ',' ','SYSEN',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('4840','6880',' ',' ','1900','3900',' ','1410','3810','3810',' ','9998','9998',' ',' ','1','DE','D3 Demo Fibu/Projekt/Logistik','1277777001','0',' ','DE','DE','1','1','1','200204','EUR','EUR','USD','DEM','9998','9998','9998','1','1','2','1',' ','Agresso Demo
Fibu/Pr/Log','Agresso Demo Fibu/Pr/Log','DE','DE','2002-04-03 17:28:00.000','DE',0.050,0.000,0.000,5.000,0.000,0.000,' ',0.00000000,'DE','4720','4720',' ','12',' ','0','0','DE','Finanzamt München II',' ',' ','SYSDE','DE888999777');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','PF','Performance test company',' ','0',' ','GB','PF','0','1',' ','200910','GBP',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ',' ',' ','PF','EN','2009-10-14 15:49:10.000','PF',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'PF',' ',' ',' ','12',' ','0','0','EN',' ',' ',' ','SYSEN',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','01','RD Reporting Team - Test Client 01',' ','0',' ','NO','01','0',' ',' ','201101',' ',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ',' ',' ','01','EN','2013-10-22 13:29:46.000','01',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'01',' ',' ',' ','12','Vidar Bjørnson','0','0','EN',' ',' ',' ','REPDEV',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','02','RD Reporting Team - Test Client 02',' ','0',' ','NO','02','0',' ',' ','201101',' ',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ',' ',' ','01','EN','2013-10-22 13:30:11.000','02',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'02',' ',' ',' ','12','Vidar Bjørnson','0','0','EN',' ',' ',' ','REPDEV',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','03','RD Reporting Team - Test Client 03',' ','0',' ','NO','03','0',' ',' ','201101',' ',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ',' ',' ','01','EN','2013-10-22 13:30:47.000','03',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'01',' ',' ',' ','12','Vidar Bjørnson','0','0','EN',' ',' ',' ','REPDEV',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','9998',' ',' ',' ','0','FP','FIN PROC Test Project','321456987','0',' ','NO','FP','0','1','1','201206','EUR','EUR','USD','USD','9998','9998',' ','1','1','2','2',' ','FIN PROC Test Project','FIN PROC Test Project','FP','EN','2012-09-24
10:43:27.000','FP',0.000,0.000,0.000,0.000,0.000,0.000,' ',0.00000000,'FP',' ',' ',' ','12',' ','0','0','EN',' ',' ',' ','FRODE','321456987MVA');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
(' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','DM','Agresso Deployment Manager',' ','0',' ','NO','DM','0',' ',' ','201301',' ',' ',' ',' ',' ',' ',' ','0','0',' ',' ',' ',' ',' ','DM','EN','2013-11-06 13:55:17.000','DM',0.000,0.000,0.000,0.000,0.000,0.000,'
',0.00000000,'DM',' ',' ',' ','12',' ','0','0','EN',' ',' ',' ','SYSEN',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('3960','7960',' ',' ','1790','2990','2991',' ',' ',' ',' ',' ',' ',' ','6570','0','S1','Agresso Demo Client S1','556558-7893','0','Sweden','SE','S1','1','1',' ','200401','SEK',' ','NOK','EUR','8322','8321','3740','1','1','3','6','5565587893',' ','Utbildningsföretaget
AB','SE','SE','2005-02-10 22:04:00.000','S1',0.500,0.000,0.000,0.500,0.000,0.000,' ',0.00000000,'S1','3740','3740','Anna Kronstam','12','Thomas Jelf','0','0','SE',' ',' ',' ','SYSEN','SE556558789301');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('3960','7960',' ',' ','1790','2990','2991',' ',' ',' ',' ',' ',' ',' ','6570','0','S2','Agresso Demo Client S2','556558-7893','0','Sweden','SE','S2','1','1',' ','200202','SEK',' ','NOK','EUR','8322','8321','3740','1','1','3','6','5565587893',' ','Utbildningsföretaget
AB','SE','SE','2005-01-17 13:20:00.000','S2',0.500,0.000,0.000,0.500,0.000,0.000,' ',0.00000000,'S2','3740','3740','Anna Kronstam','12','Thomas Jelf','0','0','SE',' ',' ',' ','SYSSE','SE556558789301');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('910156','910166',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','0','NL','DEMO Nederland','KVK9937465','0','Holland','NL','NL','0','1',' ','200708','EUR',' ',' ',' ',' ',' ','999999','0','0',' ',' ',' ','Global Trada N.V.','Global Trada N.V.','NL','NL','2007-08-15
13:41:00.000','NL',50000.000,0.000,0.000,50000.000,0.000,0.000,'3994 DB',0.00000000,'NL','470720','470720',' ','12',' ','0','0','NL',' ',' ',' ','ROB','NL009404296B01');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('4664','4730',' ',' ','4755',' ',' ',' ',' ',' ',' ',' ',' ',' ','4755','0','DK','Agresso Demo Denmark',' ','0','Denmark','DK','DK','0','1',' ','0','DKK',' ',' ',' ',' ',' ',' ','0','0',' ',' ','0123456789','Agresso Denmark','Agresso Denmark','DK','DK','2005-10-14
08:40:00.000','DK',0.100,0.000,0.000,0.100,0.000,0.000,' ',0.00000000,'DK',' ',' ',' ','12',' ','0','0','DK',' ',' ',' ','SYSDK',' ');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('76800','66800',' ',' ','48000','48500','99999','47201','47701',' ',' ',' ',' ',' ','66910','1','SP','Agresso Spain',' ','0','Spain','ES','SP','0','1','1','200804','EUR','EUR','GBP',' ',' ',' ','99999','0','0','2',' ',' ','Agresso DEMO S.A','Agresso DEMO S.A','SP','ES','2008-04-07
14:01:38.000','SP',0.010,0.000,0.000,0.010,0.000,0.000,' ',0.50000000,'SP','99999','99999','Dpto.Aministración','12','Dpto.Riesgos','0','0','ES','00007307','18ru0456',' ','SYSES','B18389742');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('3960','7960',' ',' ','1790','2990','2991',' ',' ',' ',' ','8439',' ',' ','6570','0','SE','UTBILDNINGSFÖRETAGET AB','2021001235','0',' ','SE','SE','0','1',' ','200707','SEK',' ','EUR',' ','8439',' ','3740','1','0','2',' ',' ','Masterföretaget AB','Masterföretaget
AB','SE','SE','2008-06-09 12:38:43.000','SE',0.500,0.000,0.000,0.500,0.000,0.000,'STLM',0.05000000,'SE','3740','3740',' ','12',' ','0','0','SE',' ','Stockholm',' ','SYSEN','SE202100123501');
insert into oleclient (
acc_f_agio, acc_f_dag, acc_notes_ap, acc_notes_ar, acc_per_cost, acc_per_inc, acc_reverse, acc_undec_ap, acc_undec_ar, acc_vat_pay, attr_id_balance, bal_acc_v2, bal_acc_v3, balance_acc,
bank_fee_acc, bflag, client, client_name, comp_reg_no, compress_flag, country, country_code, cur_client, cur_item, cur_type, cur_type_tri, curr_period, currency, currency_tri,
currency_v2, currency_v3, diff_acc_v2, diff_acc_v3, diff_account, diff_chk_v2, diff_chk_v3, dim_v2_type, dim_v3_type, employer_id, header, header2, headquarter, language,
last_update, leg_act_cli, max_inv_diff, max_inv_diff_v2, max_inv_diff_v3, max_pay_diff, max_pay_diff_v2, max_pay_diff_v3, municipal, overrun_pct, pay_client, pay_diff_acc_g,
pay_diff_acc_l, pay_ref, period_no, remind_ref, rev_vat_disc_ap, rev_vat_disc_ar, sys_setup_code, tax_office_no, tax_office_ref, tax_system, user_id, vat_reg_no )
values
('8081','8181',' ',' ','2442','1481','9998','1301','1307','1320',' ','9998',' ',' ','8110','1','IT','IT - Client',' ','0','Italy','IT','IT','1','EU','EU','200601','EUR','EUR','EUR','USD','9998','9998','9998','1','0','EU','$','CODE SIA','Agresso demo Italia','Corporate
Office','IT','IT','2006-09-28 08:46:00.000','IT',0.020,0.000,0.000,0.100,0.000,0.000,'0301',0.00000000,'IT','9998','9998','Jim Smith','12','Mike Anderson','0','0','IT','Tax authority province','Auto-no011299',' ','SYSEN','11465420153');
go
CREATE UNIQUE NONCLUSTERED INDEX [aioleclient1] ON [dbo].[oleclient]
[client] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
GO
CREATE TABLE [dbo].[Htable1](
[amount] [decimal](28, 3) NOT NULL DEFAULT ((0)),
[cur_amount] [decimal](28, 3) NOT NULL DEFAULT ((0)),
[value_2] [decimal](28, 3) NOT NULL DEFAULT ((0)),
[value_3] [decimal](28, 3) NOT NULL DEFAULT ((0)),
[currency] [varchar](25) NOT NULL DEFAULT (' '),
[client] [varchar](25) NOT NULL DEFAULT (' '),
[asset_id] [varchar](25) NOT NULL DEFAULT (' '),
[depr_book_id] [varchar](25) NOT NULL DEFAULT (' '),
[input_id] [bigint] NOT NULL DEFAULT ((0)),
[amount_type] [char](25) NOT NULL DEFAULT (' '),
[reval_year] [int] NOT NULL DEFAULT ((0)),
[trans_seq] [int] NOT NULL DEFAULT ((0)),
[sequence_no] [int] NOT NULL DEFAULT ((0)),
[at_trans_date] [datetime] NOT NULL DEFAULT (CONVERT([datetime],'19000101',(112))),
[agrtid] [bigint] IDENTITY(1,1) NOT NULL,
UNIQUE NONCLUSTERED
[agrtid] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
INSERT INTO Htable1 (at_trans_date,amount,amount_type,asset_id,client,cur_amount,currency,depr_book_id,input_id,reval_year,sequence_no,trans_seq,value_2,value_3)
VALUES ('20140603' ,0.00000000,'GLN','BM','EN',0.00000000,'GBP','BUSINESS',563,0,29,0,0.00000000,0.00000000 )
GO
INSERT INTO Htable1 (at_trans_date,amount,amount_type,asset_id,client,cur_amount,currency,depr_book_id,input_id,reval_year,sequence_no,trans_seq,value_2,value_3)
VALUES ('20140603' ,0.00000000,'GLN','BM','EN',0.00000000,'GBP','BUSINESS',563,0,30,0,0.00000000,0.00000000 )
GO
--=================================================================================
-- The following query takes 15 minutes on my computer to give an execution plan. Fetching the data takes no additional time.
-- removing one table (CACHED88) from the query brings the time down to 59 seconds.
-- removing one more (CACHED87) brings it down to 4 seconds.
-- adding the hint "option (QUERYTRACEON 9481)" to the first case, brings it down from 15 minutes to less than one second!
SELECT
CACHED83.amount - ( CACHED76.amount + CACHED75.amount + CACHED85.amount + CACHED86.amount + CACHED87.amount + CACHED88.amount) AS amount,
CACHED83.amount - ( CACHED76.amount + CACHED75.amount + CACHED85.amount + CACHED86.amount + CACHED87.amount + CACHED88.amount) AS cur_amount,
c.currency
FROM
Htable1 tab1 ,
Htable1 CACHED83 ,
Htable1 CACHED76 ,
Htable1 CACHED75 ,
Htable1 CACHED85 ,
Htable1 CACHED86 ,
Htable1 CACHED87 ,
Htable1 CACHED88 ,
oleclient c
WHERE
tab1.client = c.client AND
tab1.amount_type = 'GLN' AND
tab1.asset_id = CACHED83.asset_id AND
tab1.depr_book_id = CACHED83.depr_book_id AND
tab1.client = CACHED83.client AND
tab1.input_id = CACHED83.input_id AND
tab1.reval_year = CACHED83.reval_year AND
tab1.trans_seq = CACHED83.trans_seq AND
tab1.sequence_no = CACHED83.sequence_no AND
tab1.asset_id = CACHED76.asset_id AND
tab1.depr_book_id = CACHED76.depr_book_id AND
tab1.client = CACHED76.client AND
tab1.input_id = CACHED76.input_id AND
tab1.reval_year = CACHED76.reval_year AND
tab1.trans_seq = CACHED76.trans_seq AND
tab1.sequence_no = CACHED76.sequence_no AND
tab1.asset_id = CACHED75.asset_id AND
tab1.depr_book_id = CACHED75.depr_book_id AND
tab1.client = CACHED75.client AND
tab1.input_id = CACHED75.input_id AND
tab1.reval_year = CACHED75.reval_year AND
tab1.trans_seq = CACHED75.trans_seq AND
tab1.sequence_no = CACHED75.sequence_no AND
tab1.asset_id = CACHED85.asset_id AND
tab1.depr_book_id = CACHED85.depr_book_id AND
tab1.client = CACHED85.client AND
tab1.input_id = CACHED85.input_id AND
tab1.reval_year = CACHED85.reval_year AND
tab1.trans_seq = CACHED85.trans_seq AND
tab1.sequence_no = CACHED85.sequence_no AND
tab1.asset_id = CACHED86.asset_id AND
tab1.depr_book_id = CACHED86.depr_book_id AND
tab1.client = CACHED86.client AND
tab1.input_id = CACHED86.input_id AND
tab1.reval_year = CACHED86.reval_year AND
tab1.trans_seq = CACHED86.trans_seq AND
tab1.sequence_no = CACHED86.sequence_no AND
tab1.asset_id = CACHED87.asset_id AND
tab1.depr_book_id = CACHED87.depr_book_id AND
tab1.client = CACHED87.client AND
tab1.input_id = CACHED87.input_id AND
tab1.reval_year = CACHED87.reval_year AND
tab1.trans_seq = CACHED87.trans_seq AND
tab1.sequence_no = CACHED87.sequence_no AND
tab1.asset_id = CACHED88.asset_id AND
tab1.depr_book_id = CACHED88.depr_book_id AND
tab1.client = CACHED88.client AND
tab1.input_id = CACHED88.input_id AND
tab1.reval_year = CACHED88.reval_year AND
tab1.trans_seq = CACHED88.trans_seq AND
tab1.sequence_no = CACHED88.sequence_no
-- option (QUERYTRACEON 9481)Reading "What's new in Sql Server 2014" (http://msdn.microsoft.com/en-us/library/bb510411.aspx#CE). I see that it says:
New Design for Cardinality Estimation
The cardinality estimation logic, called the cardinality estimator, is re-designed in SQL Server 2014 to improve the quality of query plans, and therefore to improve query performance. The new cardinality estimator incorporates assumptions and algorithms
that work well on modern OLTP and data warehousing workloads. It is based on in-depth cardinality estimation research on modern workloads, and our learnings over the past 15 years of improving the SQL Server cardinality estimator. Feedback from customers shows
that while most queries will benefit from the change or remain unchanged, a small number might show regressions compared to the previous cardinality estimator. For performance tuning and testing recommendations, seeCardinality
Estimation (SQL Server).
I states that a "small number of queries might show regressions". To mee the regression is a showstopper and seems to have to do with complexity. I found one query reported by Juha Salo (bug 893758) that possibly could have to do with the same thing.
It is a query with many joins. Simplifying the query by removing one of the joins, makes it work fine. The query documented in his report does not need any setup as it is a query on system tables as sys.indexes and sys.index_columns.
I quote:
There is a huge difference in performance for the following query between compatibility level 120 and the lower levels:
dbcc dropcleanbuffers
SELECT i.NAME
FROM sys.indexes i
INNER JOIN sys.index_columns k ON i.object_id = k.object_id
AND i.index_id = k.index_id
INNER JOIN sys.objects o ON i.object_id = o.object_id
AND k.object_id = o.object_id
INNER JOIN sys.index_columns k1 ON i.object_id = k1.object_id
AND i.index_id = k1.index_id
AND k1.key_ordinal = 1
INNER JOIN sys.index_columns k2 ON i.object_id = k2.object_id
AND i.index_id = k2.index_id
AND k2.key_ordinal = 2
INNER JOIN sys.index_columns k3 ON i.object_id = k3.object_id
AND i.index_id = k3.index_id
AND k3.key_ordinal = 3
INNER JOIN sys.index_columns k4 ON i.object_id = k4.object_id
AND i.index_id = k4.index_id
AND k4.key_ordinal = 4
INNER JOIN sys.index_columns k5 ON i.object_id = k5.object_id
AND i.index_id = k5.index_id
AND k5.key_ordinal = 5
INNER JOIN sys.index_columns k6 ON i.object_id = k6.object_id
AND i.index_id = k6.index_id
AND k6.key_ordinal = 6
INNER JOIN sys.index_columns k7 ON i.object_id = k7.object_id
AND i.index_id = k7.index_id
AND k7.key_ordinal = 7
INNER JOIN sys.columns c1 ON o.object_id = c1.object_id
AND k1.column_id = c1.column_id
INNER JOIN sys.columns c2 ON o.object_id = c2.object_id
AND k2.column_id = c2.column_id
INNER JOIN sys.columns c3 ON o.object_id = c3.object_id
AND k3.column_id = c3.column_id
INNER JOIN sys.columns c4 ON o.object_id = c4.object_id
AND k4.column_id = c4.column_id
INNER JOIN sys.columns c5 ON o.object_id = c5.object_id
AND k5.column_id = c5.column_id
INNER JOIN sys.columns c6 ON o.object_id = c6.object_id
AND k6.column_id = c6.column_id
INNER JOIN sys.columns c7 ON o.object_id = c7.object_id
AND k7.column_id = c7.column_id
Can be run in any database. In our case we have a legacy database with almost 10 000 (ten thousand) tables. In that kind of database the query just freezes fully utilizing a single cpu core.
If compatibility level is switched to 110 then query performs as it should. -
[10g] Need help with order by clause in hierarchical query
I have the following sample data:
CREATE TABLE bill_test1
( parent_part CHAR(25)
, child_part CHAR(25)
, line_nbr NUMBER(5)
, qty_per NUMBER(9,5)
INSERT INTO bill_test1 VALUES ('ABC-1','ABC-10',100,1);
INSERT INTO bill_test1 VALUES ('ABC-1','ABC-20',200,2);
INSERT INTO bill_test1 VALUES ('ABC-1','ABC-30',300,3);
INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-1',401,10);
INSERT INTO bill_test1 VALUES ('ABC-1','HARDWARE-2',402,5);
INSERT INTO bill_test1 VALUES ('ABC-10','ABC-155',100,2);
INSERT INTO bill_test1 VALUES ('ABC-10','HARDWARE-1',200,1);
INSERT INTO bill_test1 VALUES ('ABC-155','RAW-2',100,4.8);
INSERT INTO bill_test1 VALUES ('ABC-155','HARDWARE-3',200,3);
INSERT INTO bill_test1 VALUES ('ABC-20','RAW-1',100,10.2);
INSERT INTO bill_test1 VALUES ('ABC-30','RAW-3',100,3);And the query below gives me exactly what I want, in the order I want it. However, I am wondering if there is a way to get this order without creating the SEQ column, since I don't need it in my results
SELECT part_nbr
, parent_part
, child_part
FROM (
SELECT CONNECT_BY_ROOT b.parent_part AS part_nbr
, b.parent_part
, b.child_part
, SYS_CONNECT_BY_PATH(b.line_nbr,' ') AS seq
FROM bill_test1 b
, dual
CONNECT BY parent_part = PRIOR child_part
WHERE part_nbr = 'ABC-1'
ORDER BY seq
Results of above query, except with SEQ included in SELECT (just to show what I'm sorting off of):
PART_NBR PARENT_PART CHILD_PART SEQ
ABC-1 ABC-1 ABC-10 100
ABC-1 ABC-10 ABC-155 100 100
ABC-1 ABC-155 RAW-2 100 100 100
ABC-1 ABC-155 HARDWARE-3 100 100 200
ABC-1 ABC-10 HARDWARE-1 100 200
ABC-1 ABC-1 ABC-20 200
ABC-1 ABC-20 RAW-1 200 100
ABC-1 ABC-1 ABC-30 300
ABC-1 ABC-30 RAW-3 300 100
ABC-1 ABC-1 HARDWARE-1 401
ABC-1 ABC-1 HARDWARE-2 402Hi,
As long as there's only one root, you can say ORDER SIBLINGS BY, but you can't do that in a sub-query (well, you can, but usually there's no point in doing it in a sub-query). If the CONNECT BY is being done in a sub-query, there is no guarantee that the main query will preserve the hierarchical order that the sub-query provides.
The query you posted doesn't require a suib-query, so you can say:
SELECT CONNECT_BY_ROOT b.parent_part AS part_nbr
, b.parent_part
, b.child_part
--, SYS_CONNECT_BY_PATH(b.line_nbr,' ') AS seq
FROM bill_test1 b
WHERE CONNECT_BY_ROOT b.parent_part = 'ABC-1'
CONNECT BY parent_part = PRIOR child_part
ORDER SIBLINGS BY b.line_nbr
;I said the query you posted doesn't require a sub-query. It also doesn't require dual, so I suspect what you posted is a simplification of what you're really doing, and that may need a sub-query. In particular, if you intend to GROUP BY part_nbr, then you need the sub-query. We can repeat the CONNECT_BY_ROOT expression in the WHERE clause (or, now that I think about it, use a START WITH clause instead of WHERE), but, for some reason, we can't use CONNECT_BY_ROOT in a GROUP BY clause; we need to compute CONNECT_BY_ROOT in a sub-query, give it a name (like part_nbr), and GROUP BY that column in a super-query.
This assumes that there is only one root node. ORDER SIBLINGS BY means just that: children of a common parent will appear in order, but the root nodes, who have no parents, will not necessarily be in order.
Here's what I meant by using START WITH instead of WHERE:
SELECT CONNECT_BY_ROOT b.parent_part AS part_nbr
, b.parent_part
, b.child_part
--, SYS_CONNECT_BY_PATH(b.line_nbr,' ') AS seq
FROM bill_test1 b
START WITH b.parent_part = 'ABC-1'
CONNECT BY parent_part = PRIOR child_part
ORDER SIBLINGS BY b.line_nbr
;This should be much more efficient, because it narrows down the results before you waste time getting their descendants.
Using a START WITH clause here is analagous to me sending you an e-mail, saying "Come to a meeting a my office at 3:00."
Using a WHERE clause here is analagous to me sending an e-mail to everyone in the company, saying "Come to a meeting a my office at 3:00", and then, as people get here, telling everyone except you that they can go back.
ORDER SIBLINGS BY was introduced in Oracle 9.
Edited by: Frank Kulash on Dec 9, 2010 2:39 PM
Added version with START WITH clause -
I understand that Oracle 10g will rewrite your CURSOR FOR LOOP statements into a BULK COLLECT statement.
I am contemplating no longer explicitly writing the BULK COLLECT from now on as it reduces the number of lines of code and greatly simplifies code.
Can anyone see any serious flaws in this strategy?
Kind Regards
Chris> I also think it is a good idea if people do take the
time to decide their strategy. You seem to be
suggesting that it is a bad idea to stop and think
about what you require from your loop.
Well, that depends on the type of programmer. When one deals with programmers that are not true PL/SQL developers and view PL/SQL.. well, as some kind of inferior database language (compared to something like Java for example).. you want to have templates and stuff to enforce best practises.
> I also don't agree with the 'package tuning knob'.
Each query may have different requirements and, as
with most things in programming, fixing one thing can
have a negative effect on another. It is about the
only place where would not advocate constants.
You have a point - but even so, defining these as constants (even if it has to be inside the actual proc doing the bulk fetch, one per bulk fetch) make it a lot easier to maintain than having to search out the actual bulk fetch statements in the code.
> But i would suggest that analysis is performed on a
close-to-live enviroment with a production level
server, large body of test data and multiple users. I
think we agree on that point.
Yeah.. but the problem there is that I have never really seen such an environment. Usually due to costs. How do you for example duplicate a large RAC, terabytes of SAN space, 1000's of users, for use as a close-to-live enviroment?
The usual approach (by management) is to spend as little as possible on development and Q&A platforms. Which at times means that the performance of dev vs. production can vary a lot.
So we have to play the hand we're dealt with unfortunately.
> Hmmm cmegar and I have never once said "don't worry
about, PL/SQL does it for you".
Yes - of course not. I'm just rambling on in general describing the usual attitudes I see when it comes to features like this.
It is managable in small dev team, but larger ones.. not really. There this attitude is often previlant in my experience. The "silver bullet" bullet syndrome.
> Would you use the same argument with regard to unit
testing. There are not many pl/sql developers who
unit test but should that prevent me using the
technique?
Well.. to be honest, I do not think that a developer that writes at least some basic unit tests for his/her code can be called a developer.
> >[i]Relying on implicit features to "fix" code for
you negates a deeper and better understanding of the
language and what you writeI don't see how using an implicit bulk collect is
fixing code.
Which is why I put it in brackets - "fixing" ito making it more performant, or "fixing" it as a FOR loop contains DMLs that can be changed to FORALLs.
> Don't tell me you've never
updated older code to take advangate of a new
feature.
I can never stop the urge to refactor old code I'm working with. :-)
> >[i]I think of features as an implicit bulk collect
behind the scenes, as crutches for mediocre
programmers.I take it that statement is suggesting that cmedgar
and I are mediocre programmers? Not a nice way to end
an otherwise constructive argument.
How does that saying go? You claim the cloth that I cut? :-)
My sincere apologies to both you guys - I did not intend that statement to personal at all.
Besides, I'm usually more blunt than that what it comes to throwing personal insults around. ;-)
This statement was just a general observation going back to my early days of writing Cobol and Natural. Programmers at time do not seem to care about grokking the features and apply them correctly. Actually I want to say "most programmers" and "a lot of times", but then I would be accused of generalisation. ;-)
I simply find it very frustrating dealing with programmers that does not simply love to write code. Programmers that see it as a mere job.
Someone once said that he never starts out to write beautiful code. But when he is done and the code is not beautiful and elegant (and simple), he knows he has screwed up.
In my experience.. many programmers will not understand this. -
Alert is not working with a group by query
Hello,
I have a group by query. Using that query have created an alarm, but the alarm is not working, though if I execute manually the query, the query is returning records.
I have update the alarm and set another query which has no group by clause. This way the alarm works.
So, my question is the following, do you know if this behaviour is because some SAPs limitation, that is, that alarms with queries containing the group by clause cant work?
Thank you very much for your help!Hi Adrian,
Actually, the query I have post was a simplification of the real one.
The real one is the following, and there I think it is not possible to rewrite it without the group by>
SELECT T1.ItemCode , SUM(T1.OpenQty) , SUM(T2.OnHand) , SUM(T1.OpenQty)- SUM(T2.OnHand)
FROM RDR1 T1 inner JOIN OITW T2 on T1.ItemCode = T2.ItemCode
WHERE T2.WhsCode = '01'
GROUP BY T1.ItemCode
HAVING SUM(T1.OpenQty)- SUM(T2.OnHand) > 0
Anyway, thank you very much for your idea. -
How to query in memory on a subset?
TopLink query in memory is quite an exclusive feature. However, it doesn't the obvious need for indexing. If anybody has exposure to .NET they will be aware of a paradimn shift of using SQL against structure in memory. I would like in my application to use TopLink query in memory to query against a specific list of persistent objects. I mean, I don't want TopLink iterate the 5000 instance of class X that is in the cache. I would like the following use cases be supported:
- query against UOW registered object, excluding session cache
- query against a specific list of registered objects
Please provide existing API in TopLink 10.x and if only exist in EclipseLink, let me know the API.
If API is missing, please create enhancement request and let me know the number.Below are the use cases so that you can easily derive API needed:
1- Load all instances of class X, the query for specific instances with where condition other than PK
- if loading is just one time, then query should check both uow/session, so already supported, but need index if lot of data.
- another way to see this, is that for each class that doesn't have too much instances, we want to load everything in memory, then redirect all query against the class to be in memory.
2- Batch method handling a range or subset. Like on a domain having many organizations. Start by getting all timesheets of organization X for last week from DB for optimization purpose. Then code start to classify/process the data, like query in memory for timesheets of this subset with state x, then y, z. This last query could just be against UOW, because just loaded the data. However, next query, which is againt only timesheet with state x, should ideally be against the list of timesheet with state x already populated in a collection. So having scope on UOW should be used only for performance, but having scope on a specific collection provide both specific result and performance. This use case may seems weird, but in complex/legacy application, it's often the case that we have existing not batch oriented code, which query for similar subset one after another which is not performant. Then faster refactoring to get performance, is to try to not modify existing not batch oriented query but redirect to memory when we are able to insure that memory is loaded with data needed before jumping on the not batch oriented legacy code.
3- Simplification of iteration by moving from verbose Java to SQL. We do have lot of code having a Collection of a Map having a Map. Then iterate when looking at some state of the leaf item we still filter out stuff. Be able to query in memory against collection/set, should simplify our code.
4- Remove duplicate SQLs. Complex application may end-up with different module calling same module to get a piece of information, so duplicate SQLs sent to DB if query is not against PK. Like select * from X where FK = y. If FK is unique, then I can avoid all duplicate SQLs to be sent to DB by looking first in UOW if any instances of object X exist with FK = y. In this case I want to look only in UOW for performance reason because index is not supported. -
Query related to Business Process Documenation
Hello All,
I have a simple query
What is the best/ standard method of documenting the business process in Solar01
1) Is it Scenario based
2) Functionality based
In scenario based, I will document entire Business process ie end to end scenario
in this case advantage is that, hepful while testing and business process monitoring.
disadvantage is that
if any Business process need to be changed , then the same need to be changed in all relavent End to end scenrios.
there will duplication of work.
Could some one guide me the exact method of documenting the Business processes.
Regards,
Shyam.HI,
I think Scenario based is better
1) It's more reasonable to manage your documentation with the business process since they are quite related
2) I suggest that you use the check out /check in functionnality to prevent the modification from multiple users at the same time
3) As the changes happen some time, which means you have to maintain the related document often, it would be a good idea to use the link but not the copy of document
4) In most case, i would insert documents of various types in different tabs like Trainning materials, project documentation, test in SOLAR02
5) What's more, if all your user guides are uploaded to the Trainning material tab, you will be able to use the existant documents to supply the SOLAR_LEARNING_MAP, which in my opinion, simplifies a lot the tranning session of any global-rollout
Jiamin Pan -
Hello experts,
Does anyone know what the maximum number of cells in a structured report is?
I am not talking about the 65,536 rows in Excel, but actually how many rows and columns you can have in your query.
I am getting a Brain 457 error:
<i>Query ZFI_M02_8Y0_Q977 is too large.
Message no. BRAIN457
Diagnosis
Query ZFI_M02_8Y0_Q977 contains 8192 differing selection cells. However, only 8191 selection cells can be processed in a query.
Procedure
Please simplify query definition ZFI_M02_8Y0_Q977.</i>
I have 95 defined columns and 145 defined rows, which would calculate out to 13585 cells.
CheersHello James,
The problem is in the complexity of objects you use in this. The message comes from OLAP acceptance test and actually has nothing to do with the cells of data. Here it is the internal number of selection groups OLAP can handle.
Actually this number appears are a result of simplification of complex Restricted and Calculated KF inheriting each other in definitions. One complex KF represented as a structure members in your query may come to OLAP as 20-30 (or more) selection groups. That means the visible amount of members may be significantly less that the amount OLAP operates with. There is no way to get this number in design time except use 'query check' function which should return the error when the limit is over.
In this case is necessary to remove one complex KF or replace it by local SEL/FML. In most cases this will help to get the same query definition with cheaper costs for OLAP.
Best regards -
Query to Identify every Wednesday between 2 dates
Hi,
I have this code that is working well but i found it very ugly. Any optimisation hints or simplifications?
select to_date(:startdate, 'YYYY-MM-DD') + rownum -1 as Date_
from all_objects
where rownum <= to_date(:enddate, 'YYYY-MM-DD')-to_date(:startdate, 'YYYY-MM-DD')+1
having to_char(to_date(:startdate, 'YYYY-MM-DD') + rownum -1,'D')='4' --4 = Wednesday
group by to_date(:startdate, 'YYYY-MM-DD') + rownum -1
order by to_date(:startdate, 'YYYY-MM-DD') + rownum -1
Thanks
HugoHi, Hugo,
Here's one way:
WITH parameters AS
SELECT TO_DATE (:start_date, 'YYYY-MM-DD') AS start_date
, TO_DATE (:end_date, 'YYYY-MM-DD') AS end_date
FROM dual
SELECT start_date + LEVEL - 1 AS dt
FROM parameters
WHERE TO_CHAR ( start_date + LEVEL - 1
, 'fmDY'
, 'NLS_DATE_LANGUAGE=ENGLISH'
) = 'WED'
CONNECT BY LEVEL <= 1 + end_date - start_date
The main thing is to lose the GROUP BY. GROUP BY is for taking groups of input rows, and producing 1 one output row from them. You're not doing anything like that in this problem.
Instead of repeating a function call multiple times in the same query (e.g., you used
to_date(:startdate, 'YYYY-MM-DD')
5 times in the query you posted) , you can do it once, in a sub-query, and use the result as many times as you need to in a super-query.
CONNECT BY from a 1-row table (or, in this case, result set) is much more efficient than getting ROWNUM from all_objects. Also, there is a finite number of rows in all_objects. That number is probably in the thousands, but it's still a limit. CONNECT BY will work for millions, or more, if you need it.
I find TO_CHAR (some_date, 'DY') easier to debug and maintain than TO_CHAR (some_date, 'D'). I might get confused, and think that '3' means Wednesday, but I'm not very likely to think that 'TUE' means Wednesday, no matter how little coffee I've had.
Also, the 'D' format depends on your NLS_TERRITORY setting, which you can't control from within the query. 'DY' depends on NLS_LANGUAGE, which you can override by passing a 3rd argument to TO_CHAR. The query above will always check for Wednesdays, even if they are called Onsdag or Mittwoch in your session, and regardless of whether it thinks that's the 3rd or the 4th day of the week. -
Hi
Sample Data:
create table mycust(child_id number(30),parent_id number(30));
insert into mycust values(100000059627549,100000059657962);
insert into mycust values(100000059657962,300006133014350);
insert into mycust values(300006133014350,100000098989898);
insert into mycust values(10000962675,30000350898);
insert into mycust values(30000350898,13089862675);
commit;
I'm try to form a query that would fetch results in following way (to get the root of each child)
like parent of 10000962675 is 30000350898,whose parent in turn is 13089862675
so I want o/p in format . can someone please suggest
child
parent
Root
100000059627549
100000059657962
100000098989898
100000059657962
300006133014350
100000098989898
300006133014350
100000098989898
100000098989898
10000962675
30000350898
13089862675
30000350898
13089862675
13089862675I think you're looking for this...
SQL> ed
Wrote file afiedt.buf
1 select child_id
2 ,parent_id
3 ,connect_by_root parent_id
4 from mycust
5 connect by prior child_id = parent_id
6* start with parent_id not in (select child_id from mycust)
SQL> /
CHILD_ID PARENT_ID CONNECT_BY_ROOTPARENT_ID
30000350898 13089862675 13089862675
10000962675 30000350898 13089862675
300006133014350 100000098989898 100000098989898
100000059657962 300006133014350 100000098989898
100000059627549 100000059657962 100000098989898
though you didn't make it easy for us to follow, using such obscure large numbers.
Next time, please use an example that just simplifies it and uses something like 1,2,3,4,5... etc. so it's nice and clear -
Error while running a query-Input for variable 'Posting Period is invalid
Hi All,
NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
Diagnosis
Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
System Response
Procedure
Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
Procedure for System AdministrationOK.
Well, if the variable is not used in any interval selection, then I would say "something happened to it".
I would make a copy of the query and run it to check if I get the same problem with period 12.
-> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
If so, then try removing the variable completely from the query and hardcode restriction to 12.
-> If problem still persists, I would have to do some thinking.
If problem is gone, then add the variable again. Check.
-> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
Good luck!
Jacob
P.S: what fisc year variant are you using?
Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM -
Logical database in adhoc query
Hello All,
Can anyone tell me what is the logical database in adhoc query?Hi
When you create a query , you have to select an infoset. Infoset can be considered as a source from which data is populated in the Query Fields.
Infosets are created from Transaction SQ02.
There can be four methods through which an Infoset can become a source of data:
1. Table join ( By joining two or more tables from Data dictionary)
example: Joining tables PA0001 and PA0006 on Pernr to get a one resultant dataset
2. Direct read of Basis Table ( Like PA0001 as a source for data in Infoset )
3. Logical Database ( A Pre-written Program by SAP that extract data from clusters, tables taking care of authorizations and validity periods)
Example : Logical database PNP, PNPCE (Concurrent Employement),PCH ( LDB for Personnel Development Data)
Custom Logical DBs can be created in T_Code SE-36.
4. Data Retrieval by a Program ( Custom code written by ABAP developers which will collect and process data) . This program has a corresponding Structure in data dictionary and the fields of this structure will be used in query)
Reward Points, if helpful.
Regards
Waseem Imran -
Query help on Goods Receipt Query with AP Invoice
Looking for a little help on a query. I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice). I think my problem is in my where clause, I plagerized an SAP query to show GR and AP from a PO as a start. SBO 2005 SP01. Any help would be great appreciated. Thanks
SELECT distinct 'GR',
D0.DocStatus,
D0.DocNum ,
D0.DocDate,
D0.DocDueDate,
D0.DocTotal,
'AP',
I0.DocStatus,
I0.DocNum ,
I0.DocDate,
I0.DocDueDate,
I0.DocTotal,
I0.PaidToDate
FROM
((OPDN D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry)
full outer join
(OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry)
on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
WHERE
(D1.BaseType=22 AND D1.DocDate>='[%0]' AND D1.DocDate<='[%1]')
OR (I1.BaseType=20 AND I1.BaseEntry IN
(SELECT Distinct DocEntry
FROM PDN1 WHERE BaseType=22 AND DocDate>='[%0]' AND DocDate<='[%1]'))Hi Dalen ,
I believe it is because of the condition
(D1.BaseType=22 AND D1.DocDate>='%0' AND D1.DocDate<='%1')
OR (I1.BaseType=20 AND I1.BaseEntry IN
(SELECT Distinct DocEntry FROM PDN1 WHERE PDN1.BaseType=22 AND DocDate>='%0' AND DocDate<='%1'))
Try changing
D1.BaseType=22 OR D1.DocDate>='%0' AND D1.DocDate<='%1
PDN1.BaseType=22 OR DocDate>='%0' AND DocDate<='%1'))
Lets see what would be the result . Lets have some fun with troubleshooting
See what would be the difference in the result .
Thank you
Bishal
Maybe you are looking for
-
BSI Tax Factory 9.0 Upgrade
Can folks give me an idea what kind of timelines they are facing to upgrade from BSI 8.0 to 9.0 assuming HR SPs and TUBS required? I am trying to get a rough scope (weeks, months) for planning purposes.
-
I - cloud e-mail frequently not loading, firefox crashing frequently
Very disgusted with i - cloud so far - no advantage to me, as I have only desktop Imac, no cell phone, tablet, laptop, etc to "push" info too - for me, this is a huge step backwards from mobile me to i - cloud - I am often not having my e-mail messag
-
RAW files linked as smart objects not affected by LR5
My understanding of linking (rather than embedding) a file in the latest Photoshop CC 2014 is that it would allow the linked file to be edited outside of Photoshop and still update when the parent file is opened in Photoshop. However after placing, a
-
Defining Job with multiple steps
This is a general question on SM36. I have 4 programs that need to run as part of a job. I do not want this as a periodic job because these 4 steps needs to be done by the user when needed. I defined a job and created 4 steps and saved. system showed
-
My finder window is glitching out quite severely. How can I troubleshoot this problem?
I have no idea what caused this problem. The only program I used in the lead up to this was Logic Pro 9, but I didn't do anything different from that I would normally do. Saving files mostly. As you can see, I have no problem with accessing my files