Hi Igor, thanks a lot this is not working with BEGIN and AND:

/fs/sda0/opt/mm/bin/qdbc -dmme "CREATE TRIGGER genre_custom_insert AFTER
INSERT ON library_genres BEGIN INSERT INTO genre_custom(genre_id, genre,
type) VALUES(NEW.genre_id, NEW.genre, (select type from podcasts_custom
where NEW.genre in (SELECT podcast FROM podcasts_custom))) END"

hu-intel:/dev/shmem> /fs/sda0/opt/mm/bin/qdbc -dmme "CREATE TRIGGER
genre_custom
_insert AFTER INSERT ON library_genres BEGIN INSERT INTO
genre_custom(genre_id,
genre, type) VALUES(NEW.genre_id, NEW.genre, (select type from
podcasts_custom w
here NEW.genre in (SELECT podcast FROM podcasts_custom))) END"
qdbc: unable to execute - near "END": syntax error

Can you tell me what the problem is?

2011/1/1 Igor Tandetnik <[email protected]>

> Stephan Hüls <[email protected]> wrote:
> > Hi, I want to create a trigger when db is running after detecting backup
> is
> > older then actual version.
> > Its working by createing new schema:
> >
> > CREATE TRIGGER genre_custom_insert AFTER INSERT ON library_genres
> >  BEGIN
> >         INSERT INTO genre_custom(genre_id, genre, type)
> > VALUES(NEW.genre_id, NEW.genre, (select type from podcasts_custom where
> > NEW.genre in (SELECT podcast FROM podcasts_custom)));
> >   END;
> >
> > Next line is not working:
> >
> > /fs/sda0/opt/mm/bin/qdbc -dmme "CREATE TRIGGER genre_custom_insert AFTER
> > INSERT ON library_genres INSERT INTO genre_custom(genre_id, genre, type)
> > VALUES(NEW.genre_id, NEW.genre, (select type from podcasts_custom where
> > NEW.genre in (SELECT podcast FROM podcasts_custom)))"
> >
> > What is the problem? How can I generate a sql command from schema syntax
> is
> > there someting wrong with BEGIN and END?
>
> There's nothing wrong *with* BEGIN and END. But there's something wrong
> *without* them. They are required by CREATE TRIGGER syntax, but your second
> statement lacks them.
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to