ALLOW JOB ON INSRERTION OF THE DATA IN THE TABLE
Hi all
I have two seprate databases schemas.
For simplicity say SCHEMA ABC and XYZ of SCHEMA.
In SCHEMA XYZ, I have a table whose data are inserted (TIMING NOT FIXED).
This table is accessible via DBLINK in SCHEMA ABC and is then processed.
Currently work is designed to operate at 7,8,9 in the morning to process these data.
However, it is possible for data to come after 9 in which the process must be manually executed.
I want to change this and do the work to be performed on when the data are inserted into the table and not in due time.
Please advice in this regard.
Any suggestion would be appreciated.
Thanks in advance.
What happened AFTER statement level INSERT trigger?
Tags: Database
Similar Questions
-
My cursor locks the table inserts
I have a function that copies of the new lines of Database_A, Table_A to Database_B, Table_A via a database link. This happens on a regular basis and there may be around 100 k new records accumulated between these periods.
I understand the folders that need to be copied by filtering a field "copied" on the table. In the loop, I update field copied from the line so it will not be copied during the next pass. Here's the function:
My problem is that it is stuck on the table, while this process takes place. I'd wait a few blocking at the level of the lines, which is fine (this painting is especially INSERT only). But I do not know why it blocks such that she allow me to INSERT into the table. -This can someone explain that to me?FUNCTION copy_records RETURN INTEGER IS pCount INTEGER := 0; CURSOR recs IS SELECT * FROM TABLE_A WHERE FLG_COPIED = 'N' OR FLG_COPIED IS NULL ORDER BY MYKEY; -- do the oldest first (only important if we commit during iterations) BEGIN pCount := 0; FOR rec IN recs LOOP -- first copy to backup db INSERT INTO TABLE_A@BACKUP_DB (FIELD_1, FIELD_2, FIELD_3) VALUES (rec.FIELD_1, rec.FIELD_2, rec.FIELD_3); -- now flag as copied UPDATE TABLE_A SET FLG_COPIED = 'Y' WHERE MYKEY = rec.MYKEY; -- counter sent back for logging pCount := pCount + 1; END LOOP; RETURN pCount; EXCEPTION WHEN OTHERS THEN RETURN SQLCODE; END; END;
If I do a VALIDATION during each iteration, I can at least perform an insert, but this seems to slow things down significantly when used through a DBLink, so I'd avoid it (more I want to run a transaction all or nothing). I'm not as sure as if the effect of the VALIDATION must achieve the online-only block, or simply reduce the window of the table locking.
Published by: xaeryan on October 14, 2011 15:51xaeryan wrote:
mtefft wrote:
1. it is a bad programming practice to perform updates (or inserts, etc.) in a function. You must use a procedure.More tests to make sure that, but it appears after a PROCEDURE and nothing more, changed my blocking condition no longer exists...
This would make sense?
That makes no sense to me. There is no fundamental difference between a procedure and a function with regard to the processing of SQL statements mode. My guess is that your problem is:
There is also a BITMAP index on the field FLG_COPIED
Bitmap index and updated several unique, as you do not play well together. A single block in a bitmap index can cover a very large number of rows in the table. In addition, the index bitmap, in contrast to the B-tree index, index null values. Every time you update a row in tablea, Oracle must briefly lock two index blocks. One on the value null/N in line and the other covering the value Y of the line. This would tend to block other transactions that want to access all the lines to cover (or potentially covered) of the index blocks.
John
-
Is there a tip action that will open and close the table of contents?
I like that in CP5, Adobe has allowed users to change the icon associated with opening and closing of a Table of contents in layers. Having said that, unfortunately, they show if small, I don't see what I created. So, I was wondering, is there an advanced action or an action script that I could assign to a button that will allow my users open/close the table of contents?
Thoughts?
Eric
I created a quick and dirty AS3 widget that can be used in Captivate 4 and Captivate 5 projects to open / close a table of contents in overlay with your own button mode.
Have fun; (o)
/ Michael
-
In the table of contents text wrapping
Hey everybody-
I just bought RoboHelp version 6 last week and is developing a WebHelp project. I remember when I was using a very old version of loooong ago someone had posted a workaround solution that allowed me to say to the table of contents to wrap long names entry, rather than being partially hidden. I hope that over the last ten years, which would be something fixed in a new version, but it isn't - unless I'm missing something.
I saw the link on this forum at the forefront on the enlargement of the TOC pane, but I would rather not do that.
Someone know how I can get the text to be sent back?
Thanks a lot for your help!Will do. Thank you very much!
I found the Archives announcement about. The answer is that there is currently no way to wrap TOC entries. Just in case someone else I was wondering on this subject...
-
Protect a document while allowing the insertion of data in a table and the points on a graph.
I created a Word document that contains a table and a chart. Can I protect document but allow data entry in the table and allow points appear in the table using Adobe?
Hi brianh89327665,
While you can apply a permissions password to a PDF file to prevent things such as printing and editing the document, you can not apply it selectively to parts of the PDF file.
Best,
Sara
-
I was wondering if there is a lien that would allow someone to be able to view a table exists, its column names, but hide the contents of the actual data in the table?
I know he has a right to SELECT which, if not given it seems just totally hide the table
Thanks in advanceI was wondering if there is a lien that would allow someone to be able to view a table exists, its column names, but hide the contents of the actual data in the table?
The solutions are:
-grant SELECT on DBA_TAB_COLUMNS;
-a custom view SYS. CUSTOM_TAB_COLUMNS selects from DBA_TAB_COLUMNS, which is filtered for specific schemas/tables.
-Fine grain access
-Security labelPublished by: user11181920 on October 23, 2012 11:15
-
I use developer preview windows in my acer aspire one netbook... a job well done, but the winstore apps don't work... and I do not see my bios settings also... helpme
Windows Developer Preview: OS General Questions:
http://social.msdn.Microsoft.com/forums/en-us/windowsdeveloperpreviewgeneral/threads
The Developer Preview of Windows is a pre-beta version of Windows 8 for developers. These downloads include beta software that may change without notice. The software is provided as is, and bear you the risk of using it. It may not be stable, work properly or work the way that the final version of the software will be. It should not be used in a production environment.
Netbook screen
If you have a netbook with a screen 1024 x 600 Metro applications will not work. 1024 x 768 is the minimum for Metro applications.
Several people have reported that Metro apps can be run if you connect an external display that is 1024 x 768 or more.
You can try this modification to allow higher resolutions:
http://www.netbooklive.com/how-to-get-better-resolution-on-your-standard-10-inch-NetBook-2772/
BIOS - disable hybrid startup:
http://www.sizzledcore.com/2011/04/21/enable-disable-hybrid-boot-in-Windows-8-for-faster-startup-time/ -
I use Windows XP Home Edition and I am fully up to date with the latest version of the software.
I would like to activate my mouse USB power out "sleep mode" on my computer. I found the help topic that describes how to do this: http://support.microsoft.com/kb/280108 how to enable the continuation of the Standby Option for a USB mouse
However, when I follow these steps, I don't see the 'allow this device to wake the system from standby mode ' check box on any of the windows as described in the documentation for Ms.
I use a Microsoft Comfort Optical Mouse 3000 (IntelliPoint) USBAny help would be greatly appreciated!
This gives a test:
1. click on START
2. click on 'run '.
3 type "notepad" (without the quotes) and press enter
4. copy and paste this into Notepad:Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usb]
"USBBIOSHACKS" = DWORD: 00000000
"USBBIOSx" = DWORD: 000000005. click on file > save as
6. change the dropdown to "all files".
7 type usb.reg as the file name and save the file somewhere easy to access
8 go find the file and double click it. Confirm that you want to add it to the registry
9 restart the computer and see if you can wake the system from standby modeFor reference, take a look at this:
http://www.dslreports.com/Forum/r19635912-missing-power-management-tabLet us know,
Thank you!
Ryan Thieman
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think. -
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'.
-
I have to check if no job has run during the last five minutes.
I have to check if no job has run during the last five minutes.
I need to store five minutes in a table separate from five minutes can be changed to 10 minutes in the future.I will be pulling out of this table in the following query.
SELECT CASE WHEN COUNT (ROW_WID) = 0 THEN 'NO JOBS RAN AFTER THE SPECIFIED TIME"END
FROM W_ETL_RUN_SDTL WHERE START_TS > (SELECT sysdate - (SELECT * FROM XXAFL_MINUTES) the double);
Start_TS - date and time of beginning of the tasks/jobs
XXAFL_MINUTES - table, which keeps the number of minutes
Can you please help me to create the query. I'm not able to store five minutes in the table. What format should be the column?
The query above returns null, even if a job ran.
If you want to store an interval may be the interval data type would be a reasonable choice. Maybe something like:
create table check_intervals)
my_interval days apart on the second
);
insert into check_intervals (my_interval) values ('5' minutes of interval);
Select count (*)
of dba_scheduler_jobs
where start_date > (select sysdate - my_interval)
of check_intervals);
-
Of the data in the table to get a tree using declarative and perform operations above.
Hello
I use Jdeveloper 11.1.2.4.
I'm creating a declarative component. The component is supposed to display the data in a table and allow the user to remove entries of it.
The table should be included in a pop-.
From now on, I made a picture of the tree within a collection of panels. I'm creating a tree in the pagedefinition of the ViewController project file and passing the tree of the same model to the component attribute declarative. After binds the attribute passed to table component tree declarative, I am able to fill lines. First please let me know if my approach is correct or not. The user can select any row of the table and press delete. The button must remove the entry from the table. Is it possible to remove operation on the table in the declarative component.
Thank you
First of all, please let me know if my approach is correct or not.
Seems ok
The user can select any row of the table and press delete. The button must remove the entry from the table. Is it possible to remove operation on the table in the declarative component.
You have several ways to do this:
(a) similar to the declarative component attribute, you can bind methods, for example: ADF Essentials eCourse - declarative components ADF: work with methods
(b) pass the name of the iterator to your component and then use it to remove programmatic in backing bean
(c) create pageDef declarative component for, something similar to this: ADF practice: liaison for component container declarative
Dario
-
Using the procedure to display the table of multiple data
Hi, I need help for the procedure in oracle
I want to create the procedure to display the table of multiples with sample plan
with a parameter imployee_id to display an employee_id, name, function, start_date, end_date
IAM using this query to select more than one table
SELECT e.employee_id, e.first_name, j.job_title, h.start_date, h.end_date
E EMPLOYEES
JOIN j jobs
ON j.job_id = e.job_id
JOIN the job_history:
ON h.employee_id = e.employee_id
WHERE e.employee_id = 200;
Thanks for the help
Blu and Billy showed you the 'real' solution. You can display the data returned by a cursor ref in SQL Developer, too:
http://www.thatjeffsmith.com/archive/2011/12/SQL-Developer-tip-viewing-refcursor-output/
Yet as a duty for a beginner is generally do not have the expected solution. Usually, teachers want to see you using a LOOP and dbms_output. something like
DECLARE
Xy CURSOR IS
SELECT whatever
As much as;
BEGIN
FOR r IN xy LOOP
dbms_output.put_line (r.col1 |' # ' | r.col2);
END LOOP;
END;
Of course this suggestion will inaugurate a discussion abusing DBMS output but I keep my position that it is authorized to use it for learning the basics.
-
Create the form for selecting data in multiple tables
Hello
I'm getting APEX for the first time and I just read 2 days dev Application Express guide
I tried to play and I can't create a report with the form that select data from several tables
What I want to achieve is a report we'll say 'USERS' makes MANAGER_ID ID, NAME, with a form that allows me to create, delete, change users
The problem is that, once the report with the form created, if I click on create (to create a user) it will ask me for id, name, and manager_id
I need a water drop down which allows me to select managers in the table manager instead of manually insert Director id
How do I do that?
Thank you!
HI Chris,
LOV will use this magic.
Search:
Kind regards
BEnjamin
-
UGH! After the update to windows 10 lightroom does not allow me to work in the module development for more photo or two, and then it crashes! I tried to uncheck the graphic processor after finding the instructions on a forum, but it does not - this action also locked llightroom! What I can do - I have several photo jobs who need treatment-HELP! Arthur
Hi arthurc70992816,
Suggest you follow the instructions in this article:
Try updating your graphics card drivers.
Kind regards
Claes
-
opps, I put everything in the title line... no match came...
This app allows to be consulted at the opening of the filled pdf files?
At this point, the iphone opens the pdf file, but the information that the sender had typed in are not visible. If we opt for a pc, the info typed in is here. We believe that we need a viewer that will recognize the data inserted / under the direction of the sender. Made for mobile DC cela?
Hello
Yes, the Adobe Acrobat Reader for iOS on iPad/iPhone to view PDF Forms.
The problem is that the preview PDF Apple does not make data from completed forms and annotations (Sticky Notes, point climax, drawing freehand, etc.).
When you open a PDF document in an application (Mail, Safari, iBooks) Apple iOS, please make sure you use the feature of "open in" iOS to open it in Acrobat Reader for iOS.
Please take a look at the following documents of the FAQ.
- For iPad, see How to open PDF documents in Adobe Acrobat DC for iOS (iPad version)
- For iPhone, see How to open PDF documents in Adobe Acrobat DC for iOS (iPhone version)
Please let us know if you have any additional questions.
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
-
I can't change the google search engine, Yahoo
I have read and tried several suggestions on how to change my google search engine and it will not change to google. I deleted everything that yahoo from my computer, I did the troubleshooting suggestions, I have used malawarebytes and essentials of
-
HP ENVY 1090ee 6 - left hinge broken
I bought HP, Acer, Lenovo and Asus because I thought that the only thing that HP offers each time, is of exquisite build quality. However, today, I was met with a surprise. The left hinge (one near the power button) has apparently unravel, as if on i
-
Error Code BIOHD-2 disk hard don't Test no drive detected
I'm working on a HP Pavilion p6214y desktop PC. Just to list the specifications for any unusual problems: OS = Windows 7 Home Premium 64-bit MB = HP P/n: 513430-002 with AMD Athlon II x 4 620 Quad Core HD = Western Digital 1 TB Power = 350W LiteOn RA
-
Samsung gt-15800 het expensive
IK wil music dwonloaden naar mijn mobiel maar geeft aan dat tmp usb niet kan installeren van laptop naar mijn mobiel via Media Player