• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

MySQL triggers: passing a PK to a stored proc on the row that forced trigger?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    MySQL triggers: passing a PK to a stored proc on the row that forced trigger?

    Anyone know of this can be done? I have a trigger...

    Code:
    CREATE TRIGGER
      db.myTrigger
    AFTER UPDATE ON
      db.myTable
    FOR EACH ROW CALL
       myStoredProc() ;
    ...but I want to pass the pk of the row being updated to the stored proc, I though it would work something like this..

    Code:
    CREATE TRIGGER
      db.myTrigger
    AFTER UPDATE ON
      db.myTable table
    FOR EACH ROW CALL
       myStoredProc( table.id ) ;
    ...but computer says no, trigger docs on mySql are not that great as they just introduced the functionality.

    Cheers

    #2
    CREATE TRIGGER
    db.myTrigger
    AFTER UPDATE ON
    db.myTable table
    FOR EACH ROW
    begin
    myStoredProc( NEW.id ) ;
    end;

    Does that not work?
    McCoy: "Medical men are trained in logic."
    Spock: "Trained? Judging from you, I would have guessed it was trial and error."

    Comment


      #3


      Cheers!

      Comment


        #4
        And I don't even do MySQL...I looked it up in my MySQL Cookbook!
        McCoy: "Medical men are trained in logic."
        Spock: "Trained? Judging from you, I would have guessed it was trial and error."

        Comment


          #5
          Originally posted by lilelvis2000 View Post
          And I don't even do MySQL...I looked it up in my MySQL Cookbook!
          My database skills are fairly shocking, I just seem to busk every task I have.

          When I am programming in Java I know exactly what I am writing, the next 20 lines I am going to write and have a rough idea what I am going to be writing on the next hour.

          Stored procs I seem to get by with "I think that might work" "**** it never worked" "how the **** do you debug this thing" "try this" repeated for 8 hours

          Comment

          Working...
          X