Same sql query with multiple database links
Hi All,
i want to execute an sql query for a SELECT LIST Item. which should use database links in it's query.
i'm having a list of database links in the region. say :LOC which is having 10 items each linking to different databases.
i want to use following query for another item in same page.
select customer_name from working_lines@:LOC where
phone_no:phone_no
can i do this.
Thank you All.
What we have done before is to create a report based on a PL/SQL procedure that returns a SQL statement.
The PL/SQL code grabs the "selected" database link from :LOC and parses the SQL QUERY you want to execute replacing some token (like [LINK]) with '@DBNAME'.
Lets say your SQL statement is coded like this:
mySQL := 'SELECT cust_name FROM working_lines[LINK] where phone_no = :Phone;'
Then all you would have to do to replace '[LINK]' with the proper DB alias would be:
mySQL := REPLACE(mySQL, '[LINK]', '@'||:LOC);
and then return the new SQL ...
if :LOC has something like 'V10GPROD' your SQL would look like :
SELECT cust_name FROM working_lines@V10GPROD where phone_no = :Phone;
The beauty of this is that you can also include a "null" option that means the select statement will be executed on THIS database...
Doug
Similar Messages
-
Running the same sql script in multiple databases
Hello,
What is the method to run the same sql script in multiple databases? I want to write a unix script that would select from different databases and run a sql/plsql script in those different databases. What are the ways to write such a unix script? Thank you in advance.Just have a parameter which takes in the oracle connection parameters and use it in your sqlplus script with your shell script.
Your sqlplus script can have a procedure/function call or an anonymous block;
Then have a wrapper script to call the original script with different connection parameters. Hope this helps. -
Sql query with multiple joins to same table
I have to write a query for a client to display business officers' names and title along with the business name
The table looks like this
AcctNumber
OfficerTitle
OfficerName
RecKey
90% of the businesses have exactly 4 officer records, although some have less and some have more.
There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
An individual account can have 30 or 40 records on the other table.
The client wants to display 1 record per account.
Initially I wrote a query to join the table to itself:
Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber
This returned tons of duplicate rows for each account ( number of records * number of records, I think)
So added
And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
I tried select distinct on the other table and the query runs for ever and never returns anything
I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
Any suggestions would be appreciatedWelcome to the forum!
user13319842 wrote:
I have to write a query for a client to display business officers' names and title along with the business name
The table looks like this
AcctNumber
OfficerTitle
OfficerName
RecKey
90% of the businesses have exactly 4 officer records, although some have less and some have more.
There is a separate table that has the AcctNumber, BusinessName about 30 other fields that I don’t need
An individual account can have 30 or 40 records on the other table.
The client wants to display 1 record per account.As someone has already mentioned, you should post CREATE TABLE and INSERT statements for both tables (relevant columns only). You don't have to post a lot of sample data. For example, you need to pick 1 out of 30 or 40 rows (max) for the same account, but it's almost certainly enough if you post only 3 or 4 rows (max) for an account.
Also, post the results you want from the sample data that you post, and explain how you get those resutls from that data.
Always say which version of Oracle you're using. This sounds like a PIVOT problem, and a new SELECT .... PIVOT feature was introduced in Oracle 11.1. If you're using Oracle 11, you don't want to have to learn the old way to do pivots. On the other hand, if you have Oracle 10, a solution that uses a new feature that you don't have won't help you.
Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data, the results you want from that data, an explanation, and your Oracle version.
Initially I wrote a query to join the table to itself:
Select A.OfficerTtitle, A.OfficerName, B.OfficerTitle, B.OfficerName, C.OfficerTtitle, C.OfficerName, D.OfficerTitle, D.OfficerName where A.AcctNumber = B.AcctNumber and A.AcctNumber = C.AcctNumber and A.AcctNumber = D.AcctNumber Be careful, and post the exact code that you're running. The statement above can't be what you ran, because it doesn't have a FROM clause.
This returned tons of duplicate rows for each account ( number of records * number of records, I think)
So added
And A.RecKey > B.RecKey and B.RecKey > C. RecKey and C.RecKey . D.RecKey
This works when there are exactly 4 records per account. If there are less than 4 records on the account it skips the account and if there are more than 4 records, it returns multiple rows.
But when I try to l join this to the other table to get the business name, I get a row for every record on the other table
I tried select distinct on the other table and the query runs for ever and never returns anything
I tried outer joins and subqueries, but no luck so far. I was thinking maybe a subquery - if exists - because I don't know how many records there are on an account, but don't know how to structure that
Any suggestions would be appreciatedDisplaying 1 column from n rows as n columns on 1 row is called Pivoting . See the following link fro several ways to do pivots:
SQL and PL/SQL FAQ
Pivoting requires that you know exactly how many columns will be in the result set. If that number depends on the data in the table, then you might prefer to use String Aggregation , where the output consists of a huge string column, that contains the concatenation of the data from n rows. This big string can be formatted so that it looks like multiple columns. For different string aggregation techniques, see:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
The following thread discusses some options for pivoting a variable number of columns:
Re: Report count and sum from many rows into many columns -
SQL query with multiple tables - what is the most efficient way?
Hello I am learning PL/SQL. I have a simple procedure where I need to find number of employees and departments per location as per user input of location_id.
I have 3 Tables:
LOCATIONS
location_id (pk)
location_name
DEPARTMENTS
department_id (pk)
location_id (fk)
department_name
EMPLOYEES
employee_id (pk)
department_id (fk)
employee_name
1 Location can have 0-MANY Departments
1 Employee has 1 Department
Here is the query I came up with for PL/SQL procedure:
/*Ecount, Dcount are NUMBER variables */
SELECT SUM (EmployeeCount), COUNT(DepartmentNumber)
INTO Ecount, Dcount
FROM
(SELECT COUNT(employee_id) EmployeeCount, department_id DepartmentNumber
FROM employees
GROUP BY department_id
HAVING department_id IN
(SELECT department_id
FROM departments
WHERE location_id = userInput));
I do get the correct result, but I am just wondering if my query is on the right track and if there is a more "efficient" way of doing this.
Thanks in advance for helping a newbie out.Hi,
Welcome to the forum!
Something like this will be more efficient:
SELECT COUNT (employee_id) AS ECount
, COUNT (DISTINCT department_id) AS DCount
FROM employees
WHERE department_id IN ( SELECT department_id
FROM departments
WHERE location_id = :userInput
;You should also try a join instead of the IN subquery.
For efficiency, do only the things you need to do.
For example, you don't need a count of employees in each department, so don't compute one. That means you won't need the in-line view, so don't have one.
You don't need PL/SQL for this job, so don't use PL/SQL if you don't have to. (I realize this question was out of context, so you may have good reasons for doing this in PL/SQL.)
Do all filtering as early as possible. Don't waste effort computing things that won't be used .
A particular example of this is: Never use a HAVING clause when you can use a WHERE clause. What's the difference between a WHERE clause and a HAVING clause? The WHERE clause is applied before aggregate functions are computed, and the HAVING clause is applied after; there's no other difference. Therefore, if the HAVING clause isn't referencing an aggregate function, it could be done in a WHERE clause instead. -
Performance tuning of sql query with multiple joins
My query takes at least half an hour to execute and the number of records returned are approx 1 lakh records.
Structure of tables are:
tblSession : ID,option1,option2,option3,option4,option5,option6,option7,option8,option9.
tblOption : ID, labelID
tblLabelDetail : ID, LABELID, text
optionID 1 to optionID9 are Foreign keys to table tblOption.ID
My query is as below :
select
session.ID
,session.tstamp
,session.score
,session.hid1
,session.hID2
,session.hID3
,session.collectionID
,session.consumerID
,session.langID
,cons_cust.text1 as customCons_text1,
cons_cust.text2 as customCons_text2,
cons_cust.text3 as customCons_text3,
cons_cust.text4 as customCons_text4,
cons_cust.text5 as customCons_text5,
cons_cust.text6 as customCons_text6,
cons_cust.text7 as customCons_text7,
cons_cust.text8 as customCons_text8,
cons_cust.text9 as customCons_text9,
ld_cons1.text as customCons_option1GUID,
ld_cons2.text as customCons_option2GUID,
ld_cons3.text as customCons_option3GUID,
ld_cons4.text as customCons_option4GUID ,
ld_cons5.text as customCons_option5GUID,
ld_cons6.text as customCons_option6GUID,
ld_cons7.text as customCons_option7GUID,
ld_cons8.text as customCons_option8GUID,
ld_cons9.text as customCons_option9GUID,
--session
session_cust.text1 as session_cust_text1,
session_cust.text2 as session_cust_text2,
session_cust.text3 as session_cust_text3,
session_cust.text4 as session_cust_text4,
session_cust.text5 as session_cust_text5,
session_cust.text6 as session_cust_text6,
session_cust.text7 as session_cust_text7,
session_cust.text8 as session_cust_text8,
session_cust.text9 as session_cust_text9,
ld_sess1.text as session_cust_option1GUID,
ld_sess2.text as session_cust_option2GUID,
ld_sess3.text as session_cust_option3GUID,
ld_sess4.text as session_cust_option4GUID,
ld_sess5.text as session_cust_option5GUID,
ld_sess6.text as session_cust_option6GUID,
ld_sess7.text as session_cust_option7GUID,
ld_sess8.text as session_cust_option8GUID,
ld_sess9.text as session_cust_option9GUID,
session_cust.tStamp1,
session_cust.tStamp2
from mvSession session with (noexpand)
inner join tblCollection c on c.ID=session.collectionID AND c.templateID = 405
left join tblConsumer cons on cons.ID=session.consumerID and cons.sessionYM between 601 and 1412 and cons.sID=105
left join vCustomConsumer cons_cust on cons_cust.sessionYM between 601 and 1412 and cons_cust.sID=105 and cons_cust.ID=cons.ID
left join tbloption o_cons1 on o_cons1.id = cons_cust.option1 and o_cons1.sid = 105
left join tblLabelDetail ld_cons1 on ld_cons1.labelID = o_cons1.labelID and ld_cons1.langId = 1 and ld_cons1.eid = 107
left join tbloption o_cons2 on o_cons2.id = cons_cust.option2 and o_cons2.sid = 105
left join tblLabelDetail ld_cons2 on ld_cons2.labelID = o_cons2.labelID and ld_cons2.langId = 1 and ld_cons2.eid = 107
left join tbloption o_cons3 on o_cons3.id = cons_cust.option3 and o_cons3.sid = 105
left join tblLabelDetail ld_cons3 on ld_cons3.labelID = o_cons1.labelID and ld_cons3.langId = 1 and ld_cons3.eid = 107
left join tbloption o_cons4 on o_cons4.id = cons_cust.option4 and o_cons4.sid = 105
left join tblLabelDetail ld_cons4 on ld_cons4.labelID = o_cons4.labelID and ld_cons4.langId = 1 and ld_cons4.eid = 107
left join tbloption o_cons5 on o_cons5.id = cons_cust.option5 and o_cons5.sid = 105
left join tblLabelDetail ld_cons5 on ld_cons5.labelID = o_cons5.labelID and ld_cons5.langId = 1 and ld_cons5.eid = 107
left join tbloption o_cons6 on o_cons6.id = cons_cust.option6 and o_cons6.sid = 105
left join tblLabelDetail ld_cons6 on ld_cons6.labelID = o_cons6.labelID and ld_cons6.langId = 1 and ld_cons6.eid = 107
left join tbloption o_cons7 on o_cons7.id = cons_cust.option7 and o_cons7.sid = 105
left join tblLabelDetail ld_cons7 on ld_cons7.labelID = o_cons7.labelID and ld_cons7.langId = 1 and ld_cons7.eid = 107
left join tbloption o_cons8 on o_cons8.id = cons_cust.option8 and o_cons8.sid = 105
left join tblLabelDetail ld_cons8 on ld_cons8.labelID = o_cons8.labelID and ld_cons8.langId = 1 and ld_cons8.eid = 107
left join tbloption o_cons9 on o_cons9.id = cons_cust.option9 and o_cons9.sid = 105
left join tblLabelDetail ld_cons9 on ld_cons9.labelID = o_cons9.labelID and ld_cons9.langId = 1 and ld_cons9.eid = 107
left join vCustomSession session_cust on session_cust.sessionYM between 601 and 1412 and session_cust.sID=105 and session_cust.ID=session.ID
left join tbloption o_sess1 on o_sess1.id = session_cust.option1 and o_sess1.sid = 105
left join tblLabelDetail ld_sess1 on ld_sess1.labelID = o_sess1.labelID and ld_sess1.langId = 1 and ld_sess1.eid = 107
left join tbloption o_sess2 on o_sess2.id = session_cust.option2 and o_sess2.sid = 105
left join tblLabelDetail ld_sess2 on ld_sess2.labelID = o_sess2.labelID and ld_sess2.langId = 1 and ld_sess2.eid = 107
left join tbloption o_sess3 on o_sess2.id = session_cust.option3 and o_sess3.sid = 105
left join tblLabelDetail ld_sess3 on ld_sess3.labelID = o_sess2.labelID and ld_sess3.langId = 1 and ld_sess3.eid = 107
left join tbloption o_sess4 on o_sess4.id = session_cust.option4 and o_sess4.sid = 105
left join tblLabelDetail ld_sess4 on ld_sess4.labelID = o_sess4.labelID and ld_sess4.langId = 1 and ld_sess4.eid = 107
left join tbloption o_sess5 on o_sess5.id = session_cust.option5 and o_sess5.sid = 105
left join tblLabelDetail ld_sess5 on ld_sess5.labelID = o_sess5.labelID and ld_sess5.langId = 1 and ld_sess5.eid = 107
left join tbloption o_sess6 on o_sess6.id = session_cust.option6 and o_sess6.sid = 105
left join tblLabelDetail ld_sess6 on ld_sess6.labelID = o_sess6.labelID and ld_sess6.langId = 1 and ld_sess6.eid = 107
left join tbloption o_sess7 on o_sess7.id = session_cust.option7 and o_sess7.sid = 105
left join tblLabelDetail ld_sess7 on ld_sess7.labelID = o_sess7.labelID and ld_sess7.langId = 1 and ld_sess7.eid = 107
left join tbloption o_sess8 on o_sess8.id = session_cust.option8 and o_sess8.sid = 105
left join tblLabelDetail ld_sess8 on ld_sess8.labelID = o_sess8.labelID and ld_sess8.langId = 1 and ld_sess8.eid = 107
left join tbloption o_sess9 on o_sess9.id = session_cust.option9 and o_sess9.sid = 105
left join tblLabelDetail ld_sess9 on ld_sess9.labelID = o_sess9.labelID and ld_sess9.langId = 1 and ld_sess9.eid = 107
where session.sID=105 and session.tStamp >= 'Sep 1 2014 12:00AM' and session.tStamp < 'Dec 12 2014 12:00AM'
order by session.tStamp, session.ID
Is there a way , where i can simplify the joins with tbloption and tblLabelDetail and get my o/p in optimal time.
RegardsI have headed towards another approach ie. using unpivot and then pivot.
First i am converting option1-option9 into column , then doing PIVOT to get back the same record . But issue is that when i am doing pivoting i am getting NULL values.
My query is :
select * into #t1 from
select ID
, option1
, option2
, option3
, option4
, option5
, option6
, option7
, option8
, option9
from vCustomConsumer
where sid=105
and sessionYM = 1412
) SourceTable
UNPIVOT
optionID FOR Col IN
(option1
,option2
,option3
,option4
,option5
,option6
,option7
,option8
,option9 )
) AS unpvt
select t.ID,t.optionID,t.col,cast(ld.text as varchar(max)) as text into #t2
from #t1 t
left outer join tbloption o on o.ID = t.optionID
left outer join tblLabelDetail ld on ld.labelID = o.labelID and ld.langID=1
order by ID,col
select ID,option1
,option2
,[option3]
,option4
,option5
,option6
,option7
,option8
,option9
from
select ID,optionID,col,text
from #t2
)up
pivot
min(text)for col in
(option1
,option2
,[option3]
,option4
,option5
,option6
,option7
,option8
,option9
)as pvt
In my last query where i am using pivot, i am getting NULL values. When i check the data in temp table #t2 , it exists perfectly . But when pivoting i dont understand why it is returning most of the NULL values. I am getting data for only one column in single
row.
Below are some rows from result set finally obtained after pivoting :
ID
option1
option2
option3
option4
option5
option6
option7
option8
option9
62949026
NULL
0 to 200 seconds
NULL
NULL
NULL
NULL
NULL
NULL
NULL
62966000
NULL
NULL
4
NULL
NULL
NULL
NULL
NULL
NULL
62966032
NULL
NULL
4
NULL
NULL
NULL
NULL
NULL
NULL
63090372
NULL
NULL
NULL
NULL
EN
NULL
NULL
NULL
NULL
63090375
NULL
NULL
NULL
NULL
EN
NULL
NULL
NULL
NULL
Thanks, -
SQL query with multiple condition
Below is the sample table
ID RATE DATE ORGAMNT PAYAMOUNT
1 3.45 12/23/2012 23000.45 19060.23
2. 5.50 04/12/2013 45000.00 36000.54
3. 6.44 04/16/200 60000.00 20000.00
Select a table with highest rate, Orgamnt with Date closer to current date.with
data_table as
(select 11186 hnum,11607400 oma,to_date('2/1/2006','mm/dd/yyyy') fpay,5.51 irate,10580934.67 apb,'WELLS FARGO BANK NA' hname from dual union all
select 11188,4801800,to_date('9/1/2006','mm/dd/yyyy'),6.3,4326951.51,'PNC BANK, NATIONAL ASSOCIATION' hname from dual union all
select 11189,1236100,to_date('8/1/2006','mm/dd/yyyy'),6.15,1147108.9,'HEARTLAND BANK' hname from dual union all
select 11192,1578400,to_date('4/1/2007','mm/dd/yyyy'),5.82,1470926.86,'WELLS FARGO BANK NA' hname from dual union all
select 11193,8150400,to_date('12/1/2008','mm/dd/yyyy'),6.75,7828776.28,'OPPENHEIMER MULTIFAMILY HSG' hname from dual union all
select 11195,3898000,to_date('5/1/2009','mm/dd/yyyy'),6.5,3752154.96,'BERKADIA COMMERCIAL MORTGAGE' hname from dual union all
select 11196,8040000,to_date('6/1/2009','mm/dd/yyyy'),7,7775734.57,'OPPENHEIMER MULTIFAMILY HSG' hname from dual union all
select 11197,37315000,to_date('12/1/2009','mm/dd/yyyy'),5.5,35851362.87,'RED MORTGAGE CAPITAL LLC' hname from dual union all
select 11199,3824000,to_date('2/1/2010','mm/dd/yyyy'),5.25,3673760.35,'WALKER AND DUNLOP LLC' hname from dual union all
select 11200,26927000,to_date('7/1/2010','mm/dd/yyyy'),4.7,25186682.65,'OAK GROVE COMMERCIAL MORTGAGE' hname from dual union all
select 11201,7208600,to_date('10/1/2010','mm/dd/yyyy'),4.59,6949026.64,'BERKADIA COMMERCIAL MORTGAGE' hname from dual union all
select 11204,9300000,to_date('2/1/2011','mm/dd/yyyy'),3.41,8927064.51,'PNC BANK, NATIONAL ASSOCIATION' hname from dual union all
select 11205,5200000,to_date('2/1/2011','mm/dd/yyyy'),3.56,4997518.18,'LOVE FUNDING CORPORATION' hname from dual union all
select 11206,6800000,to_date('5/1/2011','mm/dd/yyyy'),3.88,6576635.57,'WELLS FARGO BANK NA' hname from dual union all
select 11208,12240000,to_date('8/1/2011','mm/dd/yyyy'),3.84,11879882.17,'WELLS FARGO BANK NA' hname from dual union all
select 11209,12911500,to_date('10/1/2011','mm/dd/yyyy'),3.55,12542199.51,'M AND T REALTY CAPITAL CORP' hname from dual union all
select 11210,9596900,to_date('7/1/2011','mm/dd/yyyy'),5.38,9323421.23,'LANCASTER POLLARD MORTGAGE' hname from dual union all
select 11211,19951600,to_date('9/1/2011','mm/dd/yyyy'),3.88,19393524.45,'DEUTSCHE BANK BERKSHIRE MORTGAGE' hname from dual union all
select 11183,4230000,to_date('4/1/2009','mm/dd/yyyy'),6.55,4069938.75,'BERKADIA COMMERCIAL MORTGAGE' hname from dual union all
select 11212,50475000,to_date('1/1/2013','mm/dd/yyyy'),2.37,49852632.51,'LOVE FUNDING CORPORATION' hname from dual union all
select 11213,5496000,to_date('5/1/2012','mm/dd/yyyy'),3.1,5377541.15,'WELLS FARGO BANK NA' hname from dual
select hnum,oma,fpay,irate,apb,hname,r_oma,r_irate,r_fpay,0.5 * r_oma + 0.3 * r_irate + 0.2 * r_fpay r
from (select hnum,oma,fpay,irate,apb,hname,
dense_rank() over (order by oma desc) r_oma,
dense_rank() over (order by irate desc) r_irate,
dense_rank() over (order by (sysdate - fpay)) r_fpay
from data_table
order by r
HNUM
OMA
FPAY
IRATE
APB
HNAME
R_OMA
R_IRATE
R_FPAY
R
11197
37315000
12/01/2009
5.5
35851362.87
RED MORTGAGE CAPITAL LLC
2
9
12
6.1
11212
50475000
01/01/2013
2.37
49852632.51
LOVE FUNDING CORPORATION
1
20
1
6.7
11211
19951600
09/01/2011
3.88
19393524.45
DEUTSCHE BANK BERKSHIRE MORTGAGE
4
14
4
7
11200
26927000
07/01/2010
4.7
25186682.65
OAK GROVE COMMERCIAL MORTGAGE
3
12
10
7.1
11209
12911500
10/01/2011
3.55
12542199.51
M AND T REALTY CAPITAL CORP
5
17
3
8.2
11210
9596900
07/01/2011
5.38
9323421.23
LANCASTER POLLARD MORTGAGE
8
10
6
8.2
11196
8040000
06/01/2009
7
7775734.57
OPPENHEIMER MULTIFAMILY HSG
11
1
13
8.4
11208
12240000
08/01/2011
3.84
11879882.17
WELLS FARGO BANK NA
6
15
5
8.5
11193
8150400
12/01/2008
6.75
7828776.28
OPPENHEIMER MULTIFAMILY HSG
10
2
16
8.8
11186
11607400
02/01/2006
5.51
10580934.67
WELLS FARGO BANK NA
7
8
20
9.9
11204
9300000
02/01/2011
3.41
8927064.51
PNC BANK, NATIONAL ASSOCIATION
9
18
8
11.5
11201
7208600
10/01/2010
4.59
6949026.64
BERKADIA COMMERCIAL MORTGAGE
12
13
9
11.7
11206
6800000
05/01/2011
3.88
6576635.57
WELLS FARGO BANK NA
13
14
7
12.1
11183
4230000
04/01/2009
6.55
4069938.75
BERKADIA COMMERCIAL MORTGAGE
17
3
15
12.4
11195
3898000
05/01/2009
6.5
3752154.96
BERKADIA COMMERCIAL MORTGAGE
18
4
14
13
11188
4801800
09/01/2006
6.3
4326951.51
PNC BANK, NATIONAL ASSOCIATION
16
5
18
13.1
11213
5496000
05/01/2012
3.1
5377541.15
WELLS FARGO BANK NA
14
19
2
13.1
11205
5200000
02/01/2011
3.56
4997518.18
LOVE FUNDING CORPORATION
15
16
8
13.9
11199
3824000
02/01/2010
5.25
3673760.35
WALKER AND DUNLOP LLC -
Combine multiple web services with the same SQL query into one
Hello,
I would like to ask a question regarding combine multiple similar web services into one. Can you please tell me if it is possible to combine 4-5 web services into one since they built on the same SQL query with 5 different criterias or condition so that the user can enter any of the 5 criterias to populate the data on the form instead of having 5 different web services?
e.g Query: Select appName, permit#, address, phone, description, type, section, from table where appName = can be 'appName, permit#, address, phone, or description' to populate the rest of the data to the form.
Does any one have ever done some thing like this in Workbench ES? If so please assist. I know it can be easier to build it in Visual Basic, C#, or dot.net but the requirement is to build it in workbench ES.
Thanks in advance,
Han DaoIf you are querying for Name, PhoneNumber, and SSN, and you queried for all people with a phone number that started with 867, you would have a potentially long list of people. So to keep track of all of the people, we store each record in XML complex elements. The root node is just any name you want, and the repeating element is the complex element name.
So using the example from above, I'm going to specify the following:
Root Node: Result
Repeating Element: Person
So now when I do a query, my resultXML will look like:
<Result>
<Person>
<Name>Alex</Name>
<PhoneNumber>867-5309</PhoneNumber>
<SSN>111-11-1111</SSN>
</Person>
</Result>
If your query returned multiple results (like ours would probably), it would look like:
<Result>
<Person>
<Name>Alex</Name>
<PhoneNumber>867-5309</PhoneNumber>
<SSN>111-11-1111</SSN>
</Person>
<Person>
<Name>Han</Name>
<PhoneNumber>867-2169</PhoneNumber>
<SSN>222-22-2222</SSN>
</Person>
</Result>
So Result and Person is just to give a little bit of structure to the xml result (containers really). So you can name them whatever is helpful for you.
The column name mappings map the query columns (Name, PhoneNumber, SSN) to some node in the XML (Name, PhoneNumber, SSN). So you don't need to specify which field maps to what in the form. Just copy the column names to the element name so you have a 1-to-1 naming. If you want to manipulate the XML a bit though, you could do:
Column Name Element
Name YourName
PhoneNumber Phone
SSN Secret
which would then make your xml look like:
<Result>
<Person>
<YourName>Alex</YourName>
<Phone>867-5309</Phone>
<Secret>111-11-1111</Secret>
</Person>
</Result>
It lets you change the XML element names to whatever you want. Otherwise by default they take on their column names.
In your form, you could bind to the WSDL through the Data Connections pane and point it to your web service. This will then create form elements that you can just drag and drop allowing you to have the information available when the service gets ran. Once the service is called, you can modify the field's data to get whatever information you need in order to populate other form fields.
If that is too confusing, feel free to send me your form (e-mail is on profile page) and I'll add comments to it to show you how to set up the form for the web service call (and also give me the link to your webservice) -
SQL Query with MS-Access Database
Hi,
I have linked my oracle database with MS-Access via a DB LINK. i can access the data from MS-ACCESS, but i have a problem that when i specify the column name or define a where clause in my query it gives me the error ORA-00904: invalid identfier ..
This query fetch the data without any problem SELECT * FROM TBLREPORT@M_ACCESS but when i run SELECT EMP_ID FROM TBLREPORT@M_ACCESS it gives me the error i mentioned above. (Column name have No problem or mistake of spelling even CASE)
also when i try to put where clause in the query it gives me same error SELECT * FROM TBLREPORT@M_ACCESS WHERE EMP_ID = '100' (Error)
is there any change in SQL query for ACCESS database ??
any clue
Regards
RehmanAre column/table names in access case sensitive? Issue
DESC TBLREPORT@M_ACCESS If column EMP_ID actual name shows up in mixed/lower case, enclose it in double quotes and use the exact case. E.g., if column name shows up as Emp_Id, use:
SELECT "Emp_Id" FROM TBLREPORT@M_ACCESSSY. -
Can we link one application instance with multiple databases ?
We have R12.1.1 and db is 11.1.0.7 on redhat 5.3 ( 64 bit).
Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
is this possible ?
if yes how ?>
Can we link one application instance ( apps / , inst / ) with multiple database ( db / ),
is this possible ?
No. You cant link application tier with more than one database.
Similar query already answered by Hussein in detail in the forum :Re: Multiple instances, single Apps tier Please check that for more details
-Rk -
ORACLE EXPRESS: build a page with multiple forms linked to one table
hi,
im using oravle application express. APEX
i would like to build a page with multiple forms linked to one table (orders) , the page has 4 from each one with different order_id number (depending on filtering), and if the order is prepared click yes for each order and this 'YES' should be UPDATED AND SAVED to each order number in the same table with the press of one button.
i created all the form as (sql query)
and create one update process
(UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_1
WHERE ORDER_ID =:P10_ORDER_ID_1;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_2
WHERE ORDER_ID =:P10_ORDER_ID_2;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_3
WHERE ORDER_ID =:P10_ORDER_ID_3;
UPDATE ORDERS
SET TRAY_PREPARED =:P10_TRAY_PREPARED_4
WHERE ORDER_ID =:P10_ORDER_ID_4;
i dont know really if i can do that, but it appear hat it actually saving according to order_id number , but not all the time some time it saved the value as "null".
please guide me what is the correct way to do this.
I READ THIS ONE
http://stackoverflow.com/questions/7877396/apex-creating-a-page-with-multiple-forms-linked-to-multiple-related-tables
BUT IT WAS FOR MULTIPLE INSERT
thanks.Sans,
I am no Apex expert, but with a situation as "complex" as yours, have you thought about creating a VIEW that joins these 7/8 tables, placing an INSTEAD OF trigger on that view to do all the business logic in the database, and base your application on the view?
This is the "thick-database" approach that has been gaining momentum of late. The idea is to put your business logic in the database wherever possible, and let the application (Form, Apex, J2EE, whatever) concentrate on UI issues, -
SQL query with Bind variable with slower execution plan
I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
(Cost=2 Card=135 Bytes=6480)
Statistics
0 recursive calls
18 db block gets
15558 consistent gets
47 physical reads
9896 redo size
423 bytes sent via SQL*Net to client
1095 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
Execution Plan
0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
Statistics
0 recursive calls
12 db block gets
3003199 consistent gets
54 physical reads
9448 redo size
423 bytes sent via SQL*Net to client
1258 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
55 rows processed
TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
Regards
IvanMany thanks for your reply.
I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
for table I use:-
begin
dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
end;
for index I use:-
begin
dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
end;
Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
regards
Ivan -
BaseTableName blank when calling GetSchema on a query with multiple tables
I am using ODP.NET 11.2.0.3.0 and when calling GetSchemaTable on a DataReader that contains a join the returned SchemaTable has the BaseTableName and BaseColumnName fields blank - this is different than what I see with the Oracle OLE DB Provider and with how SQL Server's native provider works. I can't find any discussion of this - is this on purpose or is it a bug? why does the available schema information vary so drastically between a single table query and a query with multiple tables joined?
Thanks,
Bryan HintonHi Bryan,
I am also facing the same issue. Did u find any work around or any suggestions will be well appreciated.
Thanks,
Naresh. -
Need help with SQL Query with Inline View + Group by
Hello Gurus,
I would really appreciate your time and effort regarding this query. I have the following data set.
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*20.00*-------------19
1234567----------11223--------------7/5/2008-----------Adjustment for bad quality---------44345563------------------A-----------------10.00------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765--------------------I---------------------30.00-------------19
Please Ignore '----', added it for clarity
I am trying to write a query to aggregate paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Number, Invoice_Type, Vendor_Number. When there are no multiple records I want to display the respective Description.
The query should return the following data set
Reference_No---Check_Number---Check_Date--------Description-------------------------------Invoice_Number----------Invoice_Type---Paid_Amount-----Vendor_Number
1234567----------11223-------------- 7/5/2008----------paid for cleaning----------------------44345563------------------I-----------------*10.00*------------19
7654321----------11223--------------7/5/2008-----------Adjustment from last billing cycle-----23543556-------------------A--------------------50.00--------------19
4653456----------11223--------------7/5/2008-----------paid for cleaning------------------------35654765-------------------I---------------------30.00--------------19
The following is my query. I am kind of lost.
select B.Description, A.sequence_id,A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
from (
select sequence_id,check_date, check_number, invoice_number, sum(paid_amount) amount, vendor_number
from INVOICE
group by sequence_id,check_date, check_number, invoice_number, vendor_number
) A, INVOICE B
where A.sequence_id = B.sequence_id
Thanks,
NickIt looks like it is a duplicate thread - correct me if i'm wrong in this case ->
Need help with SQL Query with Inline View + Group by
Regards.
Satyaki De. -
How to compare same SQL query performance in different DB servers.
We have Production and Validation Environment of Oracle11g DB on two Solaris OSs.
H/W and DB,etc configurations of two Oracle DBs are almost same in PROD and VAL.
But we detected large SQL query performace difference in PROD DB and VAL DB in same SQL query.
I would like to find and solve the cause of this situation.
How could I do that ?
I plan to compare SQL execution plan in PROD and VAL DB and index fragmentations.
Before that I thought I need to keep same condition of DB statistics information in PROD and VAL DB.
So, I plan to execute alter system FLUSH BUFFER_CACHE;
But I am worring about bad effects of alter system FLUSH BUFFER_CACHE; to end users
If we did alter system FLUSH BUFFER_CACHE; and got execution plan of that SQL query in the time end users do not use that system ,
there is not large bad effect to end users after those operations?
Could you please let me know the recomendation to compare SQL query performace ?Thank you.
I got AWR report for only VAL DB server but it looks strange.
Is there any thing wrong in DB or how to get AWR report ?
Host Name
Platform
CPUs
Cores
Sockets
Memory (GB)
xxxx
Solaris[tm] OE (64-bit)
.00
Snap Id
Snap Time
Sessions
Cursors/Session
Begin Snap:
xxxx
13-Apr-15 04:00:04
End Snap:
xxxx
14-Apr-15 04:00:22
Elapsed:
1,440.30 (mins)
DB Time:
0.00 (mins)
Report Summary
Cache Sizes
Begin
End
Buffer Cache:
M
M
Std Block Size:
K
Shared Pool Size:
0M
0M
Log Buffer:
K
Load Profile
Per Second
Per Transaction
Per Exec
Per Call
DB Time(s):
0.0
0.0
0.00
0.00
DB CPU(s):
0.0
0.0
0.00
0.00
Redo size:
Logical reads:
0.0
1.0
Block changes:
0.0
1.0
Physical reads:
0.0
1.0
Physical writes:
0.0
1.0
User calls:
0.0
1.0
Parses:
0.0
1.0
Hard parses:
W/A MB processed:
16.7
1,442,472.0
Logons:
Executes:
0.0
1.0
Rollbacks:
Transactions:
0.0
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %:
Redo NoWait %:
Buffer Hit %:
In-memory Sort %:
Library Hit %:
96.69
Soft Parse %:
Execute to Parse %:
0.00
Latch Hit %:
Parse CPU to Parse Elapsd %:
% Non-Parse CPU:
Shared Pool Statistics
Begin
End
Memory Usage %:
% SQL with executions>1:
34.82
48.31
% Memory for SQL w/exec>1:
63.66
73.05
Top 5 Timed Foreground Events
Event
Waits
Time(s)
Avg wait (ms)
% DB time
Wait Class
DB CPU
0
100.00
Host CPU (CPUs: Cores: Sockets: )
Load Average Begin
Load Average End
%User
%System
%WIO
%Idle
Instance CPU
%Total CPU
%Busy CPU
%DB time waiting for CPU (Resource Manager)
Memory Statistics
Begin
End
Host Mem (MB):
SGA use (MB):
46,336.0
46,336.0
PGA use (MB):
713.6
662.6
% Host Mem used for SGA+PGA:
Time Model Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Operating System Statistics - Detail
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Foreground Wait Class
s - second, ms - millisecond - 1000th of a second
ordered by wait time desc, waits desc
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Captured Time accounts for % of Total DB time .00 (s)
Total FG Wait Time: (s) DB CPU time: .00 (s)
Wait Class
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
%DB time
DB CPU
0
100.00
Back to Wait Events Statistics
Back to Top
Foreground Wait Events
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Background Wait Events
ordered by wait time desc, waits desc (idle events last)
Only events with Total Wait Time (s) >= .001 are shown
%Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
Event
Waits
%Time -outs
Total Wait Time (s)
Avg wait (ms)
Waits /txn
% bg time
log file parallel write
527,034
0
2,209
4
527,034.00
db file parallel write
381,966
0
249
1
381,966.00
os thread startup
2,650
0
151
57
2,650.00
latch: messages
125,526
0
89
1
125,526.00
control file sequential read
148,662
0
54
0
148,662.00
control file parallel write
41,935
0
28
1
41,935.00
Log archive I/O
5,070
0
14
3
5,070.00
Disk file operations I/O
8,091
0
10
1
8,091.00
log file sequential read
3,024
0
6
2
3,024.00
db file sequential read
1,299
0
2
2
1,299.00
latch: shared pool
722
0
1
1
722.00
enq: CF - contention
4
0
1
208
4.00
reliable message
1,316
0
1
1
1,316.00
log file sync
71
0
1
9
71.00
enq: CR - block range reuse ckpt
36
0
0
13
36.00
enq: JS - queue lock
459
0
0
1
459.00
log file single write
414
0
0
1
414.00
enq: PR - contention
5
0
0
57
5.00
asynch descriptor resize
67,076
100
0
0
67,076.00
LGWR wait for redo copy
5,184
0
0
0
5,184.00
rdbms ipc reply
1,234
0
0
0
1,234.00
ADR block file read
384
0
0
0
384.00
SQL*Net message to client
189,490
0
0
0
189,490.00
latch free
559
0
0
0
559.00
db file scattered read
17
0
0
6
17.00
resmgr:internal state change
1
100
0
100
1.00
direct path read
301
0
0
0
301.00
enq: RO - fast object reuse
35
0
0
2
35.00
direct path write
122
0
0
1
122.00
latch: cache buffers chains
260
0
0
0
260.00
db file parallel read
1
0
0
41
1.00
ADR file lock
144
0
0
0
144.00
latch: redo writing
55
0
0
1
55.00
ADR block file write
120
0
0
0
120.00
wait list latch free
2
0
0
10
2.00
latch: cache buffers lru chain
44
0
0
0
44.00
buffer busy waits
3
0
0
2
3.00
latch: call allocation
57
0
0
0
57.00
SQL*Net more data to client
55
0
0
0
55.00
ARCH wait for archivelog lock
78
0
0
0
78.00
rdbms ipc message
3,157,653
40
4,058,370
1285
3,157,653.00
Streams AQ: qmn slave idle wait
11,826
0
172,828
14614
11,826.00
DIAG idle wait
170,978
100
172,681
1010
170,978.00
dispatcher timer
1,440
100
86,417
60012
1,440.00
Streams AQ: qmn coordinator idle wait
6,479
48
86,413
13337
6,479.00
shared server idle wait
2,879
100
86,401
30011
2,879.00
Space Manager: slave idle wait
17,258
100
86,324
5002
17,258.00
pmon timer
46,489
62
86,252
1855
46,489.00
smon timer
361
66
86,145
238628
361.00
VKRM Idle
1
0
14,401
14400820
1.00
SQL*Net message from client
253,909
0
419
2
253,909.00
class slave wait
379
0
0
0
379.00
Back to Wait Events Statistics
Back to Top
Wait Event Histogram
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (64 msec to 2 sec)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 sec to 2 min)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Wait Event Histogram Detail (4 min to 1 hr)
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Statistics
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
Service Wait Class Stats
No data exists for this section of the report.
Back to Wait Events Statistics
Back to Top
SQL Statistics
SQL ordered by Elapsed Time
SQL ordered by CPU Time
SQL ordered by User I/O Wait Time
SQL ordered by Gets
SQL ordered by Reads
SQL ordered by Physical Reads (UnOptimized)
SQL ordered by Executions
SQL ordered by Parse Calls
SQL ordered by Sharable Memory
SQL ordered by Version Count
Complete List of SQL Text
Back to Top
SQL ordered by Elapsed Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by CPU Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by User I/O Wait Time
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Gets
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Reads
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Physical Reads (UnOptimized)
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Executions
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Parse Calls
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Sharable Memory
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
SQL ordered by Version Count
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Complete List of SQL Text
No data exists for this section of the report.
Back to SQL Statistics
Back to Top
Instance Activity Statistics
Instance Activity Stats
Instance Activity Stats - Absolute Values
Instance Activity Stats - Thread Activity
Back to Top
Instance Activity Stats
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Absolute Values
No data exists for this section of the report.
Back to Instance Activity Statistics
Back to Top
Instance Activity Stats - Thread Activity
Statistics identified by '(derived)' come from sources other than SYSSTAT
Statistic
Total
per Hour
log switches (derived)
69
2.87
Back to Instance Activity Statistics
Back to Top
IO Stats
IOStat by Function summary
IOStat by Filetype summary
IOStat by Function/Filetype summary
Tablespace IO Stats
File IO Stats
Back to Top
IOStat by Function summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
ordered by (Data Read + Write) desc
Function Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Waits: Count
Avg Tm(ms)
Others
28.8G
20.55
.340727
16.7G
2.65
.198442
1803K
0.01
Direct Reads
43.6G
57.09
.517021
411M
0.59
.004755
0
LGWR
19M
0.02
.000219
41.9G
21.87
.496493
2760
0.08
Direct Writes
16M
0.00
.000185
8.9G
1.77
.105927
0
DBWR
0M
0.00
0M
6.7G
4.42
.079670
0
Buffer Cache Reads
3.1G
3.67
.037318
0M
0.00
0M
260.1K
3.96
TOTAL:
75.6G
81.33
.895473
74.7G
31.31
.885290
2065.8K
0.51
Back to IO Stats
Back to Top
IOStat by Filetype summary
'Data' columns suffixed with M,G,T,P are in multiples of 1024 other columns suffixed with K,M,G,T,P are in multiples of 1000
Small Read and Large Read are average service times, in milliseconds
Ordered by (Data Read + Write) desc
Filetype Name
Reads: Data
Reqs per sec
Data per sec
Writes: Data
Reqs per sec
Data per sec
Small Read
Large Read
Data File
53.2G
78.33
.630701
8.9G
7.04
.105197
0.37
21.51
Log File
13.9G
0.18
.164213
41.9G
21.85
.496123
0.02
2.93
Archive Log
0M
0.00
0M
13.9G
0.16
.164213
Temp File
5.6G
0.67
.066213
8.1G
0.80
.096496
5.33
3713.27
Control File
2.9G
2.16
.034333
2G
1.46
.023247
0.05
19.98 -
Is "Joins & For all entries" in same SQL Query Possible?
Hi all Professional,
Can we use "Inner Joins" and "For All Entries In" in the same SQL Query. if possible then pls clarify this query.
Here I am using three Transparent Table and fetching data from them.
SELECT abukrs abelnr ahkont axref2 ashkzg awrbtr agsber azfbdt azterm amwskz asgtxt axref1 agjahr abuzei
bkunnr bwerks bmenge bmeins bmatnr bkoart
cbukrs cbelnr cblart cbldat cbudat cxblnr cgjahr cstgrd cstblg cstblg c~xreversal
INTO CORRESPONDING FIELDS OF TABLE it_bsid FROM ( ( bsid AS a
INNER JOIN acctit AS b ON abukrs = bbukrs )
INNER JOIN bkpf AS c ON cbukrs = abukrs
AND cbelnr = abelnr
AND cgjahr = agjahr )
FOR ALL ENTRIES IN it_bkpf
WHERE
a~belnr EQ it_bkpf-belnr
AND a~gjahr EQ it_bkpf-gjahr
AND a~bukrs EQ it_bkpf-bukrs
AND a~gsber IN so_bus.
After executing this query, I'm getting Dump Error.
Error analysis
When the program was running, it was established that more
memory was needed than the operating system is able to provide savely.
To avoid a system crash, you must prevent this
situation.
Last error logged in SAP kernel
Component............ "EM"
Place................ "SAP-Server Development_DVL_01 on host Development (wp
2)"
Version.............. 37
Error code........... 7
Error text........... "Warning: EM-Memory exhausted: Workprocess gets PRIV "
Description.......... " "
System call.......... " "
Module............... "emxx.c"
Line................. 1886
Pls resolve, if anybody knows.
Thanks
DevinderHi,
During testing i notice that splitting into multiple selects does improve performance. But the best performance I achieved using DB Hints instead of splitting the select statements.
Generally performance of joins together with for all entries is bad.
However if you will look into SAP note 1662726 you will notice that this issue (bad performance in using join and for all entries together) has been addressed.
Even though the note is for HANA DB, FM RSDU_CREATE_HINT_FAE can be used independent of DB.
On HANA DB performance improvement is huge (i achieved 62 seconds using DB Hints compared to 1656 seconds using for all entries). On Oracle DB the same code initially run in 99 seconds with for all entries and with DB Hints in 82 seconds for ~ 1.000.000 records and ~660 seconds compared to 1349 seconds for ~8.000.000 records..
Sample code from SAP Note below:
Original statement:
SELECT COL1 COL2 COL3 COL4 COL5
FROM TAB1
INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
FOR ALL ENTRIES IN LT_SOURCE_TMP
WHERE COL3 = LT_SOURCE_TMP-COL3
AND COL4 = LT_SOURCE_TMP-COL4
AND COL5 = LT_SOURCE_TMP-COL5
Revision:
DATA: L_T_TABLNM TYPE RSDU_T_TABLNM,
L_LINES TYPE I,
L_HINT TYPE RSDU_HINT.
APPEND 'TAB1' TO L_T_TABLNM.
L_LINES = LINES( LT_SOURCE_TMP ).
CALL FUNCTION 'RSDU_CREATE_HINT_FAE'
EXPORTING
I_T_TABLNM = L_T_TABLNM
I_FAE_FIELDS = 3
I_FAE_LINES = L_LINES
I_EQUI_JOIN = RS_C_TRUE
IMPORTING
E_HINT = L_HINT
EXCEPTIONS
OTHERS = 0.
SELECT COL1 COL2 COL3 COL4 COL5
FROM TAB1
INTO CORRESPONDING FIELDS OF TABLE LT_RESULT
FOR ALL ENTRIES IN LT_SOURCE_TMP
WHERE COL3 = LT_SOURCE_TMP-COL3
AND COL4 = LT_SOURCE_TMP-COL4
AND COL5 = LT_SOURCE_TMP-COL5
%_HINTS ADABAS L_HINT.
Best regards,
Octavian
Maybe you are looking for
-
What are the Uses of Revision Level
Dear All, I have been searching for articles pertaining to "Revision Level" in the Material Master Record and found out that revision level is used purposely in Engineering Change Management and Document Management System. Is this true? I want to kno
-
Display BLOB from remote database
Context: We are offloading documents (pdf) from our OLTP database to a dedicated 'output database.' These documents must be displayed from the application on our OLTP database using a database link. Various posts show that querying a BLOB from a remo
-
Hi all, I have a 15" MBP i7, hi-res, non-glare screen and -- yes -- the fonts, etc., are REALLY small on, for example, Mail. Is there any way to set a default for VIEWING a larger size -- not SENDING a larger size font? Same issue with web pages, etc
-
To revert back a transport request from prd to dev server
hi experts how to revert back a transport request from prd server to dev server? a transport request has been wrongly transported and it has make major changes in production server, now we want to revert back that request , we kno
-
SAP License Key configuration procedure in Web AS(J2EE)
Hi, We installed Web AS 6.4 (J2ee). It is running on temporary license and going to expire in one week time. I applied for license key and got the permanent license key as a text file attachment through email. It is a simple text file containing the