Trigger changing problem
I've created a compound trigger that creates a trigger mutation error.
Here are the trigger:
DROP TRIGGER bi_fin_transaction
/
DROP TRIGGER ais_fin_transaction
/
CREATE OR REPLACE TRIGGER ai_fin_transaction
FOR INSERT
ON fin_transaction
COMPOUND OF TRIGGER
Number of TransactionNumber;
TransactionAmount number (18.6);
DiscountTakenAmount number (18.6);
AfterBalanceAmount number (18.6);
Number of InvoiceNbr;
Date of MaxGlDate;
number of v_count;
date of gl_date;
CURSOR operation IS
SELECT invoice_nbr,
gl_date
OF gtt_ai_fin_transaction_work
ORDER BY invoice_nbr;
CURSOR recalculate IS
SELECT transaction_nbr,
transaction_amount,
discount_taken_amount
OF gtt_ai_fin_transaction
ORDER BY gl_date,
transaction_nbr;
UNTIL EACH ROW IS
BEGIN
BEGIN
SELECT ft.invoice_nbr,
Max (COALESCE(ft.gl_date,ft.transaction_date))
BY InvoiceNbr,
MaxGlDate
FT fin_transaction
WHERE ft.invoice_nbr =: new.invoice_nbr
GROUP BY ft.invoice_nbr;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END;
IF: new.gl_date < MaxGlDate THEN
INSERT INTO gtt_ai_fin_transaction_work
VALUES (InvoiceNbr,
MaxGlDate
);
END IF;
PURPOSE BEFORE EACH ROW;
AFTER EACH ROW IS
BEGIN
IF (: new.invoice_nbr IS NOT NULL) THEN
UPDATE fin_invoice
SET last_transaction_date =: new.transaction_date
WHERE invoice_nbr =: new.invoice_nbr;
END IF;
IF (: new.payment_nbr IS NOT NULL) THEN
UPDATE fin_payment
SET last_transaction_date =: new.transaction_date
WHERE payment_nbr =: new.payment_nbr;
END IF;
END AFTER EACH LINE;
AFTER STATEMENT IS
BEGIN
SELECT COUNT (*)
IN v_count
OF gtt_ai_fin_transaction_work;
IF v_count > 0 THEN
CURRENT transaction;
LOOP
Get operation IN InvoiceNbr,
gl_date;
OUTPUT WHEN transaction % NOTFOUND;
DELETE FROM gtt_ai_fin_transaction;
INSERT INTO gtt_ai_fin_transaction
SELECT transaction_nbr,
COALESCE(gl_date,transaction_date),
CASE transaction_type WHEN IN ('PAY', 'CON', 'CRD', 'PAD', "ADJ", "ACC", "NSF", "COR", "PADR")
THEN transaction_amount *-1
Of OTHER transaction_amount
END,
CASE transaction_type WHEN IN ('PAY', 'CON', 'CRD', 'PAD', "ADJ", "ACC", "NSF", "COR", "PADR")
THEN discount_taken_amount *-1
Of OTHER discount_taken_amount
END,
0.00,
NULL VALUE
OF fin_transaction
WHERE invoice_nbr = InvoiceNbr
AND payment_nbr IS NOT NULL
ORDER OF COALESCE(gl_date,transaction_date),
transaction_nbr;
SELECT after_balance_amount
IN AfterBalanceAmount
OF fin_transaction
WHERE invoice_nbr = InvoiceNbr
AND payment_nbr IS NULL;
Recalculate OPEN;
LOOP
FETCH recalculate IN TransactionNumber
TransactionAmount,
DiscountTakenAmount;
OUTPUT WHEN recalculate % NOTFOUND;
AfterBalanceAmount: = AfterBalanceAmount + TransactionAmount + DiscountTakenAmount;
UPDATE fin_transaction
SET after_balance_amount = AfterBalanceAmount,
after_status = CASE WHEN AfterBalanceAmount = 0.00
THEN 'C '.
ELSE 'O'
END
WHERE transaction_nbr = TransactionNumber;
END LOOP;
Recalculate the RELATIVES;
END LOOP;
CLOSE transaction;
END IF;
END AFTER STATEMENT;
END;
/
ENGAGE
/
Here is the statement of "insert" the origin of the problem:
INSERT INTO fin_transaction (transaction_nbr, invoice_nbr, payment_nbr, transaction_amount,
gl_date, transaction_type, discount_amount, transaction_date, reversed_transaction_nbr,
discount_taken_amount, after_balance_amount, after_status, financial_source, add_by, add_date,
remaining_onaccount)
(SELECT 255793, invoice_nbr, payment_nbr, transaction_amount)
, TO_DATE (' 03/05/2015-00:00:00 "," DD-MM-YYYY HH24:MI:SS'), 'VCHK,' discount_amount, TO_DATE (' 03/05/2015-00:00:00 "," DD-MM-YYYY HH24:MI:SS'),
255416, discount_taken_amount, after_balance_amount + transaction_amount + 0.000000, 'o', financial_source, 'PLANGTON,'
To_date (' 03/05/2015-12:31:44 ',' DD-MM-YYYY HH24:MI:SS'), remaining_onaccount
OF fin_transaction
WHERE transaction_nbr = 255416)
Here is the table of the affected table definition:
CREATE TABLE fin_transaction
(
transaction_nbr number not null,
number of invoice_nbr null,
number of payment_nbr null,
transaction_amount number (18.6) not null,
gl_date date null,
transaction_type varchar2 (10) not null,
discount_amount number (18.6) null,
transaction_date date not null,
number of reversed_transaction_nbr null,
discount_taken_amount number (18.6) default null, 0
after_balance_amount number (18.6) not null,
after_status char (1) not null
CONSTRAINT ckc_fin_tran_after_status CHECK (after_status IN ('O', 'C')),
remaining_onaccount number (18.6) null,
financial_source char (3) not null
CONSTRAINT ckc_fin_tran_financial_source CHECK (financial_source IN ('A / P ',' has / R ""));
reference_id varchar2 (10) null,
add_by varchar2 (40) not null default user,.
add_date date DEFAULT sysdate not null,
number of payment_journal_nbr null,
misc_amount number (18.6) null,
misc_gl_acct_nbr varchar2 (75) null,
pdu_payment_status char (1) default ' is not null
CONSTRAINT ckc_fin_tran_pdu_paymentstatus CHECK (pdu_payment_status IN (', 'F', 'W', 'O', 'P')),
remaining_onaccount_original number (18.6) DEFAULT 0 no no,.
number of vc_register_nbr null,
vc_register_addto_flag char (1) default ' is not null
CONSTRAINT ckc_fin_tran_vc_reg_addto_flag CHECK (vc_register_addto_flag IN ('Y', ' don't)).
additional_gl_transaction_flag char (1) default ' is not null
CONSTRAINT ckc_fin_tran_add_gl_trans_flag CHECK (additional_gl_transaction_flag IN ('Y', ' don't)).
gl_exchange_rate number (20,10) null,
commodity_id varchar2 (10) null,
CONSTRAINT pk_fin_transaction PRIMARY KEY (transaction_nbr)
using index
tablespace smartsoft_index
)
tablespace smartsoft_data
/
I can not (for the life of me) see this would cause a trigger of mutation.
Any help would be appreciated.
BTW Oracle 11.2.0.2 on Windows 64-bit server.
Murray
Problem has been resolved by upgrading to 11.2.0.4 and slight modification to trigger.
Tags: Database
Similar Questions
-
To avoid the problem of my trigger changing
Hey, guys:
I have a perhaps silly question. I need maintain a table named 'SOR_Email_Config' with a trigger. Whenever there is an event to update a column named "Current_Setting" to "n" 'Y' in a row, this trigger needs to check the other rows in the same table to ensure that Current_Setting of the other lines is 'n', if the other rows 'Y' in the column 'current_setting', the needs of relaxation to update to 'n'. the code is as follows:
Of course, I had a problem of mutation, then how can I implement this trigger to avoid any problem of mutation?CREATE OR REPLACE TRIGGER SOR_NOTI_CONFIG_UPDATE_TRG BEFORE INSERT OR UPDATE OF CURRENT_SETTING ON SOR_EMAIL_CONFIG FOR EACH ROW WHEN (new.current_setting='Y') BEGIN update SOR_EMAIL_CONFIG set current_setting='N'; END;
Thanks in advance
SamHello Sam,.
you are posting in the wrong forum, because this one is for the SQL program, tool and not for general questions of SQL.
That said, you can try the autonomous operations, but this could lead to blockages and other bad things.Hope that helps,
dhalek -
Parameters of DVD/CD region change problem
I have a laptop HP with a master CD/DVD Toshiba MK 8025GAS player with the slave TSST Corp CD/DVD TS-L532M
I can't change the region settings, as says I have 1 change left, but when I try to change the region setting 1 to 4 in the region, I get the response "unable to update region setting. Make sure the drive contains a region 4 media and you have administrator privileges.
Can you please advise me what can I do about it? Thank you.At first, I must say that the notebook manufacturer is responsible for all of your problems laptop and no manufacturer for each component material.
I have Toshiba laptop and inside is Samsung HDD. If I have problems with it I n t Samsung but Toshiba contact.
You know what I mean?Back to your question: do you have (your account) of administrator privileges?
-
Password changer problem; I forgot the password computer
I could not in my computer I have apparently you have forgotten the password. However, I have now spent online from my husbands computer and changed three times and he agreed each time but my computer still won't let me.
? I could not in my computer I have apparently you have forgotten the password. However, I've now spent online from my husbands computer and changed three times and it has been accepted every time, but my computer still won't let me. WTF?
Hello
This is how to fix the problems of passwords in Windows 7, which are the Forums that you send messages to.
http://support.Microsoft.com/kb/940765
If you are unable to connect to Windows 7 or Windows Vista, you can use the Windows Vista System Restore feature, or the Windows 7 system restore feature.
- Scenario 1: You recently set a new password for the protected administrator account. However, you don't remember the password.
- Scenario 2: You type the correct password. However, Windows Vista or Windows 7 does not accept the password because the system is damaged.
- Scenario 3: You delete a protected administrator account. Now, you cannot connect to another administrator account.
- Scenario 4: You change an administrator account protected with a standard user account. Now, you cannot connect to another administrator account.
"What to do if you forget your Windows password"
http://Windows.Microsoft.com/en-us/Windows7/what-to-do-if-you-forget-your-Windows-password
"If you forget the administrator password, and you do not have a password reset disk or another administrator account, you will not be able to reset the password. If there is no other user account on the computer, you will not be able to log on Windows and you need to reinstall Windows. »
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
http://support.Microsoft.com/kb/189126/en-us
Tools third password
Some third-party companies claim to be able to bypass the password that have been applied to files and features that use Microsoft programs. For legal reasons, we cannot recommend or endorse any of these companies. If you want to help to break or reset a password, you can locate and contact a third party company for this help. You use these third-party products and services at your own risk.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Microsoft prohibits any help given in these Forums for you help bypass or "crack" passwords lost or forgotten.
Here's information from Microsoft, explaining that the policy:
-
I worked on a few T-shirt images where a white character is the base layer, after which the outfits are added to create unique characters. Please see here for example. As you can see the images are very bright, & have this glow to them.
Once completed. I want to keep the Outfit (all layers except the empty character on the base layer) and store it in a separate file. In this way, I have 2 files, a white, and a collection of clothing. Instead of a new file for each group. I know that this is not the end of the world, but it has highlighted a problem for me.
The problem I get is when I stick in file 2. All colors become dull and flat. I tried to import the 1 shade so the colors were there already, but the color change occurs again. Anyone can shed some light as to what I can hurt.
Thanks for your suggestions. I'm sure someone here will see the obvious, where I missed it.
The two files in the same Document Color Mode?
-
Before Update trigger compilation problem
Hello experts! I have a problem compiling of a trigger, that I am creating.
In fact it should be updated INT_INITIAL with the old value of INT_LOCK.
Compilation fails and the debugger triggers an error ORA 01747 (invalid statement for table use, column user etc.)
Do you have an idea of what's wrong with my code?
Kind regardscreate or replace TRIGGER TRIGGER_INT_INITIAL BEFORE UPDATE ON TBL_MATRIX_INTERMEDIATE_RESULT FOR EACH ROW Begin IF NVL(:new.INT_INITIAL, 0) != :old.INT_LOCK THEN UPDATE TBL_MATRIX_INTERMEDIATE_RESULT set :NEW.INT_INITIAL = :old.INT_LOCK; END IF; END;
SEBHi Seb,
You should not be doing an UPDATE, just do an assignment:
create or replace TRIGGER TRIGGER_INT_INITIAL BEFORE UPDATE ON TBL_MATRIX_INTERMEDIATE_RESULT FOR EACH ROW Begin IF NVL(:new.INT_INITIAL, 0) != :old.INT_LOCK THEN :NEW.INT_INITIAL := :old.INT_LOCK; END IF; END; /
Concerning
Peter -
Trigger - SEO problem: old variable
Hi all
is it possible to reference all the lines in the: old variable?
for example:
CREATE OR REPLACE TRIGGER MYSCHEMA. UPDATE_ROW
BEFORE THE UPDATE
ON MYSCHEMA. TEST_1
REFERRING AGAIN AS NINE OLD AND OLD
FOR EACH LINE
DECLARE
BEGIN
INSERT MYSCHEMA. TEST_2
VALUES(*:Old*); -This gives error because I need to refer to the columns, but I would get all the line without the: old.col1,: old.col2 etc.
END;
This trigger should copy the old record before being modified for another table.
Any idea?
Thank youNo.... nothing like: old.row.
In addition...
There really makes no sense to move the the "before" because if the update fails because of oracle constraints will for example to restore changes that could easily be made in the trigger after too.
HTH
-
Quality change / problem of menu bar
Hi, I just started to play with Flex3 today and with AC3 last Friday, so in short, Im new with this.
I've been playing with a few examples and now have a small site with a few basic keys with a bar and just to test the button more and extra. I want to be able to do is change the quality of this choice in the menu bar with the radio buttons. It works, but... When I choose a low quality and after I selected among other items in menu bar (so Site or Information), they are resized! By selecting again shows them correctly again.
I have been looking around, but did not find anything really related to the material. Maybe that I looked in the wrong direction and someone can point me to a website that addresses this problem, but just fix the problem (or bug?) is appreciated also ;)
Thanks in advance!
MartinI fixed it myself, I needed to call initCollections again after the change in quality
-
I write the trigger on database level and trigger works well. Problem occurs during playback
RAISE_APPLICATION_ERROR (-20001, 'dash already generated for the amount of requisition, unauthorized update');
What is the problem?
When I run a manipulation on this table through oracle (9i DS) forms, it gives me the error
+ "40509-oracle error, impossible to update the record." + "
rather than giving me the error below
+ "Dash already generated for the amount of requisition, unauthorized update +.
I mentioned in my trigger.
Kindly solve my problem,
Concerning
Salah
----------------------------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE TRIGGER DBADMIN. BEF_UPD_SCM_REQUISITION_DET
before the update on SCM_REQUISITION_DET
for each line
DECLARE
Number V_INDENT_QTY;
Number V_ISSUE_QTY;
BEGIN
BEGIN
SELECT SUM (NVL(INDENT_QTY,0)-NVL(CANCEL_QTY,0))
IN V_INDENT_QTY
OF SCM_INDENT_DET
WHERE REQ_SNO =: OLD. REQ_SNO
AND REQ_DET_SNO =: OLD. REQ_DET_SNO;
EXCEPTION WHEN OTHERS THEN
V_INDENT_QTY: = 0;
END;
BEGIN
SELECT SUM (NVL(ISSUE_QTY,0))
IN V_ISSUE_QTY
OF SCM_ISSUE_DET
WHERE REQ_SNO =: OLD. REQ_SNO
AND REQ_DET_SNO =: OLD. REQ_DET_SNO;
EXCEPTION WHEN OTHERS THEN
V_ISSUE_QTY: = 0;
END;
IF V_INDENT_QTY > nvl(:new.req_qty,0)-nvl(:new.cancel_qty,0) CAN
RAISE_APPLICATION_ERROR (-20001, 'dash already generated for the amount of requisition, unauthorized update');
ELSIF V_ISSUE_QTY > nvl(:new.req_qty,0)-nvl(:new.cancel_qty,0) CAN
RAISE_APPLICATION_ERROR (-20001, 'show has generated on the requisition amount, unauthorized update');
ON THE OTHER
NULL;
END IF;
END;
----------------------------------------------------------------------------------------------------------------------------------------Hai,
In the ON-ERROR trigger, write,
--------------
THEN IF DBMS_ERROR_CODE = - 20001
SET_ALERT_PROPERTY ('', ALERT_MESSAGE_TEXT, DBMS_ERROR_TEXT);
ON THE OTHER
.................END IF;
-----------------------------
Kind regards
Manu.
If this answer is useful or appropriate, please mark. Thank you.
-
I can't believe I have to this post!
However, I am on OSX 10.11.4 and iTunes 12.4.0.119. We have 2 libraries iTunes for me and for my wife. We both work in the same user. iTunes is usually left braque on my library. iTunes is permanently in the dock. It's on my iMac.
So when my wife wants to update its iPod Nano she still holds the option key while clicking on the iTunes icon. This will open the window to allow him to choose which library to open it with. So far so good. The window appears and she can open iTunes with its library. However, at the same time as she clicks on the icon, the currently active window closes. I checked this and I got Firefox, Mail, calendar, LR 2015 CC, Adobe's DNG Converter as the active window and in each case, it is closed. Apparently not to close the application, so it's probably irritation and not a calamity, but it's really weird. Looks like a bug to me.
My wife didn't need to update his iPod that, often, and I see there was an update to iTunes applied by me on May 17.
Any suggestions?
Thank you.
Any suggestions?
I'm not being dismissive here. Define a separate for her user account and use the change user Fadt for ever between them.
-
Using time events only to trigger changes in the value
Hello. I have experience with LabVIEW, but not a lot of experience with the structures of the event. Here's my situation:
Let's say I have an entry, X, which comes from an external source. X is essentially random, from-100 to 100. My output will be Y, which will be generated by labview. I want to have an initial value of 0. The first time that X is greater than 10, I want to change to 1 and stay 1 thereafter, until the first time that X becomes greater than 20. The first time that X is greater than 20, I want to spend at 2, and stay to 2 for always regardless of X, until the program ends.
Basically the program will constantly samples X, and when X reaches a certain threshold, it will change and maintain the value of Y until the next threshold is reached.
Any help is appreciated.
Hi WillB123,
See the attached example.
Steve
-
value chain control event does not trigger change
Hello
I am trying to scan a barcode with a barcode usb HID scanner. I use a structure of the event to detect the change in the value of a control of the chain. When I scan the barcode, the chain control updates on the front panel, but the event does not fire until I left on my mouse on the front panel. can someone help? See attached vi
Your barcodes are probably fixed length. When you get an event, check the length. If it corresponds to the length of the barcode, then process the data, otherwise wait for more characters. This can be treated very quickly in the case of the event.
Lynn
-
So I did a boot of the system, because of the error and somehow my drives C and D exchanged letters and now I
a new disc of windows 7 on 'C '... The thing is that I wanted to change it via the Disk Manager, but anything
I try, it ends with the same error: "Incorrect parameter" or however, it is translated into English...
Can someone help me solve this error or find another solution? Thank you very much!
And now I should be able to connect, right? And if not, should I try to make this order on D:\ and try again?
Yes to both questions. And things still aren't then you must accept that your system is completely messed up. You will probably have to reinstall Windows.
-
Windows 7 Administrator password change problem
I have Windows 7 Home premium installed. Recently, strange thing happens on the local administrator account. When I change the admin password, it is accepted and when I log off and try to connect again, the new password does not work. He returned to the former.
Can I use an another user account with administrator right to change the administrator password, it works once with the new password. After I logout of the administrator account and try to connect again, he returned again to the old password.
Any help please.
I am referring to the 'Local Administrator' or "built-in Administrator" account, deleting, so it is not possible.
I tried using another admin account to change it, as stated in my previous post, it worked only once. After that, I have to use the old password to connect!
In Windows 7, all admin level accounts have the same privileges. If the built-in Administrator account is corrupted, then you can use any other admin account.
Is it was my machine then I ran this test:
1 log in under an administrator account.
2. click on the start planet.
3. type cmd.exe in the search box.
4. press on Ctrl + Shift + Enter
5. click on "run as Administrator".
6. type the following commands and press ENTER after each:
NET user administrator 123456(to change the password)
NET user Administrator
(see when the password was changed)
7 restart, and then run the command net user Administrator again and check the date again.
-
List drop-down selection trigger change in the text field
I'm hit a roadblock here. I'm on Adobe Acrobat XI and here's the scenario: I have a list box and a text box.
Drop-down menu field has 3 caps (A, B, C).
If A is selected, the text box = 15 default, but has the ability to change in the text box.
If B or C is selected, the text box = 0 or "by default, but it has the ability to change in the text box.
If I use an if/then with a .value, I'll be able to get the numbers to work, but do not have the ability to edit and keep them there. If I enter another number in another area, the JavaScript code will run and change the text box to 0 or 15.
Any help would be greatly appreciated.
Thank you
Instead to use script logic for the text field, use the drop-down validation script. In this way, that it only will be triggered when you change the value in the drop-down list field, not when you change any field in the file (as the calculation script).
Maybe you are looking for
-
Anyone know if there will be a change to the way punctuation is added with a leading double when you tap on an iPhone? I would really like that it detects the type of sentence I typed and automatically pick the correct punctuation compared to always
-
HP Jet 13-c010nr: bluetooth
Hello Bluetooth. That one can link to the correct time. I thought I had mouse BT but also helmet to discuss during the games lol Miss You Pop!
-
Add Spanish speech recognition
Speech recognition system I'm trying to get Spanish charge as an option in my speech recognition program. I bought the Spanish Office add-in, but I'm lost as to how to download this as an option.
-
We arrived at the office this morning and all the PC (Ctrl Alt Del screen) says that the account has been disabled, and to contact the administrator, we cannot immediately to the prompt etc then we are stuck! Help, please
-
Try to install Service Pack 2 for Windows Vista and it says this "one or more system components that require the service pack are missing" need help?