Same again: you need to run the generated SQL script (like last time) to create the sequence in the database.
In general, you need to do this whenever your table/sequence schema changes. In the case where you just add tables or sequences, running the SQL file again suffices. If you've modified the layout of a table, you might need to manually drop the table first. If you want to modify a table while keeping the existing data... well, I'm sure there's a way, but I don't know what it is. On Friday, April 1, 2016, Yves Cloutier <[email protected]> wrote: > Hello, > > I would like to refactor some code to use a sequence instead of manually > incrementing a counter to serve as a unique db table index. > > Following an example, I simply did: > > ... > sequence expId > ... > > Then when I want to increment: > > ... > nextId <- nextval expId; > ... > > I recompile, but when I execute I get the following error: > > Fatal initialization error: Sequence 'uw_Portfolipro_expId' does not exist. > > IS there something else that I need to do, create or initialise in order > to use sequences? > > Below is my full code: > > table experienceTable : { Id : int, Description : string} > PRIMARY KEY Id > > sequence expId > > fun refresh () = > rows <- queryX (SELECT * FROM experienceTable) > (fn row => <xml><tr> > <td>{[row.ExperienceTable.Id]}</td> > <td>{[row.ExperienceTable.Description]}</td> > <td><form><submit action={deleteExperience > row.ExperienceTable.Id} value="Delete"/></form></td> > </tr></xml>); > return <xml> > <table border=1> > <tr> <th>Id</th> <th>Description</th></tr> > {rows} > </table> > > <br/><hr/><br/> > > <form> > <table> > <tr> <th>Description:</th><td><textbox{#Description}/></td> </tr> > <tr> <th/> <td><submit action={addExperience} value="Add"/></td> > </tr> > </table> > </form> > </xml> > > (* Add a new experience *) > and addExperience experience = > nextId <- nextval expId; > dml (INSERT INTO experienceTable (Id, Description) > VALUES ({[nextId]}, {[readError experience.Description]})); > page <- refresh (); > return <xml><body> > {page} > </body></xml> > > (* Delete a given experience *) > and deleteExperience experienceId () = > dml (DELETE FROM experienceTable > WHERE t.Id = {[experienceId]}); > page <- refresh (); > return <xml><body> > {page} > </body></xml> > > fun main () = > content <- refresh (); > return <xml><body> > {content} > </body></xml> > > > > > >
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
