Creating a collection of a query at the Apex 4.2 is not complete the data in the collection.
I have a process that creates a collection with data from several tables. The query returns multiple lines in the tab "Sql commands". The same query is used to create the collection 'Head before' and when I create a region with the source of the region as
Select * from apex_collections where collection_name = "load_dashboard";
At the time of the rendering of the page, shows me "no data found".
What could be the problem? Are there requirements before creating the collection?
Thanks in advance,
Sriram
Name of the collection must be uppercase. That's your problem.
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Apress.com/9781430235125
https://Apex.Oracle.com/pls/Apex/f?p=31517:1
http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
-------------------------------------------------------------------
Tags: Database
Similar Questions
-
How to create a collection of apex to store and to loop through the values
I couldn't find a simple example to do
Apex 4.2
I need to create a collection of the apex. I have a query that returns multiple roles for a user. I need to check to see if one of my values of point is within the collection, but I'm not sure how. So far, I have:
Start
APEX_COLLECTION. () CREATE_COLLECTION
p_collection_name = > 'ALL_ROLES');
Select count (granted_role) in the County of dba_role_privs where upper (grantee) = upper(:APP_USER);
end;
How would store the query results in the collection?Even shorter
declare v_count number; begin if :P32_SUBMISSION_DATE is null then return false; end if; select count(*) into v_count from dba_role_privs where upper(grantee) = upper(:APP_USER) and granted_role in ('SURVEY_SUID','SURVEY_JOB_SUID'); -- return v_count > 0; end;
Note that with a combined function as count you will never get an exception no_data_found
-
Create smart collections by using the import Smart Collection settings
Anyone know if I can create smart collections by using Import Smart collection settings? Where can I find any information on this other than collections of photos? In particular, I am interested in what to do with the code.
I think I got it. If you put the text below into a file extension .lrsmcol and call 01_Jan. You can do a right click any where on the Collection Panel, choose Import Smart Collection settings and it will create a collection called 201401 - Jan will all images published here this month. It is a simplified version of a smart collection for a workflow. If you have 12 files, one for each month, you can select in the dialog box, and it will create 12 collections.
s = {
ID = ""
internalName = "201401 - Jan."
title = "201401 - Jan."
Type = "LibrarySmartCollection"
value = {}
{
criteria = "touchTime."
operation = "en"
value = "2014-01-01,.
value2 = "2014-01-31."
},
combine = "cross"
},
version = 0,
}
A minor warning, Text Edit on my Mac replaced the quotes with double quotes. LR would fail to import missing files of the quotes or double quotes (I guess malformed) with like this without raising any errors. I had to disable the quotes in Text Edit.
-
How can I create a query with the data control to the web service?
I need to create a query with the order of web service data, WSDL, it is query operation, there is a message of parameter with possible query criteria and a return message contains the results. I googled but can't find anything on the query with the web service. I can't find a criterion "named" to the data control of web service as normal data control. Blog of Shay, I saw the topics on the update with the data of web service command. How can I create a query with the data control to the web service? Thank you.Hello
This might help
* 054. Search form using control data WS ADF and complex of entry types *.
http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html
-
'CREATE JAVA' error: ORA-29506: derived from the USING clause invalid query
Hello
I created a table with the following attributes:
name varchar2 (200);
LOB_DATA blob
I loaded a java source file in the lob_data blob.
I then called the SQL:
create or replace and compile the java source named "RemoteCommand" using blob
Select lob_data from str_blob_table where name = 'RemoteCommand.java ';
and I get the error:
ORA-29506: invalid query from the USING clause
ORA-00936: lack of expression
29506 00000 - "query invalid derived from USING clause.
* Cause: The USING clause does not form a valid query.
* Action: Correct the USING clause.
If I simply copy and paste the query part of the USING clause:
Select lob_data from str_blob_table where name = 'RemoteCommand.java ';
I get a valid result in SQLDeveloper.
Any thoughts on what is happening here?
A few notes:
1. it is a 8i database.
2. it works very well on a 9i database, but according to the SQL reference for 8i, it should work as well.
Thank you
BrentTry to delete "select" in the USING clause, that is to say change the SELECT BLOB SUPPORT... for BLOB to HELP... The original form of the syntax of JAVA to CREATE did not expect the SELECT token must be explicitly provided. Somewhere between 8i and 9i the parser was changed to try the provided text as well as what, with SELECT prefixed. So a CREATE JAVA statement you tried working in 9i but in 8i fails because SELECT would always be added before you try using the clause as a query, resulting a SELECT duplicate token.
-
Dynamic problem with lookup-query for the purpose of resource request
Hi all
I need to set up several IOM user exchange mailboxes, I can set up AD account and account of the mailbox without any problem, but only for the first ad and Exchange account. For the second and third, etc. I get the error: "Invalid login name" during Exchange of account provisioning. I discovered that this problem exists with Exchange Connector - it is not able to collect correct GUID. So in my xml Dataset I use dynamic query Lookup to select manually correct Alias, the login name and GUID. The query for the GUID is the sequel (I cloned RO for AD and Exchnage):
AttributeReference available-in-bulk = "true" length = "32" widget = 'search query' type = 'String' attr-ref = "Object GUID" name = "Object GUID" >
* < lookupQuery search-query = "select distinct UD_KFUSER_OBJECTGUID GUID, ud_KFUSER_uid like UD_KFUSER UD_KFUSER, orc orc Login, sta sta where UD_KFUSER.orc_key = orc.orc_key and orc.usr_key = ' $Form data." Take ' and UD_KFUSER. "UD_KFUSER_AD = 27 and orc.orc_status = STA.sta_status AND STA.sta_bucket! = 'Cancelled'" display-field = "GUID" save-field = "Object GUID" / > *.
* < / AttributeReference > *.
My questions are:
1. I have to type * to run the query in the user interface, without * I got error:
+ < 17 February 2012 11:12:22 THIS > < error > < oracle.adfinternal.view.faces.config.ric +.
h.RegistrationConfigurator > < BEA-000000 > < ADF_FACES - 60096:Server Exception durin
PPR, #10 g
oracle.iam.platform.canonic.base.NoteException: an error occurred during executin
g the search query.
to oracle.iam.platform.canonic.agentry.GenericEntityLookupActor.perform)
GenericEntityLookupActor.java:337)
Is this right?
2. when I got correct values (from the search query) - they are missing on the details of the application and form of RO - what Miss me?
I use OIM 11.1.1.5, in my xml dataset I use correct attr-Ref (labels), when I type the values manually, they are propagated to form RO and Exchange mailbox is created.
Best
MPI not had no problem when writing search query.
This works very well for me.
The request will be filled for the field, so why choose *?
I used as
-
passing multiple values from the query in the select statement of the procedure
I am collecting IDS to select education agreement from the date of rental values and then I would pass the result of the query in the statement select to get the result.
data type for the contract id is of type varchar and date of rental there is more than one id to contract for most of the time. Help, please. Thank you
CREATE OR REPLACE PROCEDURE abstract_menu (p_letting IN VARCHAR2, p_results OUT SYS_REFCURSOR) IS v_contractId VARCHAR2 (40); SELECT lcontid INTO v_contractId FROM letprop WHERE datestat IS NOT NULL AND letting = p_letting AND letstat <> 'R'; BEGIN OPEN p_results FOR SELECT DISTINCT SUBSTR (l.letting, 3, 2) || '-' || SUBSTR (l.letting, 5, 2) || '-' || SUBSTR (l.letting, 1, 2) lettingdate, l.lcontid contractid, SUBSTR (q.cprojnum, 1, 10) projectnumber, DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route))) routenumber, L.DATESTAT statusdate, L.LETSTAT lettingstatus, (q.cdescr) jobdescription, INITCAP (q.clocat1 || q.clocat2) LOCATION FROM vendor v, vendaddr r, letprop l, planhold p, proposal q, project j, propproj k, bidlet bd WHERE v.vendor = r.vendor AND k.contid = q.contid AND k.pcn = j.pcn AND l.lcontid = k.contid AND p.vendor = v.vendor AND l.letting = p.letting AND l.lcontid IN v_contactid "**************This is where I would like to pass the contract id from the above select statement***********'" AND l.CALL = p.CALL AND r.addrnum = p.billto AND bd.letting = l.letting GROUP BY q.cdescr, q.clocat1, q.clocat2, bd.letting, l.letting, l.lcontid, q.cprojnum, L.LETSTAT, L.DATESTAT ORDER BY lettingdate; end;
user9196150 wrote:
AND l.lcontid IN v_contactid ' * this is where I would like to pass the id of the select statement above contract * ""»CREATE OR REPLACE PROCEDURE abstract_menu (p_letting IN VARCHAR2, p_results OUT SYS_REFCURSOR) IS BEGIN OPEN p_results FOR SELECT DISTINCT SUBSTR (l.letting, 3, 2) || '-' || SUBSTR (l.letting, 5, 2) || '-' || SUBSTR (l.letting, 1, 2) lettingdate, l.lcontid contractid, SUBSTR (q.cprojnum, 1, 10) projectnumber, DECODE (TRIM (MIN (j.route)), NULL, 'N/A', TRIM (MIN (j.route))) routenumber, L.DATESTAT statusdate, L.LETSTAT lettingstatus, (q.cdescr) jobdescription, INITCAP (q.clocat1 || q.clocat2) LOCATION FROM vendor v, vendaddr r, letprop l, planhold p, proposal q, project j, propproj k, bidlet bd WHERE v.vendor = r.vendor AND k.contid = q.contid AND k.pcn = j.pcn AND l.lcontid = k.contid AND p.vendor = v.vendor AND l.letting = p.letting AND l.lcontid IN ( SELECT ll.lcontid FROM letprop ll WHERE ll.datestat IS NOT NULL AND ll.letting = p_letting AND ll.letstat 'R' ) AND l.CALL = p.CALL AND r.addrnum = p.billto AND bd.letting = l.letting GROUP BY q.cdescr, q.clocat1, q.clocat2, bd.letting, l.letting, l.lcontid, q.cprojnum, L.LETSTAT, L.DATESTAT ORDER BY lettingdate; end; /
SY.
-
2012R2 creating a Collection server and adding RDSH completed with errors
I'm working on the construction of a farm of RDS 2012R2 to be used by thin clients to my installation. I have a farm complete 2008R2 already working and I'm looking to upgrade. Currently, I have 2-2012R2 servers rose with RDS services installed. I assigned Server 1 as the agent of connection and the Desktop Web access server remotely. Server 2 is configured as host of the session. The installation of all the roles of RDS was successful. I configured the gateway desktop remotely, RD, RD Web Access licenses and certificates on my RD connection Broker.
Initially, I tried to create a collection while the two servers were in my terminal server OR. After many attempts to try to create a session and a lot of research, I found that the GPO settings for RDS servers should be irreversible in order to create a collection with a host of the session. I moved the two servers to a political ORGANIZATION unit block I put in place. I ran a gpupdate/force and restarted both servers. In addition to this, I waited a few hours to ensure that policies no longer apply. I tried to create a collection again and received the same error when it was adding the session host server"SERVER 2 failed to configure the Server Desktop Session host Server 2 remotely. Invalid operation. "I ran a gpupdate/force a few times and tried to create a collection of more than a few times without success. Finally, I deleted all the two servers RDS servers and then reinstalled again. After having everything set up (bridge, Broker for connections, licenses, certificates etc), I try to create a collection again and am greeted with the same error.
I know that the GPO settings have been deleted because I no longer see the banner of society that is displayed when you log on the server. There are 0 policies applied to this ORGANIZATION and the legacy unit is blocked. I'm not really sure of who apply now. I hope that someone else has experienced this problem and can help you. Thank you
J
Hello
Your question is beyond the scope of what is generally answered in this forum of consumer and would be better suited for the IT Pro TechNet public.
Please post your question in the TechNet Forums.
https://social.technet.Microsoft.com/forums/Windows/en-us/home?Forum=w8itpronetworking
TechNet is watched by other computing professionals who would be more likely to help you.
Thank you
-
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'.
-
Hallo,
Sometimes, in the code for my application, I need to run smaller queries to retrieve data from the database.
I wonder if for these queries, it is necessary to define a View object or if I can avoid this for example creation and execution of a VO on the fly.
In this case I would not define a VO, given that queries will be never used to display data, but only for the internal logic.
A use case, I want to solve it next.
I would like to create a function to be used after validation for last inserted record by a user in a TableVO.
For example
Select the Id of the Table where UserId =? and Type =?
The query should be run in a managed bean...
public String okButton_action() {} OperationBinding operationBinding is BindingsUtils.getBindings () .getOperationBinding ("Commit");.
Object result = operationBinding.execute ();
If (! operationBinding.getErrors () .isEmpty ()) {}
Error handling
return;
}
Here, I need to:
1. run the query to get the Id of the last inserted record
2 call the setCurrentRowWithKey on the TableVO to update the display
and get the Id (identity/auto-increment) than the database
assigned to the field
return "return";
}
If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?
I need to get the Id of the last line inserted since the ADF is not able to manage MS SQL Server identity fields (it seems that REFRESH AFTER INSERT cannot be used with non - Oracle DB).
Any notice will be welocome.
Thank you
Federico
The query should be run in a managed bean...
Much better to execute the query in the template project.
Example query: http://amit-adf-work.blogspot.com/2013/09/how-to-execute-sql-using-adf-application.html
If I can create a function that creates / runs the VO on the fly and return the value ID... It is best to create it in a class of public services or in the implementation class TableVO?
If you have the function that accepts the SQL as a parameter, then this should go to class util.
Dario
-
Hallo,
I would like to know how to avoid that an af:table created from a VO istance automatically fill the area itself.
I need to fill programmatically after you click on the search button.
Then I would turn off, and the button 'open file' if the af: table is empty or if af:table contains documents... enable how can achieve this?
Thank you
Federico
I would like to know how to avoid that an af:table created from a VO istance automatically fill the area itself.
I need to fill programmatically after you click on the search button.
Use VO.executeEmptyRowSet () Andrejus Baranovskis Blog: Oracle ADF Tuning: prevention of the execution of the SQL query on the loading of the Page
Then I would turn off, and the button 'open file' if the af: table is empty or if af:table contains documents... enable how can achieve this?
Bind "disabled" property #{bindings.yourIterator.estimatedRowCount == 0}
Dario
-
Vs. runtime vs. ViewObject ViewObject SQL query in the xml file.
Hello
I wonder what is the difference between query SQL in the long term, creating a view object in the duration and the creation of a display with an XML object.
I'm not trying to have the result set cached just to pick once.
My code for a creation of a view in a run-time object:
HashSet<Integer> allPersonIdThatUserHasAccessTo = new HashSet<Integer>(); AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl"); String sqlStr = "SELECT up.person_id FROM user_person up where up.user_id = " + userId; ViewObjectImpl vo = (ViewObjectImpl)am.createViewObjectFromQueryStmt("AllPeopleUserHasAccessToVo", sqlStr); vo.executeQuery(); RowSetIterator rsi = vo.createRowSetIterator(null); while (rsi.hasNext()) { Row personRow = rsi.next(); Integer personId = ((BigDecimal)personRow.getAttribute(0)).intValue(); allPersonIdThatUserHasAccessTo.add(personId); } rsi.closeRowSetIterator(); vo.remove();
When should I use SQL query, when the view object use at time of execution and time to create the view object to an xml file?
In general you should not write this code in a managed bean. Access code or in your case creating a VO belongs behind the façade in the module of the application.
You can create the original Version, but the main difference is that it takes more time. Code everything that the definition of VO created in the data model of the application module would make too and it clears directly after the query only to create the same code again the next time you call the method.
If the goal is not to keep the data, you can create the hashset class and call executeEmptyRowSet() on the VO (https://blogs.oracle.com/smuenchadf/entry/what_does_executeemptyrowset_d for details). This way you only need a VO that takes a parameter and gets you the same result in less time.
Timo
-
LR5 using on a desktop and laptop computer and creating a Collection
I use Lightroom 5 on a desktop and a laptop. I have my Lightroom Catalog and all my photos on an external hard drive. I had no trouble seeing all my folders on both computers. Recently, I created a Collection on my desk. The next day, when I connected the external hard drive to my laptop, the collection wasn't there, nor was the changes I had made in this collection. I took the hard drive on my desktop, and the Collection will appear on the desktop. Catalog entire Lightroom, including all folders AND all Collections should be not the same on both computers? What could I have done wrong?
Create a folder on your external drive and copy the catalog to the desktop machine that you want to see on your laptop, so, once done unplug the external driver of the office and connect it to the laptop.
Go to the created folder and open the catalogue which he copied from the office.
Now, whenever you want to work on Lightroom either on your desktop or laptop you must have this hard drive connected to this computer, then you can open the same catalog is on your machine.
Thank you
Mohit
-
CANNOT CREATE A REPORT WITH A QUERY PAGE
Hello everyone,
I have this query with a self-join:
\
Select flight_id, f.pilot_id, last_name, f.pla_id, pla_desc, city_dep, d.city_name, city_arr, a.city_name, dep_time, arr_time
pilots of flight f, p, pl, city, city of the plane a
where f.pilot_id = p.pilot_id
and f.pla_id = pl.pla_id
and city_dep = d.city_id
and city_arr = a.city_id
order of flight_id;
\
I've created a classic report based on a table, first of all, then I'm trying to modify the SQL query to the above and I get this error:
Error in saving of the column's settings.
ORA-20001: your query contains alias duplicate names, the queries used for reports require unique alias names.
What I am doing wrong? How can I build a rapport with a form based on a request like this?
Thank you!
The column Francisco appears twice - you'll need to use aliases for columns, for example:
d.city_name as dep_name
a.city_name as arr_name
-
Helps the query in the effects control.
Hello everyone, I hope that someone can help you.
I have a little trouble trying to move images around the screen in my sequence to create an animation of a cursor moving to another location. The problem is when I put a marker in the query in the effect control to it's own journey sometimes going upward or down or left or right. I see that there are lines that are the focus of the image, as well as those of the tool pen in Photoshop and I think that that is what is causing the image of the cursor moving on its own. The two same lines by an image to make a smooth arch of movement these lines of travel to smooth the movement rather than a simple at the following location.
I was wandering because this is the case whenever I put a new marker in the motion effects controls if there is something that is originally what I can disable. I can move these lines from the central point, but that does not make the smoother actions in my sequence.
Any help is really appreciated.
You set keyframes on linear:
Adobe Premiere Pro help. Control to make changes using keyframe interpolation
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
-
My MacBook Pro El Capitan has boxes on screen-"com.apple.iCloudHelper.xpc", "cloudd", "MessagesAgent", "accountsd" with the ball spinning and I can't use my computer as these boxes want a 'keyring', and I don't recognize any of this. Help, please. Th
-
notifications not working not not for messages and emails etc.
I have phone 6 + notifications for SMS, email, etc. only vibrate does not provide noise went on all settings from another phone work anyway.
-
Hovering over FF bookmark shows incorrect link (bunk)
The mouse hovering on bookmark link in the sidebar (20.0.1 FF) presents information about bookmark 1 above
-
My Windows Update has stopped working.
The two Microsoft FixIt & Microsoft Baseline Security gives me errors trying to fix it myself. What should I do?
-
I HAD UPDATED MY WINDOWS SP2 TO SP3 HOME EDITION AFTER A FEW WEEKS OF WORK I GTO MESSAGE AT STARTUP AS NTOSKRNL. EXE IS CORRUPT OR MISSSING ON THE USE OF THE REAL CD BUT NOW I FIXED THE WINDOW STARTS BUT NO NEWSPAPER ON AUTOCHECK DISABLED SCREEN AND