Oracle Trigger issue

2004-08-10
2004-08-15
  • Steve Michael

    Steve Michael - 2004-08-10

    Again, thanks for all the hard work.  But I have hit another small issue. 

    When I generate my Oracle DDL it works great until it hits a trigger.  It never puts a "/"  (without the quotes) at the end of the generated DDL.  So my trigger should end like
    create trigger xxx on yyyy for each row
    begin
      blah blah blah
    end;
    /

    It does not put the / at the end so the DDL blows up when run.

    I have tried to manually put the / at the end but then it adds a ";" after it.  So that doesn't work either.

    Thanks again.

    P.S. I am on Druid 3.5 build 38

     
    • Andrea Carboni

      Andrea Carboni - 2004-08-11

      Do you need a / after the ; ? Another user says that the ; is missing and I'm getting confused a bit.

      Maybe you have changed the terminating char from ; to / but in this case the normal CREATE TABLE statements should not work. Can you provide a more detailed explanation ?

      Cheers,
      Andrea

      PS : the build refers to your project not to druid (that is, how many times you save it).

       
    • Steve Michael

      Steve Michael - 2004-08-11

      I have not changed any default setting in the program.  When I go to create a trigger it automatically puts in a begin and end statement.  That look like:
      BEGIN
          ...
      END

      I then delete out the ... and put in the following
      SELECT product_pk_seq.nextval INTO :new.product_id FROM dual;

      (the sequence is already there and works).

      I then generate the DDL and the DDL looks like:

      REM ----------------------------------------------------------------------

      CREATE TRIGGER Product_PK BEFORE INSERT ON Product
         FOR EACH ROW
      BEGIN
      SELECT product_pk_seq.nextval INTO :new.product_id FROM dual;
      END;

      REM ======================================================================

      It should have a / after the END; So the last line of code that is not a remark should look like
      END;
      /

      Now if I try and put a / in with the trigger the program seems to think it should always append a "';" after my last character so I get something like
      END /;

      I then tried to put a ";" after the end and my generated DDL looked like
      END;
      /;

      Again when a user tries to enter a new trigger it appears that the program will always add a ";" to the end of their statement.  This is ok, but if it does that, in Oracle it should also add a / after the last ";"  My suggestion would be to drop the ";" adding and force the user to enter it.  Just a suggestion though. 

      Thanks again

       
    • Andrea Carboni

      Andrea Carboni - 2004-08-15

      I got it. Thanks.

       

Log in to post a comment.