To make a new istance of an Oracle table with Rails, i need that this table had a column named ''id''. This ''id'' must be Primary Key & auto_increment;. How Can I modify the ''id'' properties to do it Auto_increment in Oracle? -- Posted via http://www.ruby-forum.com/.
Hi Ivan, In Oracle you need to tie a trigger to a sequence, which in turn is tied to an id field in a table... I use 8i, there may be a better way in later versions. I hope this helps (a little) Mark On 01/03/06, Ivan Medda <avemedda@tin.it> wrote:> To make a new istance of an Oracle table with Rails, i need that this > table had a column named ''id''. This ''id'' must be Primary Key & > auto_increment;. > How Can I modify the ''id'' properties to do it Auto_increment in Oracle? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Mark Panay www.markpanay.com Jargon Free Web Development
Ivan Medda wrote:> To make a new istance of an Oracle table with Rails, i need that this > table had a column named ''id''. This ''id'' must be Primary Key & > auto_increment;. > How Can I modify the ''id'' properties to do it Auto_increment in Oracle?You could try: create table foo (id integer not null, acolumn varchar(10)); create sequence foo_seq; Rails will automatically use foo_seq.nextval as the id when inserting new rows into the foo table. -mark -- Posted via http://www.ruby-forum.com/.