Altering and updating a table
Hi
I have a table like this below
Prdid prdcode seqno
445566 201 1
445566 202 2
445566 203 3
445566 204 4
445566 205 5
445566 206 6
445566 207 7
445566 208 8
Now a new column prvprdcd will be added to that table, by updating the previous value of prdcode, like below
prdid prdcode prvprdcode seqno
445566 201 202 1
445566 202 203 2
445566 203 204 3
445566 204 205 4
445566 205 206 5
445566 206 207 6
445566 207 208 7
445566 208 8
I think this task can be done by taking the maximum seqno value of prdid and using a cursor updating the prvprdcode
but can you please suggest is there any other better way doing that, i think it can be done by using
LAG function or by using Hierarchial Queries, Can you guys please show some light on it.
Second thing is
whenever the Prdid upgrades to new Prdid, the present prdid value should be passed to prvprdcode.
prdid prdcode prv_prdcode seqno
445566 200 201 1
445566 201 202 2
445566 202 203 3
445566 203 204 4
445566 204 205 5
445566 205 206 6
445566 206 207 7
445566 207 208 8
445566 208 9
The first one is a one time change, but the second will be done by using jobs which will run on a daily basis
the prdid will be checked for any new values in a master table, if there is any change this table will be updated
can you please let me know how can this be done.
oracle_for_dude wrote:
Hi it is achieved by lead function not by lag
SQL> with t as(select 445566 Prdid, 201 prdcode, 1 seqno from dual union all
2 select 445566, 202, 2 from dual union all
3 select 445566, 203, 3 from dual union all
4 select 445566, 204, 4 from dual union all
5 select 445566, 205, 5 from dual union all
6 select 445566, 206, 6 from dual union all
7 select 445566, 207, 7 from dual union all
8 select 445566, 208, 8 from dual)
9 select Prdid,prdcode,lead(prdcode) over(order by prdcode) new_prdcode,seqno from t;
PRDID PRDCODE NEW_PRDCODE SEQNO
445566 201 202 1
445566 202 203 2
445566 203 204 3
445566 204 205 4
445566 205 206 5
445566 206 207 6
445566 207 208 7
445566 208 8
8 rows selected.
Your code will fail if the PRDID Changes
SQL> select Prdid,prdcode,lead(prdcode) over(order by prdcode) new_prdcode,seqno
from prds
PRDID PRDCODE NEW_PRDCODE SEQNO
445567 201 201 1
445566 201 201 1
445568 201 202 1
445566 202 202 2
445567 202 203 2
445566 203 203 3
445568 203 203 3
445567 203 204 3
445566 204 204 4
445567 204 205 4
445568 205 205 5
445566 205 205 5
445567 205 206 5
445567 206 206 6
445566 206 206 6
445568 206 207 6
445566 207 207 7
445567 207 208 7
445566 208 208 8
445568 208 208 8
445567 208 210 8
445568 210 211 4
445568 211 212 2
445568 212 7
24 rows selected.It Should be
SQL> select Prdid,prdcode,lead(prdcode)
over(PARTITION BY PRDID order by SEQNO) new_prdcode,seqno
from prds
PRDID PRDCODE NEW_PRDCODE SEQNO
445566 201 202 1
445566 202 203 2
445566 203 204 3
445566 204 205 4
445566 205 206 5
445566 206 207 6
445566 207 208 7
445566 208 8
445567 201 202 1
445567 202 203 2
445567 203 204 3
445567 204 205 4
445567 205 206 5
445567 206 207 6
445567 207 208 7
445567 208 8
445568 201 211 1
445568 211 203 2
445568 203 210 3
445568 210 205 4
445568 205 206 5
445568 206 212 6
445568 212 208 7
445568 208 8
24 rows selected.SS
Similar Messages
-
Analysing and Updating a table
Hi,
Can anyone help me on follwing query..
Can analyse of a table and updation on to same table can happen paralley?
thank in advance.What's your db version? The very first thing is that you should not use the analyze command but dbms_stats package. Now , I am not sure why you want to gather the stats and update the table at the same time? As mentioned by Erica, the update should be followed with the stats gathering. And about the index usage, there are couple of things that can stop index from being used, for example, low selectivity on the column can very well stop the index. Other than that, if you are accessing the column containing the index alone and the column is supposed to contain the null values, oracle would rather use a FTS than using the index which actually makes perfect sense since use of index would result in incorrect data. So there can be couple of htings possible which may stop your index from being used. All what dbms_stats(and even Analyze) command would do , is to make the distribution of the data known tooracle. Having stats alone doesn't guarantee that the index would be used for sure.
HTH
Aman.... -
How to call a idoc in abap program and updates catsdb table
how to call a idoc in abap program and updates catsdb table
thank you,
Jagrut BharatKumar ShuklaHi Kishan,
You can refer to following help document,
http://help.sap.com/saphelp_nw04/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/content.htm
Regards,
Meera -
Check two columns and update other table
HI ,
I have a table called trackCenterline .Below is the table.
What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id in other table called TrackSegment which is below. and pick the BeginMilepost of that segmentID and Update That
Milepost in a new table .At end SegmentSequenceID number it should pick ENDMilepost and update
TrackCenterline table.
TrackSegment table
In the below table for 10001 SegmentID it should pick BeginMilepost. For end Number of SegmentSequenceID in above table ID ends at 121 for that end sequenceID It should refer TrackSegment table below and pick EndMilepost and should be updated in another
table Milepost column.
after that a new segment starts with new sequence .and so on ...
bhavanaHi Deepa_Deepu,
According to your description, since the issue regards T-SQL. I will help you move the question in the T-SQL forums at
http://social.technet.microsoft.com/Forums/en-US/home?forum=transactsql. It is appropriate and more experts will assist you.
When you want to check two columns from two tables then return some results and update the third table. I recommend you use join function and combine two tables, then use update select from statement for modifying the Mailpost table. You can refer to the
following T-SQL Statement.
-----using join to connect to two tables
select TrackCenterline.FeatureId,TrackCenterline.SegmentId,
TrackCenterline.SegmentSequenceId,TrackSegment.BeginMilepost,TrackSegment.EndMilepost
from dbo.TrackCenterline join dbo.TrackSegment
on TrackCenterline.SegmentId=TrackSegment.SegmentId
order by TrackCenterline.SegmentId, TrackCenterline.SegmentSequenceId
---the result shows as following.
FeatureId SegmentId SegmentSequenceId BeginMilepost EndMilepost
AMK100011 10001 1 61.0000 61.3740
AMK100012 10001 2 61.0000 61.3740
AMK100013 10001 3 61.0000 61.3740
AMK1000121 10001 121 61.0000 61.3740
AMK100021 10002 1 61.1260 61.7240
AMK100023 10002 3 61.1260 61.7240
AMK100033 10003 3 61.3740 62.9530
-----Then you can use update select from statement to modify the Mailpost table, Or you can post the table structure of Mailpost
And for more information, you can review the following article about update statement.
http://www.techonthenet.com/sql/update.php
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
Comparing Two tables with 300k records and update one table
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
If you're asking about a DML statement, such as UPDATE, the CREATE TABLE and INSERT statements should re-create the tables as they are before the DML, and the results will be the contents of the changed table(s) when everything is finished.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
ef2019c7-080c-4475-9cf4-2cf1b1057a41 wrote:
Could you let me know how to compare two tables having 300k records and update one table.below is the scenario.
Table Tabl_1 has columns A,B and Tabl_2 has columns B,new_column.
Column B has same data in both the tables.
I need to update Tabl_2 in new_column with Tabl_1 A column data by comparing B column in both tables.
I m trying to do using PLSQL Tables.
Any suggestion?
Thanks.
Why are you trying to use PL/SQL tables? If tabl_1 and tabl_2 are regular database tables, it will be much simpler and faster just to use them.
Depending on your requirements, you can do an UPDATE or MERGE, either in SQL or in PL/SQL. -
Alter and update text from C#?
Does anybody know if it's possible to alter and update text from C#?
I've added a reference to Interop.Illustrator.dll COM type library and managed to cobble together have this bit of code
Illustrator.Application app = new Illustrator.Application();
Illustrator.Document doc = app.Open(
"c:\\MyIllustratorDoc.ai",
Illustrator.AiDocumentColorSpace.aiDocumentRGBColor,
null);
foreach(Illustrator.TextFrame textFrame in doc.TextFrames)
Console.Write(textFrame.Contents);
which just dumps out the contents of all the TextFrames but from the documentation I've found, Contents and everything else that gives access to any text, is read only.
I was hoping to be able to automate the maintenance of various bits of text by picking them up from SQL Server and then amending them directly in the ai file where needed. Any help would be greatly appreciated.
Cheers,
TimHi,
IPQ-2007-08-20 YES is in 1 field ..
At first is only 'IPQ-2007-08-20' in that field RM06I-LTEX2 now user want to fully utilize this long text field. so want to add something at RHS of this field.
You may refer this link to get clearer idea, what is the user want.
<a href="http://allyoucanupload.webshots.com/v/2003186583194973129">[IMG]http://aycu16.webshots.com/image/37295/2003186583194973129_rs.jpg[/IMG]</a>
How should I insert 2 column of data (eg 'IPQ-2007-08-20' and 'YES' ) into this 1 field (RM06I-LTEX2) without overwrite each other?
Message was edited by:
Peai Chun Ong -
Listening to change in a row of a table a and update a table in a diferent Database
i want to update a table using values from a different database table. how to i do it in SQl 2012
i want to update a table using values from a different database table. how to i do it in SQl 2012
With Service Broker?
Without Service Broker, you would do:
UPDATE targettbl
SET col1 = b.col1,
col2 = b.col2,
FROM targettbl a
JOIN srctbl b ON a.keycol1 = b.keycol1
AND a.keycol2 = b.keycol2
It is important that a row in targettbl maps to at most at one row in srctbl, or else the result will not be predictable.
Erland Sommarskog, SQL Server MVP, [email protected] -
Browse and update database tables
I'm looking for a tool that will let me connect to an Oracle database, select a table and some fields off the table and build a simple java class to navigate / update the data.
Essentially, I'm looking for a tool that replicates the way Microsoft Access can build a form for navigation and update of a database table.
However, I want to use java, not MS Access.
Any ideas if such a tool is available ?
Thankshttp://squirrel-sql.sourceforge.net/
-
Query and update a table/view
What is the best & fastest way to do this?
1) Put up a query input region for users to enter parameters.
2) Run a query on a table/view using those parameters.
3) Allow the output in (2) to be modified by user (multiple rows at a time) and then Submit the updates back to update th table/view
I can do (1) and (2) easily. How can I do (3)?
ThanksMake a report on the table. Go to the definition of
the report column and change the "Display As" type to
text field or select list or whcih ever is
applicable. Write a process on submit to insert these
values back to the table. You will have control over
which columns the user can modify.Thats a good idea and I was able to start on it. But how can my after submit process tell which rows to modify? i.e. what will my after submit process look like?
for rec in (....)
loop
update my_table set
end loop;
Help? Thanks -
Approach for holding the same message and updating the table field Status
Hi,
I have a scenario a (first) proxy asynchronous to JDBC synchronous and then(second) proxy asynchronous.
my first proxy calls sends records (which has a status entry " in process" ) to JDBC it updates or inserts.
JDBC sends a response (may be a count of records updated or inserted)
now i need to handle some how to get the records which have been inserted or updated, so that i can map and change the table entry status field" in process" to " active".
Can i handle this without stored procedures.If so how
Can it be done through BPM where i retain inital mapping or any other solution. please help.Hi Robin,
Ok (but that would be the apt method)
Some other approaches :
1. Make a async scenario (Proxy to DB), which will update or insert records. Write a trigger in DB which will fetch updated/inserted records and send it to XI. Then you update them in R/3 (via proxy). So you will have two async interfaces (one is Proxy to DB and other one DB to Proxy)
2. go for BPM. Receive (from proxy), transform sync send, transform send (to proxy) . I will not prefer this as it will be a performance hinderance.
Regards
Suraj -
How to read a txt file and update DB table
I have to read a table which has some entries in it as plain text file, then I should update my table if the table entries and the data in text file are NOT MATCHING o.w. keep the table entry as it is
It will helps to u
data : begin of t_temp occurs 0,
text(256),
end of t_temp.
data : s_file type string.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-S01.
PARAMETER: P_FILE LIKE RLGRAP-FILENAME.
SELECTION-SCREEN : END OF BLOCK B1.
clear s_file.
move p_file to s_file.
uploade SOURCE file to t_tab1
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = s_file
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = t_temp
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Text deleted by Moderator. Do NOT request points
Regards
Saimedha -
ALV grid oo delete rows and update to table
Hi all
How can I delete one row and update to the db table?
thanksHi,
Refer:-
The ALV Grid has events data_changed and data_changed_finished. The former method is
triggered just after the change at an editable field is perceived. Here you can make checks for
the input. And the second event is triggered after the change is committed.
You can select the way how the control perceives data changes by using the method
register_edit_event. You have two choices:
1. After return key is pressed: To select this way, to the parameter i_event_id pass cl_gui_alv_grid=>mc_evt_enter.
2. After the field is modified and the cursor is moved to another field: For this, pass cl_gui_alv_grid=>mc_evt_modifies to the same parameter.
To make events controlling data changes be triggered, you must select either way by
calling this method. Otherwise, these events will not be triggered.
To control field data changes, ALV Grid uses an instance of the class
CL_ALV_CHANGED_DATA_PROTOCOL and passes this via the event data_changed.
Using methods of this class, you can get and modify cell values and produce error messages.
Hope this helps you.
Regards,
Tarun -
ABAP Client proxies: extract data from the response and update Z table
Hi All,
I have following ABAP code for client proxies:
We have DT_Req, MT_Req, DT_Res, MT_Res and MI_Sync_OB (O/p Message: MT_Req, I/P message:MT_Res)
Proxy Objects generated:
ZCO_MI_SYNC_OB
ZMT_REQ
ZDT_REQ
ZDT_REQ_RECORDS
ZDT_REQ_RECORDS_TAB
ZMT_RES
ZDT_RES
ZDT_RES_RECORDS
ZDT_RES_RECORDS_TAB
ABAP Code:
REPORT ZTEST_DELETE.
DATA:
lo_history TYPE REF TO ZCO_MI_SYNC_OB,
lo_sys_exception TYPE REF TO cx_ai_system_fault,
Structures to set and get message content
lv_history_req_mt TYPE ZMT_REQ OCCURS 0 WITH HEADER LINE,
lv_history_res_mt TYPE ZMT_RES,
lv_history_req_rec TYPE ZDT_REQ_RECORDS,
lv_history_res_rec TYPE ZDT_RES_RECORDS.
lv_history_req_rec-VLAUE = SY-DATUM.
APPEND lv_history_req_rec TO lv_history_req_mt-MT_REQ-RECORDS.
CREATE OBJECT lo_history.
TRY.
Call outbound Proxy
CALL METHOD lo_history->execute_synchronous
EXPORTING
output = lv_history_req_mt
IMPORTING
<b>input = lv_history_res_mt.</b>
Error handling
CATCH cx_ai_system_fault INTO lo_sys_exception.
SKIP 2.
WRITE:/ lo_sys_exception->errortext.
RETURN.
ENDTRY.
<b>Now I have my response data in the internable "lv_history_res_mt-MT_REQ-RECORDS" which is deep structure.
How do I extract data records (multiple) from the above internal table and update to Z table??</b>
Thanx
NavinHi Navin,
go to SPROXY, flag structure and search for your table definition. You will find a table definition a field "line" or something, where you find the right structure. Create a new structure with DATA: myStructure type tableStructure. Define a second structure type with your Ztable. Next Loop at internal table into the structure. Inside that loop fill the Zstructure. Insert the Zstrucure (Press F1 on insert to have the syntax you need)
loop at internalTable into intStructure.
zstructure-myField = intStructure-myField.
INSERT ztable FROM zstructure.
endloop.
Regards,
Udo -
Program RFBELJ10_NACC and update in table TRVOR
Hi experts,
I want to run program RFBELJ10_NACC (Document Journal for Italy).
The user has already run it without test run.
As a result, the counters have already been updated in table TRVOR.
How can I re-set them?
What consequence will it have if I reset them?
Thank you for your advice.
Kind regards,
LindaHi
I had the same problem in Italy, and it's possible to reset counter, running again report (not in test) from the first period of FY (Fiscal Year) needed to reset.
In this way you can have a new counter as well and you can verify the updating by SE16 table TRVOR for each month run.
Antonio -
I've recently started trying to automate around a dozen procedures. These procedures are set to run immediately after the necessary previous procedure(s) is(are) done.
What I am attempting to accomplish is a single generic trigger that will fire off each procedure when its parent procedures have finished firing. This will be accompanied by an update_flag table with three columns
PARENT_PRC----------------------CHILD_PRC----------------------FLAG
parent_prc_name1--------------child_prc_name1-----------------N
parent_prc_name1--------------child_prc_name2-----------------N
parent_prc_name3--------------child_prc_name3-----------------Y
Logic:
*1.* When a procedure fires it updates this table to set any rows in which it is the “PARENT_PRC” by updating the FLAG column to = Y.
*2.* The trigger will execute a child procedure if its flag (or in the case of multiple parent procedures; all of its flags) are set to 'Y'. This trigger is set to fire AFTER a table update on the UPDATE_FLAG table.
----a. I have to execute the procedure UFLAG in a job because I want the trigger to execute the procedure and then continue running immediately, rather than wait for the procedure to finish then commit. This way the trigger could start several procedures all running at the same time.
----b. I have made it an autonomous transaction because I needed the job to fire immediately rather than be queued, which required a commit within the trigger.
*3.* The last step is to set the flag in UPDATE_FLAGS back to 'N' for CHILD_PRC = '||uflag||' once the child procedure is complete.
----a. I have tried placing the update child_prc = 'N' in the trigger but it won’t allow a trigger that fires on update to update the same table.
----b. I want to avoid putting the update statement in all of my procedures because I would like the option of running these procedures manually for testing purposes WITHOUT effecting the update_flags table.
Number 3. is the key problem I have been having. Placing code within the trigger to update the update_flags table setting 'Y's back to 'N's once the procedures have fired causes a deadlock error.
I believe this is simply because the trigger is attempting to update a table which (upon updating) causes the same trigger to fire before it has finish executing.
How can I update the Flag table to reset the update flags back to 'N'?
Is there a different way of doing this all together?
Here is some code with dummy procedures that demonstrates what I have so far.
With this code, executing parent procedures should set the update_flag table to 'Y' for FLAG where procedure = 'parent_prc'.
I need to find a way to execute the child procedures AND set the FLAG column back to 'N' from the trigger.
ex. executing parent_1 should set update_flags.flag = 'Y' where parent_prc = 'parent_1' and thus execute procedure CHILD_A and CHILD_B.
create table update_flags (parent_prc varchar2(10), child_prc varchar2(10), flag varchar2(1));
insert into update_flags values('parent_1', 'child_a', 'N');
insert into update_flags values('parent_1', 'child_b', 'N');
insert into update_flags values('parent_2', 'child_c', 'N');
insert into update_flags values('parent_3', 'child_c', 'N');
insert into update_flags values('parent_4', 'child_d', 'N');
CREATE OR REPLACE procedure parent_1 as
BEGIN
update update_flags set flag = 'Y' where parent_prc = 'parent_1';
END parent_1;
CREATE OR REPLACE procedure parent_2 as
BEGIN
update update_flags set flag = 'Y' where parent_prc = 'parent_2';
END parent_2;
CREATE OR REPLACE procedure parent_3 as
BEGIN
update update_flags set flag = 'Y' where parent_prc = 'parent_3';
END parent_3;
CREATE OR REPLACE procedure parent_4 as
BEGIN
update update_flags set flag = 'Y' where parent_prc = 'parent_4';
END parent_4;
CREATE OR REPLACE procedure child_a as
BEGIN
dbms_output.PUT_LINE('CHILD_A Worked');
commit;
END child_a;
CREATE OR REPLACE procedure child_b as
BEGIN
dbms_output.PUT_LINE('CHILD_B Worked');
commit;
END child_b;
CREATE OR REPLACE procedure child_c as
BEGIN
dbms_output.PUT_LINE('CHILD_C Worked');
commit;
END child_c;
CREATE OR REPLACE procedure child_d as
BEGIN
dbms_output.PUT_LINE('CHILD_D Worked');
commit;
END child_d;
CREATE OR REPLACE TRIGGER MASTER_TRG
AFTER UPDATE
ON UPDATE_FLAGS
DECLARE
Pragma AUTONOMOUS_TRANSACTION;
BEGIN
DECLARE
job_num number;
uflag varchar2(1000);
BEGIN
select MAX(case when COUNT(case when flag='Y' then 1 end)=COUNT(*) then CHILD_PRC else ' ' end)
into uflag
from update_flags
group by child_prc;
IF uflag <> ' ' THEN
--update update_flags set flag = 'N' where child_prc = uflag --(line of code that causes deadlock error)
dbms_job.submit (job => job_num,
what => ' '||uflag||';'
END IF;
END;
COMMIT;
END MASTER_TRG;
execute parent_2;
execute parent_3;>
I think I am getting my head around the transactional/trigger issue.
>
It doesn't sound like it since you are still talking 'triggers'. At any rate it is OP that needs to get their head around it.
OP doesn't even know what the entire process needs to be but has already decided that
1. a single generic trigger that will fire off each procedure when its parent procedures have finished firing
2. an update_flag table with three columns: PARENT_PRC, CHILD_PRC, FLAG
3. a procedure fires it updates this table to set any rows in which it is the “PARENT_PRC” by updating the FLAG column to = Y.
4. a job - I have to execute the procedure UFLAG in a job
5. I have made it an autonomous transaction because I needed the job to fire immediately rather than be queued, which required a commit within the trigger.
6. there should be an option of running these procedures manually for testing purposes WITHOUT effecting the update_flags table.
Fortunately OP had the wisdom to ask
>
Is there a different way of doing this all together?
>
Doesn't anyone design things anymore? Seems like everyone just wants to decide what the solution ought to be be and then try to force the problem to fit into it.
The first stage is the DESIGN - not the implementation details or technology to use.
The first design step is to outline, or flowchart, the PROCESS that needs to take place. Since OPs post lacks sufficient detail I will substitute my own 'guesstimations' to illustrate.
1. there are one or more 'parent' processes
2a. these parent processes are allowed to run in parallel as they do not interfere in any way with the processing done by other parent or child processes. (is this true?)
2b. these parent processes ARE NOT allowed to run in parallel as they may interfere with each other.
3. Each parent process can have one or more 'child' processes. (it appears that these aren't really children but rather processes that are 'dependent' on the parent or that must always be executed after, and each time that the parent executes.
So here are just SOME of the things that are missing that must be known before possible alternatives can be explored
1. Re item #2 - can the parent processes be executed in parallel? Or must they be executed serially? Will any of the parent processes be dependent on any other parent or child process?
2. What is the relationship between a parent process and its child processes? Is the parent always executed first? What triggers the parent execution? How often is it executed?
What if it is already executing? What if other parent processes are currently executing? What if one or more of its child processes are executing? What if the parent process fails for any reason - what action should be taken?
Based on what was posted a set of parent and child processes might need nothing more than: execute parent, execute child1, execute child2, . . ., execute childn.
3. What is the relationship between the child processes that belong to the same parent? Can they be executed in parallel (i.e. are they completely independent)? Or must they be executed in some particular order? What if one or more of the child processes fails for any reason - what action should be taken?
4. Will any other user or process be executing these parent or child processes? That could interfered with the automated stream.
5. What type of exception handling and recovery needs to be implemented in one or more steps of the processing fail for some reason?
Typically there is often one or more control tables (OPs flag table) to control and limit the processing. But the table would have status information for every process not just the children:
A. STATUS - DISABLED, ACTIVE, RUNNING, IDLE, ERROR
B. START_TIME
C. END_TIME
D. RESULT_CODE
The control table can be used by a parent or child process to determine if it is permitted to run. For example the first thing a procedure might do is check it's own STATUS. If it is already running it would exit or log an error or message. If that test is passed it might check the status of any dependent processes. For example it might check that its child processes are ACTIVE and ready to run; if a child was still running the parent would exit or log an error or message.
The control process would lock the appropriate control table records (FOR UPDATE) and would set the status and other fields appropriately to prevent interference by other processes or procedures.
Design first. Then look at the implementation options.
Maybe you are looking for
-
How can I restore lost voicemails after iOS 5 update?
I've seen a lot of posts of this sort, but I've been trying to fix this issue for months and I really need some experienced help... When I updated my phone to iOS 5, I received a message saying my phone couldn't be restored because the backup was enc
-
How to get back the emails from an old hard drive that has no more OS ?
Hello, My computer crashed recently. The problem came from Windows somehow. So the hard drive is fine. since windows couldn't be repaired I just copied a disk image backup to a new hard drive. The problem is that I lost all the emails that were recie
-
HT1257 Exporting photos with titles
Exporting photos for use on Windows through the Finder (not through Share) does not allow the titles I have attachged to the photos to be expored along with them. Does anyone know a way that will allow this?
-
Can a SAP report output by email in excel format?
we have some batch jobs for SAP reports running & sending the result to user by email every month, currently the format only in PDF file, is it possible to send the reports as mail attachments in xls format? Edited by: hcy h on Feb 3, 2010 4:11 PM
-
As above