Writing trigger for DML tracking on three table
Hello,
I need help on how can i write a trigger for updating backup table on DML changes on source table.
I have source table named APP_SOURCE and backup table name APP_BACKUP with same data and structure.
On any DML on source table APP_SOURCE it corresponding backup table APP_BACKUP should also be updated with same number of record changes on any DML
(insert/update/delete) to maintain data consistency on both tables
For cross refernce all changed DML records on source table APP_SOURCE should be tracked and stored within third table APP_SOURCEDMLTRACK storing old value and new value data before and after dml changes on source table APP_SOURCE
source table create script:
CREATE TABLE APP_SOURCE
RCN_ID VARCHAR2(23 BYTE),
CRD_NUM VARCHAR2(23 BYTE),
TRN_TYP VARCHAR2(10 BYTE),
TRN_DTE DATE,
REF_NUM VARCHAR2(23 BYTE),
TRN_CRR VARCHAR2(3 BYTE),
TRN_AMT NUMBER(24,6),
BLL_CRR VARCHAR2(3 BYTE),
BLL_AMT NUMBER(16,2),
BSN_DTE DATE,
BRN_S VARCHAR2(10 BYTE),
ACC_NUM_S VARCHAR2(24 BYTE),
BRN_D VARCHAR2(10 BYTE),
ACC_NUM_D VARCHAR2(24 BYTE),
SRL_NUM VARCHAR2(12 BYTE),
DVI_TYP VARCHAR2(8 BYTE),
ORG_MSG_TYP VARCHAR2(6 BYTE),
ACQ_CDE VARCHAR2(15 BYTE),
ACQ_BIN VARCHAR2(11 BYTE),
REV VARCHAR2(1 BYTE),
DBCR_FLG VARCHAR2(1 BYTE),
ATM_FEE NUMBER(16,2),
ATM_ID VARCHAR2(16 BYTE),
INT_FEE NUMBER(16,2),
TRM_ID VARCHAR2(10 BYTE),
MCN_CDE VARCHAR2(40 BYTE),
MCN_INF VARCHAR2(40 BYTE),
PNT_RCN_ID NUMBER(12),
FGN_KEY VARCHAR2(23 BYTE),
ERR_CDE VARCHAR2(200 BYTE),
JNK VARCHAR2(50 BYTE),
CRD_USED VARCHAR2(10 BYTE),
RES_CDE VARCHAR2(3 BYTE),
REA_CDE VARCHAR2(4 BYTE),
PRC_CDE VARCHAR2(10 BYTE),
MCC VARCHAR2(4 BYTE),
APP_CDE VARCHAR2(8 BYTE),
ISS_INS_ID VARCHAR2(11 BYTE),
ACQ_INS_ID VARCHAR2(11 BYTE),
ACQ_NET_CDE VARCHAR2(20 BYTE),
ISS_NET_CDE VARCHAR2(20 BYTE),
INST_ID VARCHAR2(60 BYTE),
FIID1 VARCHAR2(20 BYTE),
FIID2 VARCHAR2(20 BYTE),
SWT_FLE VARCHAR2(50 BYTE),
VIS_FLE VARCHAR2(50 BYTE),
VIS_FLE_MCHDTE DATE,
VIS_FLE_EODDTE DATE,
VIS_FLE_RCNTYP NUMBER(2),
VIS_FLE_ACNTID VARCHAR2(35 BYTE),
MAS_FLE VARCHAR2(50 BYTE),
MAS_FLE_MCHDTE DATE,
MAS_FLE_EODDTE DATE,
MAS_FLE_RCNTYP NUMBER(2),
MAS_FLE_ACNTID VARCHAR2(35 BYTE),
TIE1_FLE VARCHAR2(50 BYTE),
TIE1_FLE_SRC VARCHAR2(50 BYTE),
TIE1_FLE_MCHDTE DATE,
TIE1_FLE_EODDTE DATE,
TIE1_FLE_RCNTYP NUMBER(2),
TIE1_FLE_ACNTID VARCHAR2(35 BYTE),
TIE2_FLE VARCHAR2(50 BYTE),
TIE2_FLE_SRC VARCHAR2(50 BYTE),
TIE2_FLE_MCHDTE DATE,
TIE2_FLE_EODDTE DATE,
TIE2_FLE_RCNTYP NUMBER(2),
TIE2_FLE_ACNTID VARCHAR2(35 BYTE),
TIE3_FLE VARCHAR2(50 BYTE),
TIE3_FLE_SRC VARCHAR2(50 BYTE),
TIE3_FLE_MCHDTE DATE,
TIE3_FLE_EODDTE DATE,
TIE3_FLE_RCNTYP NUMBER(2),
TIE3_FLE_ACNTID VARCHAR2(35 BYTE),
TIE4_FLE VARCHAR2(50 BYTE),
TIE4_FLE_SRC VARCHAR2(50 BYTE),
TIE4_FLE_MCHDTE DATE,
TIE4_FLE_EODDTE DATE,
TIE4_FLE_RCNTYP NUMBER(2),
TIE4_FLE_ACNTID VARCHAR2(35 BYTE),
TIE5_FLE VARCHAR2(50 BYTE),
TIE5_FLE_SRC VARCHAR2(50 BYTE),
TIE5_FLE_MCHDTE DATE,
TIE5_FLE_EODDTE DATE,
TIE5_FLE_RCNTYP NUMBER(2),
TIE5_FLE_ACNTID VARCHAR2(35 BYTE),
TIE6_FLE VARCHAR2(50 BYTE),
TIE6_FLE_SRC VARCHAR2(50 BYTE),
TIE6_FLE_MCHDTE DATE,
TIE6_FLE_EODDTE DATE,
TIE6_FLE_RCNTYP NUMBER(2),
TIE6_FLE_ACNTID VARCHAR2(35 BYTE),
EJ_FLE VARCHAR2(50 BYTE),
EJ_FLE_MCHDTE DATE,
EJ_FLE_EODDTE DATE,
EJ_FLE_RCNTYP NUMBER(2),
EJ_FLE_ACNTID VARCHAR2(35 BYTE),
BTH_FLE VARCHAR2(50 BYTE),
BTH_FLE_MCHDTE DATE,
BTH_FLE_EODDTE DATE,
BTH_FLE_RCNTYP NUMBER(2),
BTH_FLE_ACNTID VARCHAR2(35 BYTE),
BRN_ISS_FLE VARCHAR2(50 BYTE),
BRN_ISS_FLE_MCHDTE DATE,
BRN_ISS_FLE_EODDTE DATE,
BRN_ISS_FLE_RCNTYP NUMBER(2),
BRN_ISS_FLE_ACNTID VARCHAR2(35 BYTE),
BRN_ACQ_FLE VARCHAR2(50 BYTE),
BRN_ACQ_FLE_MCHDTE DATE,
BRN_ACQ_FLE_EODDTE DATE,
BRN_ACQ_FLE_RCNTYP NUMBER(2),
BRN_ACQ_FLE_ACNTID VARCHAR2(35 BYTE),
TRNACC_ID VARCHAR2(21 BYTE),
PRT_TRNACC_ID VARCHAR2(35 BYTE),
PROCESS_ID VARCHAR2(20 BYTE),
SWT_VCH1_NUM VARCHAR2(100 BYTE),
SWT_VCH2_NUM VARCHAR2(100 BYTE),
SWT_VCH3_NUM VARCHAR2(100 BYTE),
SWT_VCH4_NUM VARCHAR2(100 BYTE),
SWT_VCH5_NUM VARCHAR2(100 BYTE),
SWT_VCH1A_NUM VARCHAR2(100 BYTE),
SWT_VCH2A_NUM VARCHAR2(100 BYTE),
SWT_VCH3A_NUM VARCHAR2(100 BYTE),
SWT_VCH4A_NUM VARCHAR2(100 BYTE),
SWT_VCH5A_NUM VARCHAR2(100 BYTE),
SWT_VCH1B_NUM VARCHAR2(100 BYTE),
SWT_VCH2B_NUM VARCHAR2(100 BYTE),
SWT_VCH3B_NUM VARCHAR2(100 BYTE),
SWT_VCH4B_NUM VARCHAR2(100 BYTE),
SWT_VCH5B_NUM VARCHAR2(100 BYTE),
SWT_VCH1C_NUM VARCHAR2(100 BYTE),
SWT_VCH2C_NUM VARCHAR2(100 BYTE),
SWT_VCH3C_NUM VARCHAR2(100 BYTE),
SWT_VCH4C_NUM VARCHAR2(100 BYTE),
SWT_VCH5C_NUM VARCHAR2(100 BYTE),
SWT_VCH1D_NUM VARCHAR2(100 BYTE),
SWT_VCH2D_NUM VARCHAR2(100 BYTE),
SWT_VCH3D_NUM VARCHAR2(100 BYTE),
SWT_VCH4D_NUM VARCHAR2(100 BYTE),
SWT_VCH5D_NUM VARCHAR2(100 BYTE),
SWT_VCH1E_NUM VARCHAR2(100 BYTE),
SWT_VCH2E_NUM VARCHAR2(100 BYTE),
SWT_VCH3E_NUM VARCHAR2(100 BYTE),
SWT_VCH4E_NUM VARCHAR2(100 BYTE),
SWT_VCH5E_NUM VARCHAR2(100 BYTE),
SWT_VCH1F_NUM VARCHAR2(100 BYTE),
SWT_VCH2F_NUM VARCHAR2(100 BYTE),
SWT_VCH3F_NUM VARCHAR2(100 BYTE),
SWT_VCH4F_NUM VARCHAR2(100 BYTE),
SWT_VCH5F_NUM VARCHAR2(100 BYTE),
SWT_VCH1G_NUM VARCHAR2(100 BYTE),
SWT_VCH2G_NUM VARCHAR2(100 BYTE),
SWT_VCH3G_NUM VARCHAR2(100 BYTE),
SWT_VCH4G_NUM VARCHAR2(100 BYTE),
SWT_VCH5G_NUM VARCHAR2(100 BYTE),
SWT_VCH1H_NUM VARCHAR2(100 BYTE),
SWT_VCH2H_NUM VARCHAR2(100 BYTE),
SWT_VCH3H_NUM VARCHAR2(100 BYTE),
SWT_VCH4H_NUM VARCHAR2(100 BYTE),
SWT_VCH5H_NUM VARCHAR2(100 BYTE),
SWT_VCH1I_NUM VARCHAR2(100 BYTE),
SWT_VCH2I_NUM VARCHAR2(100 BYTE),
SWT_VCH3I_NUM VARCHAR2(100 BYTE),
SWT_VCH4I_NUM VARCHAR2(100 BYTE),
SWT_VCH5I_NUM VARCHAR2(100 BYTE),
VIS_VCH_NUM VARCHAR2(100 BYTE),
MAS_VCH_NUM VARCHAR2(100 BYTE),
TIE1_VCH_NUM VARCHAR2(100 BYTE),
TIE2_VCH_NUM VARCHAR2(100 BYTE),
TIE3_VCH_NUM VARCHAR2(100 BYTE),
TIE4_VCH_NUM VARCHAR2(100 BYTE),
TIE5_VCH_NUM VARCHAR2(100 BYTE),
TIE6_VCH_NUM VARCHAR2(100 BYTE),
EJ_VCH_NUM VARCHAR2(100 BYTE),
BTH_VCH_NUM VARCHAR2(100 BYTE),
BRN_ISS_VCH_NUM VARCHAR2(100 BYTE),
BRN_ACQ_VCH_NUM VARCHAR2(100 BYTE),
PAR_DTE DATE,
EOD_DTE1 DATE,
EOD_DTE2 DATE,
FILLER1 VARCHAR2(4000 BYTE),
FILLER2 VARCHAR2(4000 BYTE),
FILLER3 VARCHAR2(4000 BYTE),
BRM_LINKID1 VARCHAR2(20 BYTE),
BRM_LINKID2 VARCHAR2(20 BYTE),
BRN_ACQ_FLE_ORG VARCHAR2(50 BYTE),
CRM_TRACK_FLAG VARCHAR2(20 BYTE),
DIFF_AMT NUMBER(16,2),
IS_RCN NUMBER(1),
MCH_DTE DATE,
MIGRATION_FLAG VARCHAR2(50 BYTE),
NET_CDE VARCHAR2(20 BYTE),
TRACK_FLAG VARCHAR2(100 BYTE),
TRN_MM VARCHAR2(2 BYTE),
TRN_YY VARCHAR2(4 BYTE),
MOVE_FLAG VARCHAR2(15 BYTE),
PURGE_FLAG NUMBER(2),
REV_FLAG NUMBER(1),
TEMPVCH_LOCK_DTE DATE
Please provide me any refernce on web or document which i can implement or code on how to code the required trgger.
Regards,
Ganesh
Perhaps you should consider using Materialized View Replication.
http://docs.oracle.com/cd/E11882_01/server.112/e10706/repoverview.htm#autoId9
Instead of writing triggers, you put a materialized view log on your source table. Then you can turn your backup table into a materialized view that is based on the source table. When you perform a fast refresh of the backup table MV, it will read the MV log on the source table. Refreshes should take almost no time at all to process.
If the data must be absolutely up-to-date at all times, you can use refresh on commit so that the MV is always in synch with the table. Normally I recommend against using refresh on commit, and instead recommend a short refresh interval.
You can use triggers as you suggest, but it seems simpler to use something like MVs to create a shadow table.
Similar Messages
-
Help needed writing trigger for deleting records from multipul tables
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_audit872959 wrote:
i am trying to write a trigger which would help me delete the record from 3 different tables
lets say i have table a , b and c
i an trying to write a trigger which would help me delete the same record from table a and c.
drop trigger az_zzz_trigger;
create trigger az_zzz_trigger
before INSERT or UPDATE or DELETE ON az_employ
FOR EACH ROW
BEGIN
IF DELETING then
delete from za_payroll
delete from az_salary_audit
end if;
end;
while executing this trigger all data of table za_payroll is delete.
what should i do so that only the record which i delete from az_employ gets deleted from az_payroll and az_salary_auditutilize appropriate WHERE clause -
Trouble writing Query for Pivoting data from a table
I am having a little trouble writing a query for converting the below table data into a pivot data. I am trying to write a query for which if I give a single valid report_week date as input it should give me the data for that week and also provide two extra columns, one which gives the data of last week for the same countries and the second column which gives the difference of numbers in both the columns(i.e. COUNT - COUNT_LAST_WEEK).
REPORT_WEEK DIVISION COUNT
9/26/2009 country1 81
9/26/2009 country2 97
9/26/2009 country3 12
9/26/2009 country4 26
9/26/2009 country5 101
10/3/2009 country1 85
10/3/2009 country2 98
10/3/2009 country3 10
10/3/2009 country4 24
10/3/2009 country5 101
10/10/2009 country1 84
10/10/2009 country2 98
10/10/2009 country3 10
10/10/2009 country4 25
10/10/2009 country5 102
For example, if I give input as 10/10/2009, the output should be as give below.
REPORT_WEEK DIVISION COUNT COUNT_LAST_WEEK DIFFERENCE
10/10/2009 country1 84 85 -1
10/10/2009 country2 98 98 0
10/10/2009 country3 10 10 0
10/10/2009 country4 25 24 1
10/10/2009 country5 102 101 1
For example, if I give input as 10/3/2009, the output should be as give below.
REPORT_WEEK DIVISION COUNT COUNT_LAST_WEEK DIFFERENCE
10/3/2009 country1 85 81 4
10/3/2009 country2 98 97 1
10/3/2009 country3 10 12 -2
10/3/2009 country4 24 26 -2
10/3/2009 country5 101 101 0
Can anyone please shed some light on Query building for the above scenarios.
Thank you
SKP
Edited by: user11343284 on Oct 10, 2009 7:53 AM
Edited by: user11343284 on Oct 10, 2009 8:28 AMI assume there is no gap in report weeks. If so:
SQL> variable report_week varchar2(10)
SQL> exec :report_week := '10/10/2009'
PL/SQL procedure successfully completed.
with t as (
select to_date('9/26/2009','mm/dd/yyyy') report_week,'country1' division,81 cnt from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country2',97 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country3',12 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country4',26 from dual union all
select to_date('9/26/2009','mm/dd/yyyy'),'country5',101 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country1',85 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country2',98 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country3',10 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country4',24 from dual union all
select to_date('10/3/2009','mm/dd/yyyy'),'country5',101 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country1',84 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country2',98 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country3',10 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country4',25 from dual union all
select to_date('10/10/2009','mm/dd/yyyy'),'country5',102 from dual
select max(report_week) report_week,
division,
max(cnt) keep(dense_rank last order by report_week) cnt_this_week,
max(cnt) keep(dense_rank first order by report_week) cnt_last_week,
max(cnt) keep(dense_rank last order by report_week) - max(cnt) keep(dense_rank first order by report_week) difference
from t
where report_week in (to_date(:report_week,'mm/dd/yyyy'),to_date(:report_week,'mm/dd/yyyy') - 7)
group by division
order by division
REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
10-OCT-09 country1 84 85 -1
10-OCT-09 country2 98 98 0
10-OCT-09 country3 10 10 0
10-OCT-09 country4 25 24 1
10-OCT-09 country5 102 101 1
SQL> exec :report_week := '10/3/2009'
PL/SQL procedure successfully completed.
SQL> /
REPORT_WE DIVISION CNT_THIS_WEEK CNT_LAST_WEEK DIFFERENCE
03-OCT-09 country1 85 81 4
03-OCT-09 country2 98 97 1
03-OCT-09 country3 10 12 -2
03-OCT-09 country4 24 26 -2
03-OCT-09 country5 101 101 0
SQL> SY. -
After Insert Trigger with DML on the subject table?
I am trying to set up e-mail notifications, so I created a procedure, which accepts the argument of an id. In the procedure, it queries the table and sends out mail based on the result set. (in the trigger, I pass in the value of :NEW.id). The procedure then queries the table for that row id.
First, for the after update I was getting the error:
ORA-04091: table is mutating, trigger/function may not see it ORA-06512
So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem there. SO I did the same in the after insert trigger, but then I get the error:
ORA-00060: deadlock detected while waiting for resource ORA-06512
I asked our DBA and he said you are not able to query the table of which the trigger is a subject of. I thought it would be possible since its After insert or update?
Can anyone offer any suggestions ? :)
Thanks,
TrentAny reason why it would work in an after update trigger then?
So, I was advised to do in the declare block: pragma autonomous_transaction; I did that, and that solved the problem therePRAGMA AUTONOMOUS_TRANSACTION "bends" the restriction against SQL against base table.
It is the equivalent to tap dancing across a mine field.
You might get the desired results most of the time or you might get a tasty surprise when you least expect it.
What happens to your application in the future, if/when the UPDATE has a ROLLBACK issued & PRAGMA AUTONOMOUS_TRANSACTION has successfully completed?
Inquiring minds would like to know the answer. -
Trigger for multile fields in same table.
--thanks in advance,
--I need help to write a trigger .
-- this is what i wanted
CREATE OR REPLACE TRIGGER Chk_Uniq_Qtr -- trigger name
Before insert or Update on Pro_well_Calender -- tbl name
for each row
Declare
N_Qtr1 varchar2(2);
N_Qtr2 varchar2(2);
N_Qtr3 varchar2(2);
N_Qtr4 varchar2(2);
Begin
N_Qtr1 := upper(Pro_well_Calender.Quarter1); -- column name
N_Qtr2 := upper(Pro_well_Calender.Quarter2);
N_Qtr3 := upper(Pro_well_Calender.Quarter3);
N_Qtr4 := upper(Pro_well_Calender.Quarter4);
-- But the only valid values for Quarter1 is 'April','May','June');
-- But the only valid values for Quarter2 is 'july','Auguest','September');
-- But the only valid values for Quarter1 is 'October','November','December');
-- But the only valid values for Quarter1 is 'January','February',March');
-- I need to check
IF N_Qtr1 is not in ('April','May','June') then
raise_error('Enter a month for Quarter 1'); end if;
IF N_Qtr2 is not in ('july','Auguest','September') then
raise_error('Enter a month for Quarter 2'); end if;
IF N_Qtr3 is not in ('October','November','December') then
raise_error('Enter a month for Quarter 3'); end if;
IF N_Qtr4 is not in ('January','February',March') then
raise_error('Enter a month for Quarter 4');end if;
end trigger.
--I did what ever i can but none worked.Hi,
It looks like you're on the right track.
If the local varibales
N_Qtr1 varchar2(2);
N_Qtr2 varchar2(2);
N_Qtr3 varchar2(2);
N_Qtr4 varchar2(2);
Begin
N_Qtr1 := upper(Pro_well_Calender.Quarter1); -- column name
N_Qtr2 := upper(Pro_well_Calender.Quarter2);
N_Qtr3 := upper(Pro_well_Calender.Quarter3);
N_Qtr4 := upper(Pro_well_Calender.Quarter4);are only 2 characters long, they will never be equal to 'April', 'May' or 'June'.
Also, if they are the values retruned by UPPER, they will never contain lower-case letters like 'p', 'r', 'i' or 'l'.
You probably meant to say :NEW instead of pro_well_calendar in the code above.
To raise an user-defined or pre-defined (built-in) error, use RAISE.
Instead of defining an error, you can use RAISE_APPLICATION_ERROR, like this
RAISE_APPLICATION_ERROR (-20012, 'Invalid quarter');Don't write so much code at once. Take baby steps.
For example, code, test, and debug the code for the quarter1 column first.
When that is working perfectly, you can copy it to handle the other 3 columns. -
One trigger for Multiple tables
Hi all,
I want write a trigger for mutiple tables.
For Example,
In database schema,some user update one table.I want to capture what the table and capture old value and new value.
the above example for all insert and delete also.
Regards
FameHi, Fame,
Sorry, a trigger only works on one table, so you need a separate trigger on each separate table.
All of those triggers can call a common procedure.
If you'd like to give a more detailed description of what you want to do, using two or three tables, then someone can give you more detailed instructions on how to do it.
Always say which version of Oracle you're using. -
Creation of sequence and trigger for each table!!!!!!!1
Hi
I am new to trigger and Sequence field. In one of my database we have many tables with fields for specifing ID numbers. Iam planning to insert the ID field with help of a Sequence and trigger...that trigger fires by adding the sequence value from the dual table. Now the point is here we r having around *60* table with ID field. And i am planning use the above process for each table by creating sequences and trigger for each table.
Will this affects the performance of database.
Is there any other option other than the above process, I mean other than creating sequences and trigger for each table.
PLzz help to resolve this issuee......
Shiyas
Edited by: user13170361 on Jun 7, 2010 12:37 AMTiger, I didn't mind about your comment, but the point is try to use
select NVL(max(a) + 1,1) into i from p1_temp;This line in your trigger code and see what is happening. The problem is with your trigger. You are using group by function and you will not get no_data_found !
For more help, this is some modification of your code.
SQL> create table p1_temp (a number(10) primary key, b number(10));
Table created.
SQL> create or replace trigger trg_p1_temp
2 before insert on p1_temp for each row
3 declare
4 i number(10);
5 begin
6 begin
7 select NVL(max(a) + 1,1) into i from p1_temp;
8 exception
9 when no_data_found then
10 i := 1;
11 end;
12 :new.a := i;
13 end;
14 /
Trigger created.
SQL> insert into p1_temp(b) values (1);
1 row created.
SQL> insert into p1_temp(b) values (2);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from p1_temp;
A B
1 1
2 2
SQL> Edited by: Saubhik on Jun 7, 2010 2:30 AM -
Rectifications of different sizes for all the three table lines in footer.
Hi friendz,
i am working in ecc6 system(smartforms).
i am using 3 table lines in the footer one for total, the second one for tax calculation, and the third one for the grand total.
But in the output screen display - the total, tax and grand total(in different table lines) are displayed with different heights, which gives unprofessional look for the form.
i want all the table lines in the footer to display with equal heights.Hi,
first you create LTYPE follow below sequence
Go table tab--> details tab--->give suitable heights for ltype
next go to FOOTER in the main window
create three table lines under footer like
FOOTER1
FOOTER2
FOOTER3
for three table lines we need to assign line type LTYPE
Go FOOTER1 ---> output options -
> give LTYPE.
FOOTER2 ---> output options -
> give LTYPE.
FOOTER3 ---> output options -
> give LTYPE.
reward points if helpful.
Regards,
Bhupal.
Edited by: bhupal reddy on Jul 22, 2008 11:55 AM -
Use global temp table for DML error logging
our database is 11.2.0.4 enterprise edition on solaris 10
we are wondering if anyone has an opinion of or has done this before, to use a global temp table for DML error logging. We have a fairly busy transactional database with 2 hot tables for inserts. The regular error table created with dbms_errlog has caused many deadlocks which we don't quite understand yet. we have thought using global temp table for the purpose, and that seemed to work, but we can't read error from the GTT, the table is empty even reading from the same session as inserts. Does anyone have an idea why?
ThanksThe insert into the error logging table is done with a recursive transaction therefore it's private from your session which is doing the actual insert.
Adapted from http://oracle-base.com/articles/10g/dml-error-logging-10gr2.php
INSERT INTO dest
SELECT *
FROM source
LOG ERRORS INTO err$_dest ('INSERT') REJECT LIMIT UNLIMITED;
99,998 rows inserted.
select count(*) from dest;
COUNT(*)
99998
SELECT *
FROM err$_dest
WHERE ora_err_tag$ = 'INSERT';
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
rollback;
select count(*) from dest;
COUNT(*)
0
SELECT *
FROM err$_dest
WHERE ora_err_tag$ = 'INSERT';
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 1000 Description for 1000
1400 "ORA-01400: cannot insert NULL into ("E668983_DBA"."DEST"."CODE")" I INSERT 10000 Description for 10000 -
Initial filling of logistic table is not working for Volume Tracking
Hi,
I have set up the TSCA 12B scenario for volume tracking. When starting the initial filling of the logistic tables the system recognizes the composition correctly (log file is OK). However the result is that table CCRCT_EHS_COMP is not filled at all and the table CCRCT_EHS_COMP_REG is filled correctly. Has anyone experience what could be the reason that table CCRT_EHS_COMP is not filled?
Thanks,
Paul
I found the solution. There are 2 different version of determining the composition for TSCA 12B. I changed to the other one and the problem was solved.
Edited by: P. Hensgens on Feb 21, 2012 1:17 PMHi,
You have to debug the entire system behaviour , the approval process using the second approver.
As first step , please check the security level of the second approver. Restart of workflow is based on the security level of the approver.
you can find the parameter for security level in the personalization tab of the user .
there is one function module which determines wether the workflow should be restarted (or) not.
i do not remember the exact name of the function module.
1)start transaction se37
2)enter bbpwflrestart*.
3) system will return a number of function modules , of them one function module determines wether to restart the workflow (or) not.
Please check what does the above function module return for the user and the shopping cart , there will be one parameter 'restart' which triggers the start -
How can i write the trigger for Global Temporary Table
Hi Grus,
How can i write the trigger for Global Temporary Table.
I was created the GTT with trigger using the below script .
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
trigger was create successfully, but the wouldn't insert into to EMPNAME Table..
Please guide whether am correct or not? if not kindly give a correct syntax with example
Thanks in Advance,
Arun M MBEGIN
INSERT INTO EMPNAME VALUES (:OLD.EMP_C_NAME);
END;
you are referencing old value in insert stmt.
BEGIN
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
END;then run ur application it works fine...
CREATE GLOBAL TEMPORARY TABLE GLOBAL_TEMP
EMP_C_NAME VARCHAR2(20 BYTE)
ON COMMIT PRESERVE ROWS;
CREATE OR REPLACE TRIGGER TRI_GLOBAL_TEMP
BEFORE DELETE OR UPDATE OR INSERT
ON GLOBAL_TEMP
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
BEGIN
dbms_output.put_line(:OLD.EMP_C_NAME||'yahoo');
INSERT INTO EMPNAME VALUES (:new.EMP_C_NAME);
dbms_output.put_line(:OLD.EMP_C_NAME);
END;
create table EMPNAME as select * from GLOBAL_TEMP where 1=2
insert into GLOBAL_TEMP values('fgfdgd');
commit;
select * from GLOBAL_TEMP;
select * from EMPNAME;
output:
1 rows inserted
commit succeeded.
EMP_C_NAME
fgfdgd
1 rows selected
EMP_C_NAME
fgfdgd
1 rows selectedgot it Arun
Edited by: OraclePLSQL on Dec 28, 2010 6:07 PM -
Creating a Trigger for Deleting the records from a parent Table
I am new to creating Trigger
We will need several small tables that will be used to store any records that are deleted by the owner of the table. These will likely need a trigger where we would Delete from the parent table and on that Delete populate the child table with the previous record's data.
Please give me a pseudo code for this
Thanks
John
Edited by: user10750995 on Dec 30, 2008 9:06 AMSomething like this:
CREATE OR REPLACE TRIGGER trg_my_table_hist
AFTER DELETE
ON my_table
FOR EACH ROW
BEGIN
INSERT INTO Hist_MyTable
( column1, column2, ..., DELETION_DATE)
VALUES
(:OLD.column1, :OLD.column2, ...., SYSDATE);
END;
/My_Table is your main table. When a row is deleted, the trigger will be fired and copy the deleted row to another table called Hist_My_Table. I'm supposing that the history table has all columns as they are defined in main tables plus a column named DELETION_DATE.
My experience indicates that, probably, it's a good idea maintain update history and the user. But it depends on your requests.
Regards,
Miguel -
Single query for querying three tables
Hi All,
We are trying to construct a sql query(a single query), which can perform the below functionality.
Assume, that there are three tables,
TABLE1: 3 Columns
1) ID -> PRIMARY KEY
2) TYPE -> Allows only values 'A' or 'B'
3) REF_ID(this can refer to TABLE2(ID) or TABLE3(ID)).
TABLE2: 2 Columns
1) ID -> PRIMARY KEY
2) DETAILS -> Any normal text
TABLE3: 2 Columns
1) ID -> PRIMARY KEY
2) DETAILS -> Any normal text
We need to come up with a query that, given TABLE1's(ID), we need to fetch the corresponding record in TABLE1, and we need to fetch the corresponding record from TABLE2 or TABLE3, depending on the below conditions.
If the TYPE for the TABLE1's(ID) is 'A'
Then get the details from TABLE2's by mapping TABLE1.REF_ID = TABLE2.ID
If the TYPE for the TABLE1's(ID) is 'B'
Then get the details from TABLE3's by mapping TABLE1.REF_ID = TABLE3.ID
We need to accomplish all these tasks in a single query.
Thanks for your kindly help,
SreenivasanSQL> select * from test_qry1;
ID T REF_ID
1 A 100
2 A 200
3 B 300
SQL> select * from test_qry2;
ID DETAILS
100 Human Resources
200 It Services
300 Relationships
SQL> select * from test_qry3;
ID DETAILS
100 Human Beings
200 Conference
300 Used things
SQL> SELECT t1.ID,
DECODE(t1.type,'A',( SELECT t2.details FROM test_qry2 t2 WHERE t1.ref_id = t2.id
'B',( SELECT t3.details FROM test_qry3 t3 WHERE t1.ref_id = t3.id
) details
FROM test_qry1 t1;
ID DETAILS
1 Human Resource
2 It Services
3 Used things
Try with this query.
Thanks,
Vissu...... -
Question to create a calculation to add three table's cells for a grand total
I need help with creating a calculation to add three tables. Table, 6, 7 and 8. The total of all tables should be in the last table where it says Total.
I would appreciate any help.
ThanksIf this is the resultyou are looking for the attached will help.
Steve
Please post LiveCycle Designer ES questions in that forum in the future. -
dear friends
kna1- kunnr ,name1
vbak - vbeln , erdat
vbap - meins , kwmeng
on above i have given three tables and their fields in front of this
can any one tel me how to give inner join in select statement for the above tablesHi Create an appropriate internal table ITAB
Select VBAK~VBELN
VBAK~ERDAT
VBAP~POSNR
VBAP~MEINS
VBAP~kwmeng
KNA1~KUNNR
KNA1~NAME1
From VBAK
Into Table ITAB
Inner Join VBAP On VBAKVBELN = VBAPVBELN
Inner Join KNA1 On VBAK~KUNNR = KNA1-KUNNR
Where VBAK~VBELN In S_VBELN.
Santhosh
Maybe you are looking for
-
I have the following requirement: A user enters a Fiscal Period. On our report we want to define key figures which show values as follows: Our Financial year is from 1st January u2013 31st December with 16 posting periods (K4 variant) Fiscal Period:
-
Best solution for media storage
Hi Everyone, I am looking for suggestions/how-to on the best setup for media storage. We have two editors (and two computers - Mac Pro PowerPC and iMac Intel). We are currently using an internal 500 GB slot on the Mac Pro along with 1 additional exte
-
Mobile Me / iCloud upgrade. Timezone upgrade.
I have a MacBook desktop which I purchased restored from a Computer Supplier - I am not sure what year it is, possibly mid 2010. It is still running Mobile Me instead of iCloud - I never had a Mobile Me accoutn and am wanting to upgrade it to iCloud.
-
Corrupt iTunes Library file (.itl AND .xml)
I just got a new mac and decided not to put my music on it. Instead I kept my entire itunes library on an external hard drive. At some point, my hard drive must have disconnected while using iTunes and the library files became corrupt. When I see the
-
How can i call mouse click event from keypress event???
How can i call mouse click event from keypress event??? I want same GUI changes to be occured at key press.....i.e . button going down & comming up..... for calculator