Pagination of the table in a query with table Panel
Hello
I need to implement paging in a table as long as the results of a query which makes the user, the table that the query is run has several records, 40000 or more.
I searched but I can't find a way to apply what I, some links show me how to insert the pagination on the part of the table, but if I only do when I want to see a different page, let's say 500 or 1000, it takes too long to display the data of that specific page. I'm guessing it will retrieve all the data from the query and read it all so it can show what I want.
Another way is to control the amount of data to be returned from the view object (VO), but I am unable to perform paging efect component table in my file jspx somehow.
I think I should change my VO both my component so I can get the effect I want, but I don't know how. Properties that I need to change to achieve this.
THK
If I set the af: non paginated table mode the number of pages do not appear.
Then maybe you can use the code from this blog to do it manually:
http://www.Ateam-Oracle.com/adventures-in-WebCenter-skinning-aftable-with-custom-pagination/
The only optimization that I think is missing is somehow when I select the page from the list of results, will retrieve only the data on this page.
Yes and for this you must range Paging in VO (so the result of the query may be limited by the size of the range).
But, as I mentioned in my first reply, range of paging is bug in 12.1.3 then maybe the same applies to 11.1.1.7
Dario
Tags: Java
Similar Questions
-
How to do a pagination on the table?
Hi all
I hava ORT with large value data, and I drop a table.
How can I make I pagable? I koen some api such as setRangeSize (n), scrollToRangePage (P), but I didn't know how to use it
are there examples?
Thank you
userThe table pagination is under construction.
Define the RangeSize in the pageDef file.AF:table definition:
fetchSize="#{bindings.ViewObj12_1.rangeSize}"
If you set 50 (default is 25, the value - 1 to extract all) whenever when you scroll the table he realized extraction 50 lines.
Have a sufficient height of the table to display 50 lines. If the height is not enough to show that 50 lines, she can send multiple requests to the server to retrieve the data. -
explain the plan of a query with variables
Trying to Explain plan at some sql code in sql * more. The query has a variable. How can I do this?
I look to explain the plan and dbms_xplan but did not find anything with variablesuse sqlplus variable bind:
SQL> --define variable SQL> var x varchar2 SQL> -- notice the colon prefixing the variable SQL> explain plan for select * from customer where cid = :x; Explained. SQL> select * from table( dbms_xplan.display ); PLAN_TABLE_OUTPUT ----------------------------------------------------------------------------------------------- Plan hash value: 1709312366 ---------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 67 | 2 (0)| 00:00:01 | | 1 | TABLE ACCESS BY INDEX ROWID| CUSTOMER | 1 | 67 | 2 (0)| 00:00:01 | |* 2 | INDEX RANGE SCAN | CID | 1 | | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 2 - access("CID"=:X) 14 rows selected.
the variable should not be set to explain the request, because explain does not actually run.
Published by: shoblock on November 6, 2008 16:51
-
Compare the result of a query with a number and return a message
Hello
I have the following query in oracle 9i:
SELECT COUNT (*)
OF hourly_files
WHERE date_received = TO_DATE ((SELECT TO_CHAR (SYSDATE - INTERVAL '1' DAY, 'DDMMYYYY')
(THE DOUBLE), 'DDMMYYYY');
This will produce a number of lines required
I need to compare the number of output with another number hardcoded (threshold) and print an appropriate example message
If the result of the query above is 18000 and the number of threshold is fixed at 20000, then output a meesage:
Number of files received less than 2000
Any help will be very appreciated!
Thank you.SQL> ed Wrote file afiedt.buf 1 SELECT CASE WHEN COUNT(*) >5 THEN 'Number is > than 5' 2 WHEN COUNT(*) <1 THEN 'Its less than 1' 3 ELSE 'Its in between' 4 END 5 FROM emp 6* WHERE deptno=20 SQL> / CASEWHENCOUNT(*)>5 ------------------ Its in between SQL> SELECT COUNT(*) FROM emp 2 WHERE deptno=10; COUNT(*) ---------- 3
-
How publish data from the table with some data loss all post in the forum
I wonder how people are displayed the data in the table or the result of a query with losing them its format from Sqlplus display when they post in the forums of Oracle. I searched on the basis of knowledge of DB but I see no article about it. can you please help me or direct me to this link, I tried different options using code and other tags but nothing has worked, thank you for your help. Thank you.
Edited by: Ariean October 3, 2011 12:34You can click on the link to the FAQ at the top right: http://wikis.sun.com/display/Forums/Forums+FAQ.
-
Data are not engaging in the table
Hi all
I have a requirement in which I need to add the following in an existing page.
There is a query with a simple search panel and tabel corresponding region on the page. My requirement is to add a new field in the search panel and
in the table. I did it successfully. The table has an update icon in which you navigate to a page where you can go and update all fields. But what is happening is that all the data are correctly updated except for the newly added field. Value NULL is is filled in the table.
In the existing page they use an entity object to insert/update in tabel.
I followed the following steps:
1 has created a new field in the research and the table Panel.
2 aajoutee new attribute in EO and VO.
3. has created a new field in the page updated and joint vo attribute to it.
But the data are fill in the tabel except adding the newlt field.
Please help me.Adam
There is no option to synchronize if Jdev 10 G. He is smart enough to take care of this. But if you add a new attribute to your existing VO EO-based, you can deal with a bug that is mentioned in the link below.
You need to modify the generated XML. So, please check this link.
http://oracleanil.blogspot.com/2010/11/EO-based-vo-extension-in-OAF-R12.html
I hope that helps!
Thank you
AJ -
Tap the Navigation Palette missing in LabVIEW 2009 Panel
Hello
I developed an application using LabVIEW 8.6 with the touch panel module and a TPC-2012 (Windows CE). I've now upgraded to LabVIEW 2009 and I'm trying to run my code in a TPC-2512 (XP Embedded), but the 'Touch Panel Navigation Palette' I used previously to be found in the new facility. In my view, there is a new range of "Navigation controls" in 2009, but I would like to avoid having to re - design my app with new controls.
8.6 navigation controls are no longer supported in LabVIEW 2009 or have I missed something? The TPC is displayed in the Project Explorer and MAX, and I'm able to deploy and run applications on it. But the old vi navigation do not work and as I mentioned before, the palette is not even appear when you try to change the vi on the development computer.
Any help would be appreciated.
Thank you
Hello
The navigation screw touch panel are not displayed to the top, because you are currently using the TPC-2512. If you take a look in the Help file on the Navigation, it states: 'installed with: Touch Panel Module.» This topic can not match its corresponding palette in LabVIEW depending on your operating system, or the licensed products and the target. "I checked this with both LabVIEW 8.6 and LabVIEW 2009 targets. Due to the different architectures, you get a different set of palette (Windows CE vs XP Embedded).
-Zach
-
Unique problem with selction on the table (Query Page)
Unique problem with selction on the table (Query Page)
I have a VO data Bulletin Board, with a transitional attribute for selction unique column.
My requirement is that I need to identify the line that was selected in the table.
I associated with fireAction singleSelection column, such that whenever the user selects the line
I'm looking for that VO using some rowIterator.
But when running the loop of the transient VO that is mapped to the singleSelection variable is the show as "n" / NUll
for all the lines...
So how do you identify the selected line in singleSelection to a table.
-SasiIn the property inspector of the element for which you've put firePartialAction, you can find a property named "parameters". That mention primary key as your setting.
You can get the arameter using pageContext.getparameter (
); -Anand
-
Need help in the design of the structure of the table with the lines of the query
Hello
Need to design a page
ex:
Select empno, emp wage; is my query and returns two columns and four rows
the four rows should be my values in the structure of the table.
EmpNo - salary
---------------------
1 - 1000
-----------------------
2 - 2000
------------------------
3 - 3000
----------------------
4 - 4000
Kind regards
KrishnaHello
One of the ways is to create 2 RowLayouts dynamically like this
Row1-> Cell1--> HeaderRegion--> StaticStyleText (EMPNO attribute)
Row2-> Cell1--> StaticStyleText (EMPNO attribute) Cell2--> StaticStyleText (SALARYattribute)and iterate this code for all the lines of the vo.
Kind regards
Mukesh Uchaniya -
Help with the query to return the results of the group in the table?
Hello
Im a total noob, so please be nice...!
I'm looking around a table contains a column of WORD and a WORD_TYPE_ID column.
Words can have the same type_id.
What I'm trying to do is to write a query that will return the longest word for each word_type_id.
I tried for hours to get it and everything seems to get is two error messages or just the longest word in the whole WORD column.
Is the furthest I can get before things break down...
Select Word
table
where
Length (Word) =
(
Select
Max (length (Word))
table
)
Any help on this or if I could be pointed in the right direction it would be greatly appreciated.
Thank youHello
Welcome to the forum!
Here's one way:
SELECT word_type_id , MIN (word) KEEP (DENSE_RANK LAST ORDDER BY LENGTH (word)) AS longest_word FROM table_x GROUP BY word_type_id;
If there be a tie in some word_type_id (i.e. 2 or more words have exactly the same length, which is the longest in this group) the expression above will return the first one alphabetically. (This is what means here MIN.)
Published by: Frank Kulash, 11 August 2009 13:56
You almost had it.
As you have noticed, you get the longest line across the table. This is because your subquery was watching the entire table.
If you to correlate the subquery to the row in the main table, as shown below, you can get the longest word in each group:select word from table m -- m for main where length (word) = ( select max (length(word)) from table where word_type_id = m.word_type_id -- New );
-
Hello
I want to run the table several queries. I have 4 tables. Table 1 is to have relatively in table 2, but table 3 & 4 is not related with table 1. wherever I want to extract the data from table 1, table 4. My current query works well but it miss the Chronogram of table 1, which records do not exist in table 2, where, from table 2 of table 4 its working fine.
SELECT z.productcode, fabqty z.productionadviceno, sum (z.fabricatedqty).
Fabqtynoms Round (Sum(z.fabricatedqty*.015) + Sum (z.fabricatedqty)),
w.workorderno, ons min (w.ons).
((SOMME (w.qtyinsheets) * min (ons))) PCS,
(SELECT SUM (NVL (mrnqty, 0)))
OF CANMRN
WHERE workorderno = w.workorderno) mrnqty;
(SELECT ROUND (SUM (NVL (ptnqty, 0))))
OF CANPTN
WHERE workorderno = w.workorderno
) ptnqty
OF CANWORKORDER w, productionadvice z
where w.productionadviceno = z.productionadviceno
and w.productcode = 501001
GROUP BY w.workorderno, z.productionadviceno, z.productcode
PRODUCTCODE PRODUCTIONADVICENO FABQTY FABQTYNOMS WORKORDERNO ONS SCP MRNQTY PTNQTY
----------- ------------------ --------- ---------- ----------- --------- --------- --------- ------
501001 20004182 250000 253750 20001805 15 253755 16917 253755
501001 20004229 200000 203000 20001817 15 202995 13533 202995
501001 20004251 130000 131950 20001829 15 131955 8797 131955
501001 20004256 200000 203000 20001839 15 202995 13533 202995
501001 20004277 500000 507500 20001844 15 507495 33833 507495
501001 20004411 500000 507500 20001918 15 507495 31619 474285
501001 20004904 230000 233450 20002150 15 233445
I want to get this record also is missing after you run the query, as I had mentioned w.productionadviceno = z.productionadviceno due to which its does not, how, in a delicate way, we can use this relationship.
501001 20004905 10000 10150
Sandy
use of EXTERNAL JOINS as follows
where w.productionadviceno = z.productionadviceno (+)
above is a left outer join. A LEFT OUTER JOIN is a JOIN operations that allow you to specify a join clause. He keeps the lines without correspondence of the first (left) table, join them with a NULL row in the form of the second table (right).
More details: LEFT OUTER JOIN operation
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
Dynamically read the table name in the query update
Hi all
I am trying to run the updated sql query where the name of the table should be read dynamically from another table below.
Please let me what wrong with my request.
setting a day (select CONCAT('T',schemaid) from outline, which the name = 'Analyzer') set c7 = 99;
"outline" is a table that contains two columns name and schemaid.
all the table created in our database with the prefix 't' T4345 for example.
I did as suggested by you
No, you didn't. I did not any package creation code in my example, in order to better that you you point the finger.
Your syntax is invalid for creating a package with the code like this, please read on creating packages and procedures within them if that's what you want to do.
In addition, your package creation statement is to create a package specification, but you put in the code which must be in a package body, not a notebook loads.
It should be something like (untested since I don't have your tables)...
create or replace package my_packg as
procedure dowhatever.
end;
/create or replace package body my_packg as
dowhatever procedure is
TBL varchar2 (30);
Start
Select 't' | SchemaId
in tbl
of outline
where name = 'Analyzer ';
run immediately 'Update'. "TBL |' set c7 = 99;
end;
end my_packg;
/and then call this procedure by calling my_packg.dowhatever ();
-
Search page based on query with Table on Layershift ADF Panel does not work correctly
Hello
I'm on 11.1.2.4 jdev and deployed my application on glassfish 3.1.2. I've hosted this application on Layershift externally.
I created a search page based on query ADF with table Panel. All fields of research are working fine on weblogic Server integrated and my deployment local glassfish.
However, on Layershift, when I enter some criteria of research in certain fields, it does not record.
UPDATE, it seems that the problem is with the fields which are of the "String" ie. Name. Fields of data type Integer and Date seems fine.
any ideas please?
Thank you
kdario, you're right, ViewCriteria does not use the correct syntax for mysql for the concatenation.
The generated sql statement looks like this.
SELECT * FROM (select student_id, student_name, from student) QRSLT WHERE ( ( (UPPER(student_name) LIKE UPPER('%' || 'Per' || '%') ) ) )
as DB MySql does not support | (double pipe sign), its sql causing failure.
in order to support |, mysql requires to change the sql mode setting in the file my.cnf (on linux) in the
# Set the SQL mode to strict sql-mode="PIPES_AS_CONCAT,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
After setting this parameter, its working fine now.
-
Hello
Is it possible to return to the table pagination, which means, instead of start page 1 with record 1, start at the last page showing the latest results of table?
If so, how can I do it?
I'm dependencies jdev 11 GR 1 material
Thank you
I was told that with paging, data are not noticeable, to remedy that I used scrol and presented to the last line at the end of the table.
Thank you all for your help
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
Web pages don't display at all
Recently, when I open a Web page, it does not appear. I can type in the browser but nothing shows and when I actually type something (example: Google.com), it is said in the bottom taskbar that Google is open but I don't see anything (i.e. all the pa
-
Why can't I open a blank tab?
I can't open a blank tab, click the '+' next to open tabs, a blank tab should open, but for me simply nothing happens, so what do I do to solve this problem?
-
Satellite A100: Can WXP during the installation of Vista - I use Vista drivers
Hello Will really appreciate if a member of the community could help sort my confusion... I had to reinstall Windows with XP SP3 in place and place of Vista the A100 was delivered with. I now need some drivers (Lan, WiFi, Bluetooth, USB) and wanted t
-
Stop an application of loop within an event from the front panel
Hi all I was asked to add a stop button feature to a vi wrote to someone who is no longer with us. They wrote a "loop" feature is to crunch some data and adds it to a file during each iteration of the loop for. They put that inside a structure of the
-
How can I download the drivers from Manufacter ' ' s Website if I have no internet.»
original title: How can I download the drivers from Manufacter ' ' s Website so I havew no internet. ". Computer a wipe trying to download Microsoft XP! Now I can't access the internet. How can I download driver manufactuer website if I have no inter