Query for registered agents
Is there a way to query for all Scheduler agents registered in the database, such as a table of metadata?For the moment (11.1.0.7) you do not see that the agents are registered. Cn find you that agents have been used recently by checking the schedulerrun_details view.
Ronald.
http://ronr.blogspot.com
Published by: Ronald Rood on July 23, 2009 10:13
Tags: Database
Similar Questions
-
Name of the table to query for the time window of work
I am trying to build a query for a list of jobs in tide. Anyone know what table is for the time window? Please notify. Thank you.
Hi Warren, according to me, this is the jobdtl table.
jobdtl_fromtm and jobdtl_untiltm
-
An error occurred when querying for the pending operations
Original title: sysprep problem
I have an acer aspire 5738Z, I use windows 7 (64 bit) I try to open sysprep.exe and it does not open, a text box appears saying "an error occurred when querying for the pending operations. What can I do to fix this?Hello
Thanks for posting the request in the Microsoft community forums.
I understand that you receive the error "an error has occurred when querying for outstanding operations" when trying to open sysprep.exe on the computer.You can try the solutions provide and check if it helps solve the issue.
Method 1:
You can scan System File Checker to fix corrupted files.
How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7
http://support.Microsoft.com/kb/929833Method 2:
If the steps above fail then you can try the steps and check.a. run regedit by typing regedit in start search by pressing ENTER.
b navigate to the following key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
Key: RegistrySizeLimit
Type: REG_DWORD
Value: 0xffffff (4294967295)
c. reset.If you need help with Windows, keep us informed. We will be happy to help you.
-
FRM - 40603:Records is no longer reserved for the update. Query for changes
Hi I have a form that has been developing 6i and upgraded to 11g form work well in 6i, but when I try to do the same function in 11g get this error
FRM - 40603:Records is no longer reserved for the update. Query for changes
When I commit this execute_query (for_update); It is the form to clear values when it loads, the error comes when I try to deleteHow can I do this
Action: If you want to change the block, you will need to re - interview.
I use When-Timer-Expired (WTE) trigger
You have a 'relationship' defined between the blocks of your master and detail? If so, simply update your master block and the block of details will automatically be re-interviewed. If you cannot use a relationship, then you can use can create a timer in the trigger that updates the database, then in the trigger When-Timer-Expired (WTE) you can go to the retail block and run a query. For example: / * the sample on change trigger * /.
DECLARE timer_id TIMER; BEGIN ....your code here that performs the update.... /* Now create an instance of a timer */ timer_id := Create_Timer ('upd_detail',1,NO_REPEAT); END;/* Sample Form Level When-Timer-Expired trigger */ DECLARE timer_id TIMER; BEGIN -- Find the timer first timer_id := FIND_TIMER('upd_detail'); IF NOT ID_NULL(timer_id) THEN GO_BLOCK('DETAIL_BLOCK'); Execute_Query; END IF; END;
-
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'.
-
A design of query for the conversion of time difference in days, hours, Minutes
Hi all
A design of query for the conversion of time difference of time in number of days remaining remaining hours minutes and rest in seconds. Made this one till now. Please suggest for all modifications, until now, it seems to work very well, kindly highlight for any anomaly.
WITH DATA (startDAte, EndDate, Datediff) AS (SELECT to_date ('2015-10-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual)
UNION ALL SELECT to_date ('2015-10-01 10:00:39 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:40 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 10:30:45 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 11:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 10:30','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 11:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 09:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 09:00','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 10:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual
UNION ALL SELECT to_date ('2015-11-01 08:30:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 09:30:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 08:30','yyyy-dd-mm hh24:mi:ss')-to_date('2015-11-01 09:30','yyyy-dd-mm hh24:mi:ss') FROM dual
)
Select
trunc ((EndDate-StartDate)) days.
trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24) hours)
trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60) Minutes,))
(to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60 - trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60)) * 60 seconds))))
data;
Thanks for the answers in advance.
AHA!
TO_TIMESTAMP expects a string as input, so it first makes an implicit conversion from DATE to a string, in the format of NSL_DATE_FORMAT.
To convert the TIMESTAMP DATE independently NLS_DATE_FORMAT, use
CAST (
AS TIMESTAMP) -
SQL query for employees, based on a hierarchy of Org
Hi all
I need a query for employee information based on the hierarchy of the Org.
I tried using previous queries in this forum and on the internet, but not closer to.
Here's the requirement:
Level1 Level 2 Level 3 Org Id 81 102 103 104 111 (parent 104) 112 (parent 104) 105 My requirement is to group employees based on level 2, which should include level 3 employees in the respective level2 parent id.
Please suggest.
Query to get hierarchy: SELECT LPAD(' ',10*(LEVEL-1)) || org.name hierarchy,ose.organization_id_parent, org.organization_id FROM hr_all_organization_units org, per_org_structure_elements ose WHERE 1=1 AND org.organization_id = ose.organization_id_child AND ose.org_structure_version_id = 61 --and org.organization_id = 340 START WITH ose.organization_id_parent = 81 CONNECT BY PRIOR ose.organization_id_child = ose.organization_id_parent ORDER SIBLINGS BY org.location_id, ose.organization_id_child Required Columns: SELECT haou.name, papf.EMPLOYEE_NUMBER, papf.full_name FROM per_org_structure_elements ose ,hr_all_organization_units haou ,per_all_assignments_f paaf ,per_all_people_f papf WHERE ose.ORGANIZATION_ID_PARENT = 81 AND ose.ORG_STRUCTURE_VERSION_ID = 61 AND haou.organization_id = ose.organization_id_child --and paaf.organization_id = ose.organization_id_child and papf.person_id = paaf.person_id and paaf.organization_id = haou.organization_id and :P_GIVEN_DATE between papf.effective_start_date and papf.effective_end_date and :P_GIVEN_DATE between paaf.effective_start_date and paaf.effective_end_date
Thank you and best regards,
Afzal.
with
hr_all_organization_units as
(select 81 organization_id, ' name 81', 'loc_1' any double union location_id
Select 102, 'name 102', 'loc_1' from dual union all
Select 103, 'naming 103', 'loc_10' from dual union all.
Select 104, '104 name', 'loc_5' from dual union all
105, select 'name 105', 'loc_3' from dual union all
Select 111, '111 name', 'loc_5' from dual union all
112, select 'name 112', 'loc_7' from dual
),
per_org_structure_elements as
(select org_structure_version_id 61, organization_id_parent 81, 102 organization_id_child of all the double union)
Select 61,81,103 from all the double union
Select 61,81,104 from all the double union
Select 61,81,105 from all the double union
Select 61,104,111 from all the double union
Select double 61,104,112
),
employees as
(select 1 emp_id, name 'emp_1', org_id 111 Union double all the)
Select 2, 'emp_2', 112 double Union all
Select 3, 'emp_3', 112 double Union all
Select option 4, 'emp_4', 111 double Union all
Select 5, 'emp_5', 105 double Union all
Select 6, 'emp_6', 104 double Union all
Select 7, "emp_7", 103 double Union all
Select 8, 'emp_8', 102 double Union all
Select 9, 'emp_9', 81 of the double
)
Select e.name, e.emp_id, o.level_2
e employees
left outer join
(select org.organization_id,regexp_substr(sys_connect_by_path(org.organization_id,'/'). ' / ',' ^ / (\d+)',1,1,'i',1) level_2
of hr_all_organization_units org,.
per_org_structure_elements dare
where ose.org_structure_version_id = 61
and ose.organization_id_child = org.organization_id
Start with ose.organization_id_parent = 81
Connect prior ose.organization_id_child = ose.organization_id_parent
) o
on e.org_id = o.organization_id
order by emp_id
EMP_ID NAME LEVEL_2 1 emp_1 104 2 emp_2 104 3 emp_3 104 4 emp_4 104 5 emp_5 105 6 emp_6 104 7 emp_7 103 8 emp_8 102 9 emp_9 - Concerning
Etbin
-
On a 3.0.3 HYPERIC SERVER Im trying to put in place an alert for hq agent and controls the action to restart if I get an alert -?
I open the page web hyperic and select the hyperic Server customer. I then click on alert
and create an alert if the availability of the agent hq changes. When I try and change the CONTROL ACTION with the help of change. It does not list the agent in the resource type.
So I can not change the name of resource either, so I can't enter restart since I can get the hyperic
customer as long as the resource. Thi snot is available. What I am doing wrong. I try to test the control
action in EE and create just a simple test to restart the clien...Well, you can NAVIGATE to the AGENT to AC and control A QUESTION
command?If you cannot issue a regular command via the command tab, then you
won't be able to run a control to an alert action
definition.In this case, the agent does not control, is not
something you can do. As I said, you can try the program control
orders to different resources (other than the agent)-Jon
On 2 May 2007, at 16:08, mike monczynski says:
> I do not understand, can't, I have a client command to shutdown or reboot with the
> The alert CONTROL.
> Control has start stop restart but I can't get the hyperic
> customer as the resource. I'm using the EA version. I know that I can
> maually shut down and boot a client. isn't this control will do the
> same thing? Since he in the hyperic customer alert? I have on
> ocassion corrected problem by restarting the hyperic customer.
> -
Office State is waiting for the agent
Dear all,
I manually installed agent to view a VM comments (ESX4.1), which is managed by a Virtual Center.
And then I add an individual office by the Administor Console view.
The status of office is still waiting for the agent.
Could you give points for this problem?
Thank you
Dennis Dai
Two common reasons is firewall or DNS problems.
Disable the local firewall and make sure nameresolution works in two ways.
Best regards
Linjo
If you find this information useful, please give points to "correct" or "useful".
-
HI friends,
I need output like this.
Frequency (%) Cumulative
Frequency cumulative percentage
4468 0.91 0.91 4468
21092 4.31 25560 5.23
57818 11.82 83378 17.05
6274 1.28 89652 18.33
I use Oracle 9i.
My data of output like that and I need to write the query for 3 columns (for cent, the cumulative frequency and cumulative percentage)
1: the formula for the percentage column data is (frequency/amount of cumulative frequency) * 100
2: is the formula for the cumulative frequency column data (data of the cumulative frequency column of)
3: is the formula for the cumulative percentage column data (data for the cumulative percentage column of)
What should be the analytical function and how to write the query.
Thank you
LonyHi, Lony,
SUM is the function that adds several different line numbers:
SELECT frequency , percent , SUM (frequency) OVER (ORDER BY x) AS cumulative_frequency , SUM (percent) OVER (ORDER BY x) AS cumulative_percent FROM table_x ;
In your data, not frequency = 4468 on the first line, and not the line with frequency = 21092 come from then? If Yes, then you must have another column (or expression) that determines what are words like 'next', 'first' and 'after' means. I called x in the above query.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data. Beespecially erase everything that makes a line come before or after the other.
Always tell what version of Oracle you are using.
See the FAQ forum {message identifier: = 9360002}It looks like you posted another copy of the same question: {message identifier: = 10271688} maybe it's not your fault; This site can be leafed through like that. No matter who's fault, mark the other thread as "Answered" immediately, so only look in one place to find answers, and other people won't waste their time, answering a question that is answered elsewhere.
-
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
-
Hi team,
For example if I have a demo table with 4 columns (A, B, C, D) DEMO.
I want a report on this table, such that the report contains the headers and the Details section.
For each unique combination of (A, B) I must first of all show header based on the header information I want to display the detailed section.
In my header section I want to display 2 columns (A, B) that are common to the detailed section. Remaining 2 columns in the detailed section.
Here is an example: -.
A B C D
1 5 9 3
1 5P8
1 5 P O
1-5-9
1 8 9
1 D * /
2 8 33 P
2 P O O
2 P L L
YOU WILL SEE
A AND B
1 5
C D
9 3
P 8
P O
A AND B
1 D
C D
5 9
8 9
* /
A AND B
2 P
C D
8 33
O O
L L
Please suggest the solution (sql query) for above the problem and how to nest gernerated headers dynamically in the report area.
I use APEX 4.0
Any position in this regard is very significant.
Thanks and greetings
RajendraTry this:
SQL> select * from tab; 1 5 9 3 1 5 P 8 1 5 P O 1 D 5 9 1 D 8 9 1 P 8 3 1 P O O 7 rows selected. SQL> select a,b from (select r,a,b from ( select to_char(rownum)||'a' r, 'A' a,'B' b from (select distinct a, b from tab order by a,b)) union ( select to_char(rownum)||'c' r, 'C' c,'D' d from (select distinct a, b from tab order by a,b)) union ( select to_char(rownum)||'b' r, a,b from (select distinct a, b from tab order by a,b)) union select parent.r, tab.c, tab.d from ( select to_char(rownum)||'d' r, a,b from (select distinct a, b from tab order by a,b)) parent , tab where parent.a=tab.a and parent.b=tab.b ) order by r ; A B 1 5 C D 9 3 P 8 P O A B 1 D C D 5 9 8 9 A B 1 P C D 8 3 O O
-
Query for the extraction of data not available
mst_company1
company_year company_rating
2001 A
AA 2004
2009B
2010 C
2011 B +.
2020
For the table above, mst_company1
Years, from 2001 to 2020 and the coast for years are as shown above.
There are few who do not have any side
Now in the output, I need the following:
output:-
Quote of the year
2001 A
2002 NR
AA 2004
2005 NR
2009B
2010 C
2011 B +.
NR OF 2012
In the output, the years that have a side must be displayed along with the next
consecutive year should also be displayed with the rating of NR (No Rating).
For example, 2001 a rating at least one, so that the next data to be displayed must be 2002 and must wear
NR, 2003 should not be visible, and then 2004 that has a rating AA should be displayed
and then 2005 side NR should appear, 2006 will not be displayed.
Should which application I write to achieve?Hello
Lol the query for your requirments is:
WITH got_next_year AS ( SELECT company_year , LEAD (company_year, 1, company_year + 2) OVER (ORDER BY company_year) AS next_year FROM mst_company1 ) SELECT company_year , company_rating FROM mst_company1 -- UNION ALL -- SELECT next_year AS company_year , 'NR' AS company_rating FROM got_next_year WHERE next_year > company_year + 1 -- ORDER BY company_year ;
-
join query for the type of constraint and the type of the table column name
Hi, this is my request
Thank youselect table_name , column_name from user_cons_columns where table_name='EMP_CLASS' table_name column_name emp_class empno emp_class deptno select constraint_type,table_name from user_constraints where table_name='EMP_CLASS' constraint_type table_name p emp_class u emp_class I need query for this out put combining above two query. constraint_type column_name table_name p empno emp_class u deptno emp_class
Madam.Try this:
SQL> SELECT ac.table_name,ac.constraint_type,ac.constraint_name,acc.column_name,acc.position 2 FROM all_constraints ac, all_cons_columns acc 3 WHERE ac.table_name = acc.table_name 4 AND ac.constraint_name = acc.constraint_name 5 AND ac.table_name = 'TABLE_NAME' 6 /
-
anyone with a query for results last 8 days
TIMESTAMPADD (SQL_TSI_DAY,-8, CURRENT_DATE), this results in just 1 day results only if I run this query is it display 8th day back results only.
I want all 8 results back days.
what someone request for it...
Published by: user12255470 on April 28, 2010 07:19This works very well for me:
SELECT "D0 time." "" Saw_0 T00 calendar Date ","recipes of F1. " "" Recipes 1-01 (all in all) ' saw_1 'Sample Sales' WHERE 'Time D0. "' T00 calendar Date" BETWEEN TIMESTAMPADD(SQL_TSI_DAY,-8, CURRENT_DATE) AND TIMESTAMPADD (SQL_TSI_DAY-1, CURRENT_DATE) ORDER BY saw_0
concerning
John
http://www.obiee101.blogspot.com/
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 reloaded Firefox this morning and now the HOTMAIL site doesn't load.
After "reloading" Firefox this morning when I try to access my Hotmail account, I just get a blank screen instead of the normal Hotmail Log In screen.
-
My iPad seems to be dead.
My iPad seems to be dead. It is fully charged but will not start. Is there a way to reset?
-
HP Envy 4500: HP envy Wi - Fi printing and 4500 - half page only
I'm trying to print from my HP envy 4500 from my top of Dell Windows 7 Desktop Professional. I only get half of the page and the printer never ends the book, so I always have to pull him out. It's so weird, because all my HP printers before the pag
-
When open TASfirstbooks this error message: error running-2146234304 (80131040)
When you try to open TASfirstbooks this error message: error running-2146234304 (80131040) Automation error tracking. How can I overcome this? I recently uninstalled the program and reinstalled it. This does not remove the data files. Help please.
-
Change the MTU Anyconnect on SAA or the customer
I'm trying to fix the bug MTU on the Anyconnect client. I currently have clients connecting to an ASA5545X that runs the code to version 9.0 (4). I don't see anywhere to specify SVC mtu 1200 webvpn or political group on this version of the code. Nobo