Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Problema Trigger

  1. #1

    Problema Trigger

    Buongiorno a tutti, passato bene le vacanze??

    Appena tornato vi chiedo subito un aiuto

    Dovrei creare un trigger ma sto impazzendo sulla sintassi da utilizzare!!!

    Il trigger è il seguente:


    CREATE TRIGGER disp_posti
    AFTER INSERT ON prenotation
    FOR EACH ROW
    BEGIN
    UPDATE data.show
    freeseat=freeseat-1
    WHERE show.id_show=prenotation.id_show
    END;
    Ho visto poi che si utilizza un certo "delimiter" ma non ho ben capito come funziona e soprattutto, nonostante l'abbia inserito all'interno dell' input, mi da l'errore e non mi crea il trigger!

    Sto usando phpMyAdmin per scrivere le query!

    Grazie per l'attenzione

  2. #2
    Sarò più chiaro, l'errore che mi da è il seguente:

    Errore

    Pare che ci sia un errore nella query SQL immessa. L'errore del server MySQL mostrato qui sotto, se c'è, può anche aiutare nella risoluzione del problema

    ERROR: Stringa di Punctuation Sconosciuta @ 11
    STR: //
    SQL: DELIMITER //
    CREATE TRIGGER disp_posti
    AFTER INSERT ON prenotation
    FOR EACH ROW BEGIN
    UPDATE data.show
    freeseat=freeseat-1
    WHERE show.id_show=prenotation.id_show
    END;//
    DELIMITER //
    CREATE TRIGGER disp_posti
    AFTER INSERT ON prenotation
    FOR EACH ROW BEGIN
    UPDATE data.show
    freeseat=freeseat-1
    WHERE show.id_show=prenotation.id_show
    END;//
    DELIMITER //
    CREATE TRIGGER disp_posti
    AFTER INSERT ON prenotation
    FOR EACH ROW BEGIN
    UPDATE data.show
    freeseat=freeseat-1
    WHERE show.id_show=prenotation.id_show
    END;//



    query SQL:

    DELIMITER // CREATE TRIGGER disp_posti AFTER INSERT ON prenotation FOR EACH ROW BEGIN UPDATE data.show freeseat=freeseat-1 WHERE show.id_show=prenotation.id_show END;//

    Messaggio di MySQL: Documentazione
    #1064 - 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 '=freeseat-1
    WHERE show.id_show=prenotation.id_show
    END' at line 5

  3. #3

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.