Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AFTER INSERT Trigger unter mysql

Empfohlene Antworten

Veröffentlicht

Guten Tag,

ich versuche hier unter zuhilfename der mysql-doku die richtige syntax für das erstellen eines AFTER INSERT Triggers zustande zu bringen.

Jedoch könnte ich hierbei noch ein zweites paar Augen gebrauchen die mal den ein oder anderen prüfenden Blick drüberwerfen.

Ich bin mir jetzt nicht sicher was ihm daran nicht gefällt:


CREATE TRIGGER InBuchPl AFTER INSERT ON tbl_buchungen

  FOR EACH ROW BEGIN

    Set @evid = NEW.ed_EvDatenID;

    Set @counter = (Select SUM(ems.tbl_buchungen.bu_GebuchtePlaetze) From ems.tbl_buchungen Where ems.tbl_buchungen.ed_EvDatenID=@evid);

    Update ems.tbl_eventdaten SET ems.tbl_eventdaten.ed_AktTeilnehmer=@counter;

  END;

Die kommandozeile scheint jede einzelne Zeile auszuführen, sprich zusammenhangslos. Siehe hier:

mysql> CREATE TRIGGER InBuchPl AFTER INSERT ON tbl_buchungen

    ->   FOR EACH ROW BEGIN

    ->     Set @evid = NEW.ed_EvDatenID;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that

corresponds to your MySQL server version for the right syntax to use near '' at

line 3

mysql>     Set @counter = (Select SUM(ems.tbl_buchungen.bu_GebuchtePlaetze) From

 ems.tbl_buchungen Where ems.tbl_buchungen.ed_EvDatenID=@evid);

Query OK, 0 rows affected (0.00 sec)


mysql>     Update ems.tbl_eventdaten SET ems.tbl_eventdaten.ed_AktTeilnehmer=@co

unter;

Query OK, 0 rows affected, 1 warning (0.00 sec)

Rows matched: 1  Changed: 0  Warnings: 1


mysql>   END;

Wenn jemand einen rat wüsste wäre ich sehr dankbar.

lg

Gateway

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.