0

I am using sqlite 2.8.17 installed on ubuntu lucid ( I used apt-get install sqlite)

I have a college table on which I tried to create a trigger(as mentioned in dbclass.org video)

create trigger R4
before insert on College
for each row
when exists (select * from College where cName = New.cName)
begin
  select raise(ignore);
end;

This causes an error

SQL error: near "select": syntax error

the schema for college is

create table College(cName text, state text, enrollment int);
2
  • If you could put it as a reply,I could accept it..:) Commented May 2, 2012 at 12:30
  • 1
    If you insist :) I tried to find an authoritative reference for version 2 but, alas, no joy. I don't know what specific part of that trigger version 2 didn't like. Commented May 2, 2012 at 17:27

1 Answer 1

1

That trigger works just fine with SQLite3. Perhaps version 2 doesn't support when or triggers or has a different syntax for the trigger body. I can't find an authoritative reference for version 2 so I'm guessing.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.