#29170: Oracle - Unable to add triggers in migrations, semicolon removed.
-------------------------------------+-------------------------------------
Reporter: Danny Willems | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle trigger | Triage Stage:
database | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by felixxm):
🤔 `ORA-24373` cannot be related with the reported issue. If you pass a
trigger statement with trailing `/` , than `_fix_for_params` returns the
same statement as in the ticket description
{{{
>>> from django.db import connection
>>> from django.db.backends.oracle.base import
FormatStylePlaceholderCursor
>>> create_trigger_insert_entry = """
CREATE OR REPLACE TRIGGER UPDATE_BALANCE
AFTER DELETE OR INSERT OR UPDATE OF AMOUNT ON ENTRY
BEGIN
UPDATE ACCOUNT_BALANCE B
SET (B.BALANCE, B.ACCOUNT) = (SELECT SUM(AMOUNT) sum_amount, account
FROM ENTRY e WHERE e.ACCOUNT = B.ACCOUNT
GROUP BY ACCOUNT)
WHERE EXISTS (SELECT 1 FROM ENTRY e WHERE e.ACCOUNT = B.ACCOUNT);
END;
/"""
>>> query, _ =
FormatStylePlaceholderCursor(connection)._fix_for_params(create_trigger_insert_entry,
[])
>>> print(query)
CREATE OR REPLACE TRIGGER UPDATE_BALANCE
AFTER DELETE OR INSERT OR UPDATE OF AMOUNT ON ENTRY
BEGIN
UPDATE ACCOUNT_BALANCE B
SET (B.BALANCE, B.ACCOUNT) = (SELECT SUM(AMOUNT) sum_amount, account
FROM ENTRY e WHERE e.ACCOUNT = B.ACCOUNT
GROUP BY ACCOUNT)
WHERE EXISTS (SELECT 1 FROM ENTRY e WHERE e.ACCOUNT = B.ACCOUNT);
END;
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29170#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.6912123489b725c1a2a6571f5bff6c8c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.