Several tables af, same viewobject, whereclause different
Hello.JDeveloper 11.1.1.2, bc4j, jsff
Is it possible to have pages (jsff) based on the same viewobject IE. people where page 1 shows men (where sex = male) and page 2 shows women (where sex = female)?
How?
Best regards
Erik
Hi Erik,
Yes, you can have two pages based on the object of the view and what you can do is to have a bean managed for each page and alter the query from the VO programmatically add the male/female criteria on the managed bean class constructor method (or call a method that alter the manufacturer VO criteria) or by using PagePhaseListener.
I hope this helps.
Thank you
Cree
Tags: Java
Similar Questions
-
expdp + query option to export from several tables with the same condition
Hello
We want to export a subset of data only from databases to another. Both on AIX.
Source/testdatabase 11.2.0.3 (non partitioned tables)
Target productiion 11.2.0.3 database (separate tables)
Tables of same names of columns but diffrenet structures a partitioning index and traget so only want to import content
Each source datbaase hascolumn seq number table and want only to extract the last months of data.
want to use expdp but not sure how to make sure that all tables have the seq_num WHERE > 100 condition, if let table1: go out and have justTABLES:table1,table2... DUMPFILE=dump_dir CONTENT=data_only QUERY= table1:"WHERE seq_num >100 "
QUERY = "WHERE seq_num > 100"this condition would apply to all tables that we want."
I'm assuming that can also use impdp CONTENT = data_only?
Any ideas/thoughts?
Thank youQUERY = "WHERE seq_num > 100"this condition would apply to all tables that we want."
Yes, it will work for all tables, but ensure that all exported table must include this column.
QUERY
Default: no
Goal
Allows you to filter the data that is exported by specifying a clause of a SQL SELECT statement, which is applied to all tables in the work of export or a specific table.The query_clause is usually a WHERE clause for the selection of refined lines, but could be any SQL clause. For example, an ORDER BY clause can be used to accelerate a migration from a table in a heap in a table held in index. * If a [schema]. table_name is not provided, the query is applied to (and must be valid for) all tables in the export job.*
http://docs.Oracle.com/CD/B19306_01/server.102/b14215/dp_export.htm
-
Table of DB tools list: how to access tables that are in the different SQL database?
Hi all
I work on an implementation of database (SQL server) and evaluates the Toolkit OR DB for this project.
One of the requirements is that I need access to the tables that are in two different database
(say Table to 1 DB and Table B to 2 DB).
Our IT guy linked table in DB1 to DB 2 and I verfied this when I use the SQL server management studio.
When DB 2 tables is filled, table from DB1 is also there. I can also do the same thing using MS Access.
Table A of the DB1 is available for me enven if I only connect to 2 DB.
Here comes the problem.
When I use DB tool list Table.vi to access DB2, it does NOT list A table in DB1. It list only the tables in
the database (DB2) which I am connection (using DB tool opened Connection.vi with a file DSN)
So my work around right now is to open a separate connection both DB1 and DB2. However, this approach
obviously creates a problem when I have to access a separate database constantly in my application.
What would be a solution to this? I have search the Forum but only to see a post that is somewhat related to
My question. (And it was published the 2004) Maybe I need to change the code in the orignial VI (DB tool list Table.vi)?
My computer guy told me that he has not met this scenario since he wrote code in another environment such as
VB and others and it has always been successful in linking the different database tables.
I hope my question is clear and healthy because I don't really know much about database terminology.
Any comment or suggestion is appreciated!
Thank you
Chad
Ok. Here is some information that I can work with. Good.
Your COMPUTER staff created a view called "VISUAL_WORK_ORDER".
A view isn't a table. It is a "virtual" table Views are used to collect data (usually) in several different tables.
But I guess that the code inside the DB tool list Table.vi returns a list of tables. Views are not the tables. Then "VISUAL_WORK_ORDER" does not appear in the list.
HOWEVER, this should not really matter. The view is here! And it can be queried like any table. So, you can use DB tools Select Data.VI... and wire in "VISUAL_WORK_ORDER" as the name of the table. This will return the contents of the view. Alto!
-
Creating a combined chronology based on several chronologies in several tables
Hello
I need to extract a timeline for a customer based on valid_from and valid_to dates in several tables.
For example: I have a table named customers with an id, a valid_from a valid_to date and a table named contracts with contrat_name and customer_id and valid_from valid_to:
CUSTOMERS:
ID | VALID_FROM | VALID_TO
1. 01.03.2010 | 01.01.4000
CONTRACTS:
CONTRACT_NAME | CUSTOMER_ID | VALID_FROM | VALID_TO
Contracted | 1. 01.03.2010 | 01.10.2010
ContractB | 1. 01.10.2010 | 01.01.4000
The following statement would now give me the correct chronology:
Select customer cus.id, con.contract_name, greatest(cus.valid_from,con.valid_from) least(cus.valid_to,con.valid_to) valid_to valid_from
customers cus
stupid contracts on cus.id = con.customer_id inner join;
CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
1. Contracted | 01.03.2010 | 01.10.2010
1. ContractB | 01.10.2010 | 01.01.4000
It works, but I get a problem whenever I have a point from the time there is no contract for a client, but I would always like to have these periods in my calendar:
Suppose the following data and the same select statement:
CUSTOMERS:
ID | VALID_FROM | VALID_TO
1. 01.03.2010 | 01.01.4000
CONTRACTS:
CONTRACT_NAME | CUSTOMER_ID | VALID_FROM | VALID_TO
Contracted | 1. 01.05.2010 | 01.10.2010
ContractB | 1. 01.12.2010 | 01.03.2011
What I would now get would be:
CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
1. Contracted | 01.05.2010 | 01.10.2010
1. ContractB | 01.12.2010 | 01.03.2011
But what I get is the following:
CUSTOMER | CONTRACT | VALID_FROM | VALID_TO
1. null | 01.03.2010 | 01.05.2010
1. Contracted | 01.05.2010 | 01.10.2010
1. null | 01.10.2010 | 01.12.2010
1. ContractB | 01.12.2010 | 01.03.2011
1. null | 01.03.2011 | 01.01.4000
What I won't is generate a result with contract = null any time, there is no contract because I actually want to join the chronology of several different tables into one and it would be very complicated to assume things based on what data can or can not be found in a specific table.
Thanks for any help or ideas,
Kind regards
ThomasHi, Thomas,.
Whenever you have a problem, after the sample data in a form that people can use to recreate the problem and test their ideas. CREATE TABLE and INSERT statements are great.
For example:CREATE TABLE customers ( customer_id NUMBER (6) PRIMARY KEY , valid_from DATE NOT NULL , valid_to DATE NOT NULL ); INSERT INTO customers (customer_id, valid_from, valid_to) VALUES (1, DATE '2010-03-01', DATE '4000-01-01'); INSERT INTO customers (customer_id, valid_from, valid_to) VALUES (2, DATE '2010-03-01', DATE '4000-01-01'); CREATE TABLE contracts ( contract_name VARCHAR2 (15) NOT NULL , customer_id NUMBER (6) , valid_from DATE NOT NULL , valid_to DATE NOT NULL ); INSERT INTO contracts (contract_name, customer_id, valid_from, valid_to) VALUES ('Contract 1a', 1, DATE '2010-03-01', DATE '2010-10-01'); INSERT INTO contracts (contract_name, customer_id, valid_from, valid_to) VALUES ('Contract 1b', 1, DATE '2010-10-01', DATE '4000-01-01'); INSERT INTO contracts (contract_name, customer_id, valid_from, valid_to) VALUES ('Contract 2a', 2, DATE '2010-05-01', DATE '2010-10-01'); INSERT INTO contracts (contract_name, customer_id, valid_from, valid_to) VALUES ('Contract 2b', 2, DATE '2010-12-01', DATE '2011-03-01');
If a customer contracts of n, then you might need as much as 2n + lines 1 output for this client:
(a) 1 row showing the period, not from the date of customers both valid_from 1st contract begins
(b) n lines indicating the periods under contracts
(c) n lines indicating the period right after each contract, until the following starts (or valid_to of the client, if there is no next contract)
However, you will have lines for periods not contacted ((a) or (c)) if their mandate is 0 days.This sounds like a job for the UNION. Make a UNION 3 lanes in a subquery to generate (a), (b), and (c), and then put a WHERE clause on the combined, results to filter the lines not length 0.
In the query subsidiary UNION, (a) can be done with a query GROUP BY, and (c) can be done using the analytical function of LEAD.WITH union_data AS ( SELECT ua.customer_id , NULL AS contract_name , MIN (ua.valid_from) AS valid_from , MIN (oa.valid_from) AS valid_to FROM customers ua JOIN contracts oa ON ua.customer_id = oa.customer_id GROUP BY ua.customer_id -- UNION ALL -- SELECT customer_id , contract_name , valid_from , valid_to FROM contracts -- UNION ALL -- SELECT uc.customer_id , NULL AS contract_name , oc.valid_to AS valid_from , LEAD ( oc.valid_from , 1 , uc.valid_to ) OVER ( PARTITION BY uc.customer_id ORDER BY oc.valid_from ) AS valid_to FROM customers uc JOIN contracts oc ON uc.customer_id = oc.customer_id ) SELECT * FROM union_data WHERE contract_name IS NOT NULL OR valid_from < valid_to ORDER BY customer_id , valid_from ;
Output:
CUSTOMER_ID CONTRACT_NAME VALID_FROM VALID_TO ----------- --------------- ---------- ---------- 1 Contract 1a 01.03.2010 01.10.2010 1 Contract 1b 01.10.2010 01.01.4000 2 01.03.2010 01.05.2010 2 Contract 2a 01.05.2010 01.10.2010 2 01.10.2010 01.12.2010 2 Contract 2b 01.12.2010 01.03.2011 2 01.03.2011 01.01.4000
Published by: Frank Kulash, April 20, 2011 06:51
Examples added -
Implementation of dumps for several table
Hello
Is it possible to configure the < dumps-plan > element or implement dumps to get data from multiple
table. Currently the sample xml and dumps in the tutorial is configured to a single table.
Thank you
-TrapaniHi Thiru,
As Rob mentioned, you can implement dumps to do just about anything you want: do a join between tables, run several queries for data from multiple tables or even access non-base data system, such as an existing system or a web service to retrieve the data. Consistency really cares how you implement your cache store and where you get the data, as long as you return a single object to the load method, which must be inserted in the cache the cache store is set up for (or in the case of loadAll, many objects in a map).
However, what I didn't understand not your question is if you want to load the data of several related tables to create a single object (an aggregate in DDD terminology), or if you want to create different entity objects based on the data in each table and put them all in the cache. Normally, you should have a cache by entity type, while the latter is discouraged until you know exactly why you do and are recommended to create a separate for each entity type cache and use different cache stores for them. Otherwise, you will encounter issues if you try to index your cache or run queries on it, because these characteristics depend on the schema of compatible entry.
However, if you load an aggregate, you can decide to store the entire aggregate object in a single cache, in which case you will probably eventually query several tables related to construct an instance of an aggregate, or you may decide to store root cluster in its own cache, and separate the low related entities in caches, once again a cache by entity type. The choice should really depend on the size of small entities within an aggregate and access model data, so it is difficult to provide general guidance. However, if you do not end up storing weak entities in separate caches, it is usually advantageous to use the key association to ensure that they are located in the same partition as their aggregate root.
Kind regards
ALEKS -
joining several tables to generate data
with itemlist as
(select 1 cid, listname 'test', 'r' flg Union double all the)
Select 2 cid, listname 'test2', ' not flg double
),
category 1)
Select 1 cid, 122 k' sub '123' catcode, of any double Union
Select 1 cid, '234i' catcode, sub '124' all Union double
Select 1 cid, 238 k' void '124' catcode, double
)
void)
Select 1 cid, sub '123' of any union double
Select 1 cid, sub ' 124' double
)
I want to write a static query that gathers all the tables and produces the following output assuming that
CID is you pass as a parameter
CID listname flg topic catcode
1 123 122 k r test
1 test of r 234i 124
1 124 238 k r test
Suppose the data as changes to follow and even cid 1 is to pass as a parameter:
with itemlist as
(select 1 cid, listname 'test', 'r' flg Union double all the)
Select 2 cid, listname 'test2', ' not flg double
),
category 1)
Select 1 cid, 122 k' sub '123' catcode, of any double Union
Select 1 cid, '234i' catcode, sub '124' all Union double
Select 1 cid, 238 k' void '124' catcode, double
)
void)
Select 2 cid, sub '123' of any union double
Select 2 cid, sub '124' double
)
then the output should be
CID listname flg topic catcode
1 r test 123
1 test of r 124
1 test of r 124
for a final example, suppose the data now as to user 1 as cid
with itemlist as
(select 1 cid, listname 'test', 'r' flg Union double all the)
Select 2 cid, listname 'test2', ' not flg double
),
category 1)
Select 2 cid, 122 k' sub '123' catcode, of any double Union
Select 2 cid, catcode '234i', '124' void in any union double
Select 2 cid, 238 k' void '124' catcode, double
)
void)
Select 1 cid, sub '123' of any union double
Select 2 cid, sub '124' double
)
output must be
CID listname flg topic catcode
1 test r 123
Basically, the user will pass a cid, in this case 1. I'll read the itemlist where cid = 1 and I want to join all the other tables
to itemlist in such a way that I can generate extra lines. If no entry is found for cid 1, for example, in category 1 or auxiliary table
then the beloging column of this table must be null in the result
can someone help me write a query to produce the output above
Hello
elmasduro wrote:
...
Here is an explanation of the output. a user will have a front screen where it can enter itemlist info.
then in a submenu may enter a category or sub or both or none of them. the user can select multiple categories or sub
When the user presses the button Save, an entry will be made in the itemlist table, for example the cid = 1.
If he choose a category but without Subs, then will be entered into the table at say cid = 1
but no entries will be made for sub because he chose not to all values. If he chooses void instead of category values
then sub taable will fill and category is not. If he chooses the category and under, then both will be filled.what I want to do is to join the itemlist with table category and sub table and get the data to the Scriptures, this intervention of the user.
These entries not found will be the null value column in the result.
for example, the cid = 1 itemlist, if user enter category but not void, itemlist will be the join with the table category and sub
but since sub has no entry for the cid = 1, the column object will be empty in the output, but catcode will fillI'm so confused.
It is a query (that is, just a SELECT statement, which shows the data already present in the tables), or is this a DML statement, that will add data to the tables? If it's just a query, then do not say things like "entries will be taken" or "filled with tables.
Assuming you want a request maybe you want something like this:
WITH c_and_s AS
(
SELECT NVL (c.cid, s.cid) AS cid
NVL (c.sub, s.sub) AS topic
, NVL2 (s.cid, c.catcode, NULL) AS catcode
CATEGORY 1 c
FULL OUTER JOIN void s ON c.cid = s.cid
AND c.sub = s.sub
)
SELECT i.cid, i.listname, i.flg
cs.subject, cs.catcode
Itemlist I have
LEFT OUTER JOIN c_and_s ON cs.cid = i.cid cs
WHERE the i.cid (1) - you can do the cids 2 or several at the same time, if you want to
ORDER BY i.cid, cs.subject, cs.catcode
;
This example gets the output you asked data sample you posted.
-
Mr President.
My worm jdev is 12.2.1
How to enter two rows at the same time with different default values that only the first line to use see?
Suppose I have a table with four fields as below
"DEBIT" VARCHAR2(7) , "DRNAME" VARCHAR2(50), "CREDIT" VARCHAR2(7) , "CRNAME" VARCHAR2(50),
Now I want that when I click on a button (create an insert) to create the first line with the default values below
So if I click on the button and then validate the second row with different values is also inserted on commit.
The value of the second row are like the picture below
But the second row should be invisible. It could be achieved by adding vc in the vo.
The difficult part in my question is therefore, to add the second row with the new default values.
Because I already added default values in the first row.
Now how to add second time default values.
Concerning
Mr President
I change the code given by expensive Sameh Nassar and get my results.
Thanks once again dear Sameh Nassar .
My code to get my goal is
First line of code is
protected void doDML(int operation, TransactionEvent e) { if(operation != DML_DELETE) { setAmount(getPurqty().multiply(getUnitpurprice())); } if (operation == DML_INSERT ) { System.out.println("I am in Insert with vid= " + getVid()); insertSecondRowInDatabase(getVid(),getLineitem(),"6010010","SALES TAX PAYABLE", (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } if(operation == DML_UPDATE) { System.out.println("I am in Update with vid= " + getVid()); updateSecondRowInDatabase(getVid(), (getPurqty().multiply(getUnitpurprice()).multiply(getStaxrate())).divide(100)); } super.doDML(operation, e); } private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object value4, Object value5) { PreparedStatement stat = null; try { String sql = "Insert into vdet (VID,LINEITEM,DEBIT,DRNAME,AMOUNT) values " + "('" + value1 + "','" + value2 + "','" + value3 + "','" + value4 + "','" + value5 + "')"; stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } } private void updateSecondRowInDatabase(Object value1, Object value5) { PreparedStatement stat = null; try { String sql = "update vdet set AMOUNT='"+ value5+"' where VID='" + value1 + "'"; stat = getDBTransaction().createPreparedStatement(sql, 1); stat.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { stat.close(); } catch (Exception e) { e.printStackTrace(); } } }
Second line code is inside a bean method
public void addNewPurchaseVoucher(ActionEvent actionEvent) { // Add event code here... BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter = (DCIteratorBinding) bindings.get("VoucherView1Iterator"); RowSetIterator rsi = dciter.getRowSetIterator(); Row lastRow = rsi.last(); int lastRowIndex = rsi.getRangeIndexOf(lastRow); Row newRow = rsi.createRow(); newRow.setNewRowState(Row.STATUS_NEW); rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow); rsi.setCurrentRow(newRow); BindingContainer bindings1 = BindingContext.getCurrent().getCurrentBindingsEntry(); DCIteratorBinding dciter1 = (DCIteratorBinding) bindings1.get("VdetView1Iterator"); RowSetIterator rsi1 = dciter1.getRowSetIterator(); Row lastRow1 = rsi1.last(); int lastRowIndex1 = rsi1.getRangeIndexOf(lastRow1); Row newRow1 = rsi1.createRow(); newRow1.setNewRowState(Row.STATUS_NEW); rsi1.insertRowAtRangeIndex(lastRowIndex1 +1, newRow1); rsi1.setCurrentRow(newRow1); }
And final saveUpdate method is
public void saveUpdateButton(ActionEvent actionEvent) { // Add event code here... BindingContainer bindingsBC = BindingContext.getCurrent().getCurrentBindingsEntry(); OperationBinding commit = bindingsBC.getOperationBinding("Commit"); commit.execute(); OperationBinding operationBinding = BindingContext.getCurrent().getCurrentBindingsEntry().getOperationBinding("Commit"); operationBinding.execute(); DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("VdetView1Iterator");// write iterator name from pageDef. iter.getViewObject().executeQuery(); }
Thanks for all the cooperation to obtain the desired results.
Concerning
-
How to extract the indictments of several tables
Hi all
I have 10 tables that all have the same columns, but different data in each column. I would like to get a count of how many fields is not null for a specific column in each table. I tried to figure this out for hours without success. We use oracle 10g and I use Toad to write my SQL.
I will try to give you an example.
The SQL below returns the numbers for one of the tables. I would like to get the counts for each table with a single query.
SELECT COUNT(*) FROM RRM_HOME_EQ WHERE unit_id is not null AND account_off is not null;
Thanks in advance
OR
Try as below...
Select (select count (*) from emp where deptno = 10) tab1, tab2 (select count (*) of the Department)
Double;
TAB1 TAB2
---------- ----------
3 7
Hope this helps... !
-
Hello
I have a trigger which in a specific State, change 14 synonyms of 14 different paintings.
The official documentation is not possible to create the synonym of more then one table at the same time.
You know some tricks to simplify this operation?
Thank you
Ste
Ste74 wrote:
DB architecture, I have three 'groups' of tables (with 7 tables) with the same structure but different in data.
Simply create an additional column of ACTION_GROUP and 7 tables with the same structure as those that already exist. List the tables of newly created partition by column ACTION_GROUP create 3 partitions with the values 1, 2 and 3. Add the ACTION_GROUP column to each of the 21 existing tables and tables 1 to the tables of Group 1, group 2 and group 3 3 table 2. Now, you can fill each partition table newly created through the exchange of the partition corresponding get and group the data in table rid your 21 original tables. Now you have 7 tables and all you need is WHERE ACTION_GROUP =
added to your queries. Actually, same approach might work even without partitioning - you simply need to use insert instead of exchange of the partition. SY.
-
Hello
We are working on a data warehousing project and wonder how do to join several tables that each are versioned separately (type SCD 2 with a valid and valid to date).
Because for example, we get our client from a single source of information (id customer, name, etc.) and the information on the rate of customer from another source. The sources are different, we have the separate tables for them and each of them gets versioned independently.
Here's my customer table (with its own valid and valuable to the columns).
ID Name of the customer Valid from Valid until the 1 CitiBank 1 JANUARY 14 JANUARY 1, 15 1 New CitiBank 2 JANUARY 15 FEBRUARY 1, 15 1 Latest CitiBank 2 FEBRUARY 15 APRIL 1, 15 And similarly the Client side ID and rating information.
ID Note Valid from Valid until the 1 Platinum 1 JANUARY 14 FEBRUARY 1, 14 1 Premium FEBRUARY 1, 14 1ST MARCH 15 I want to merge the two tables above and present information at a glance. I have some difficulty to determine validates the valid columns.
ID Name of the customer Note Valid from (Calculated) Valid until the (calculated) 1 CitiBank Platinum 1 JANUARY 14 FEBRUARY 1, 14 1 CitiBank Premium FEBRUARY 1, 14 JANUARY 1, 15 1 New CitiBank Premium 2 JANUARY 15 FEBRUARY 1, 15 1 Latest CitiBank Premium 2 FEBRUARY 15 1ST MARCH 15 And it's the query I used to get the above result:
SELECT client. id ,
customer . name ,
CRM . level ,
Greatest (client. vld_fm , crm. vld_fm ),
Least (client. vld_to , crm. vld_to )
DE client client,
client_rating crm
OÙ client. id = crm. id
AND ( client. vld_fm <= crm. vld_fm
AND client. vld_fm <= crm. vld_to
AND client. vld_fm >= crm. vld_fm
AND client. vld_fm >= crm. vld_to )
OR ( client. vld_fm BETWEEN crm. vld_fm AND crm. vld_to )
OR ( client. vld_to BETWEEN crm. vld_fm AND crm. vld_to );
The problem is we have several data sources (and each with its own versions) and joins become so very very complex. Is there a better way to write the query?Or maybe a better way to design our tables?
Thanks for your help.
Anand
Hello
you only need ranges that overlap to join.
Re: How do to sql query in a loop
Is a simpler way to test if the x_start to x_stop range comes into conflict with the range of y_start to y_stop
WHERE x_start <= y_stop AND y_start <= x_stop
In other words, two overlapping if and only if everyone will start before the other ends one. If this is not obvious (and it was certainly not clear to me when I heard it), then look at it this way: two ranges are not overlapping if and only if one of them starts after the end of the other.
Concerning
Marcus
-
I want to know if I can use creative cloud with the same account on different computers
I want to know if I can use creative cloud with the same account on different computers, because my children want to she and I have known if I buy when I can use it on several computers at the same time
If it is the individual subscription, you can activate on 2 computers only.
However, there is no limit for installation, but you can connect and activate on 2 computers only.
If you had already signed and activated CC apps on 2 computers, and there still if you want to activate on a 3' rd computer, you can simply disconnect one of the 2 comps, so that you can keep counties of activation.
For more information, see the link below:
https://www.Adobe.com/content/dotcom/IE/products/creativecloud/FAQ.html
-
outer join when there are several tables are involved
Could not put up the question correctly to the last channel, my problem is with the join when there are several tables are involved, this is just one example of the task that I have to carry.
Tab1 aura model id retailer_id information for all the weeks (from the first Monday) of the month of JUNE with cost and Helen
Tab1
model_id
retailer_id
sell_date
cost
Helene
1
12
June 3, 13
100
40
1
12
June 10, 13
200
20
1
12
17 June 13
300
20
1
12
24 June 13
400
20
2
12
June 3, 13
300
10
2
12
June 10, 13
200
20
2
12
17 June 13
300
20
2
12
24 June 13
400
20
Tab2:
each retailer belongs to a dealer, under the table has the same information
retailer_id
Dealer_id
12
100
13
100
14
101
15
101
16
101
Tab 3
There is a third layer where each dealership is having a garage band
Dealer_id
Dealer_group
100
1001
101
1001
102
2001
103
2001
104
3001
105
3001
Tab4:
Of this table for each model and dealer discount information for the month of June (every week)
model_id
Dealer_group
discount_date
discount
1
1001
June 3, 13
10
1
1001
June 10, 13
20
1
1001
17 June 13
10
1
1001
24 June 13
30
2
1001
June 3, 13
10
2
1001
June 10, 13
20
2
1001
17 June 13
10
2
1001
24 June 13
30
3
2001
June 3, 13
10
3
2001
June 10, 13
20
3
2001
17 June 13
10
3
2001
24 June 13
30
Master_info:
It's the main table which is the master table for model /retailer information
Model_id
retailer_id
1
12
2
12
3
12
4
12
1
13
2
13
Output
model_id
retailer_id
sell_date
cost
Helene
Final (cost-helene-discount)
1
12
June 3, 13
100
40
50
1
12
June 10, 13
200
20
160
1
12
17 June 13
300
20
270
1
12
24 June 13
400
20
350
2
12
June 3, 13
300
10
280
2
12
June 10, 13
200
20
160
2
12
17 June 13
300
20
270
2
12
24 June 13
400
20
350
3
12
June 3, 13
0
0
0
3
12
June 10, 13
0
0
0
3
12
17 June 13
0
0
0
3
12
24 June 13
0
0
0
4
12
June 3, 13
0
0
0
4
12
June 10, 13
0
0
0
4
12
17 June 13
0
0
0
4
12
24 June 13
0
0
0
1
13
June 3, 13
0
0
0
1
13
June 10, 13
0
0
0
1
13
17 June 13
0
0
0
1
13
24 June 13
0
0
0
2
13
June 3, 13
0
0
0
2
13
June 10, 13
0
0
0
2
13
17 June 13
0
0
0
1
13
24 June 13
0
0
0
For highted above records (model_id / retailer_id combination) there is no record in tab1 but they have entered in master_info then the recordings should come for all model_id/retailer_id with all the 0 values
Hello
Thanks for posting the sample data.
It is unclear what dates you want to include in the output. The following query shows how you can generate every Monday in a given range. If you only want to include the dates that are actually present in tabl1 and/or tab4, you can simplify this a bit.
WITH date_range AS
(
SELECT TRUNC (TO_DATE (' 3 June 2013', 'DD-Mon-YYYY'))
, 'IW '.
) AS first_monday
, TRUNC (TO_DATE (24 June 2013 ', 'DD-Mon-YYYY') + 6)
, 'IW '.
) AS last_monday
OF the double
)
all_mondays AS
(
First_monday SELECT + (7 * (LEVEL - 1)) AS sell_date
OF date_range
CONNECT BY LEVEL<= 1="" +="" (="" (last_monday="" -="">=>
/ 7
)
)
SELECT mi.model_id
mi.retailer_id
am.sell_date
, Cost of NVL (t1.cost, 0) AS
, NVL (t1.rebat, 0) IN the refund
, NVL (t1.cost, 0)
-(NVL (t1.rebat, 0))
+ NVL (t4.discount, 0)
) AS final
E master_info
CROSS JOIN all_mondays am
LEFT OUTER JOIN tab1 t1 ON t1.model_id = mi.model_id
AND t1.retailer_id = mi.retailer_id
AND t1.sell_date = am.sell_date
LEFT OUTER JOIN tab2 t2 ON t2.retailer_id = mi.retailer_id
LEFT OUTER JOIN tab 3 t3 ON t3.dealer_id = t2.dealer_id
LEFT OUTER JOIN tab4 t4 ON t4.model_id = t1.model_id
AND t4.dealer_group = t3.dealer_group
AND t4.discount_date = t1.sell_date
ORDER BY mi.retailer_id
mi.model_id
am.sell_date
;
The results are not exactly what said you you wanted. I suspect it's because of typos in that you posted.
-
A block of data, several tables
In the manual of Concepts 10.2 is the following definition:
Table directory
This part of the data block contains information about the table with lines in this block.
11.2 Concepts manual, the definition has been changed:
Table directory
+ For a table in a heap, this directory contains metadata about the tables whose lines are stored in this block. Several tables can store lines in the same block. +
How many tables can store lines within a single block? A block belongs to a point belongs to a segment belongs to an object.The only case I could think of where it is true is in a cluster in the table.
Of http://docs.oracle.com/cd/E14072_01/server.112/e10713/tablecls.htm#i25478
A cluster of the table is a group of tables that share common columns and store related data in the same blocks. When the tables are grouped, a single data block can contain several tables lines
-
Performance in the treatment of the based on a game, several tables from target
Welcome.
I have question about a treatment based on a game, when mapping have several tables in the target. I noticed that OWB generate SQL code that usually build a query for each table in the target insertion. Suggest that each table has results from different stages of the treatment, so multi table insert cannot be used. Looking for generated code PL/SQL, I feel that each insert query managed independently and so each make analyses of source table and joins on its own.
To make my question more concrete, I will introduce two simple examples of stream ETL:
1) start-> (table scan)--> (joins)--> (inserting into the table t1)
2) start-> (table scan)--> (joins)-> two targets: (insert into table t1)
-> two targets: (deduplicator)--> (insertion in table t2)
Admit, that scans and joins are very expensive comparing to insert rows. Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?
Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?
Best regards
PawelHi Pawel,
Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?
Yes, you are right
Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?
Nor the database Oracle or OWB don't is not to intermediate capabilities query result caching.
While the Oracle database feature "result cache queries", but it must match exactly to SQL source and it store only the final query result...Kind regards
Oleg -
Oracle 11.1.0.6 database
RHEL 5.3
Hi all
1.)
I want reorg several tables with the ETG. But because there are several tables with different indexes and column names I can not use the order by clause.
create the table reorg_HR_STAGE_EDW. SFHR_ORG_MAPPING_FILE
tablespace REORG
PCTFREE 10 pctused, initrans, maxtrans 1 255
storage)
initials pctincrease of 1 M following 0M 0
MINEXTENTS 1 maxextents unlimited
in select * from HR_STAGE_EDW. SFHR_ORG_MAPPING_FILE;
The table is going to get reorganized even without the orderby clause?
2.)
The steps I should follow are (please, correct me if I'm wrong):
-Create table with the new name in the new tablespace
-Remove the old tables
-Move converted tables to the original tablespace
Is it OK, what happens to the index?
Help, pleaseYou can also copy dependent table with dbms_redfinition. The procedure is called COPY_TABLE_DEPENDENTS. See http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_redefi.htm
ALTER table move would also be possible, but doen't it locks the table all the time?
Kind regards
-wiZ
Maybe you are looking for
-
Z22 all data lost palm desktop Memo / can not recover
Hello When I opened my z22 office program I got an error message saying roughly memo cannot be opened, it may have saved a '.dat' file but I can't find anything. None of my memos exist on the desktop anymore, thankfully, they remain on the z22 becaus
-
Enter password administrator or power on system disabled password 60753518
I need help Spoiler (Highlight to read) Spoiler (Highlight to read) Spoiler (Highlight to read) Cod of the 60753518 error Enter the password administrator or power on password system disabled60753518 error cod 60753518enter administrator password or
-
I can't uninstall a program.
Hi, I had a problem when an update of Windows has not installed properly (DiBcom DIB9080) and uninstalled my program for an internet mobile dongle thinking he had something to do with this, I can recall the points of restoration and restored back bef
-
Application has actually been deleted?
I installed a signed using the Android blackberry app - deploy. Then, using Sumulator 10, I removed an icon on the desktop (based on trash), and he's gone. However, "blackberry - deploy - listInstalledApps ' always lists the installed application and
-
Network of Windows XP and Windows 7
I have a Windows XP computer and a Windows 7 computer, I want to create a local network between them to play Total annihilation. I can't make it work. I tried various tips from the forums on this site but none of this seems to help. I don't know what