# Using Oracle without sequences

**URL:** <https://discuss.rubyonrails.org/t/using-oracle-without-sequences/12462>\
**Category:** rubyonrails-talk\
**Created:** [May 3, 2007, 9:33am UTC](https://discuss.rubyonrails.org/t/using-oracle-without-sequences/12462 "2007-05-03T09:33:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boemitsu](https://avatars.discourse-cdn.com/v4/letter/b/a4c791/32.png) [@boemitsu](https://discuss.rubyonrails.org/u/boemitsu)\
**Post date:** [May 3, 2007, 9:33am UTC](https://discuss.rubyonrails.org/t/using-oracle-without-sequences/12462/1 "2007-05-03T09:33:34Z")

</div>

Hi all,

I have to set the primary key myself and not use sequences in an Oracle schema

In [http://thread.gmane.org/gmane.comp.lang.ruby.rails/118516](http://thread.gmane.org/gmane.comp.lang.ruby.rails/118516) someone writes,

"Correct, that's the expected/correct behavior -- so long as you define the PK properly, and set it yourself, it won't try to use a sequence."

I have

CREATE TABLE d\_simulationproducts ( &nbsp;&nbsp;id NUMBER(38,0) NOT NULL, &nbsp;&nbsp;simulationproducttype VARCHAR2(50) DEFAULT NULL NULL, &nbsp;&nbsp;position NUMBER(38,0) DEFAULT NULL NULL, &nbsp;&nbsp;productcategory VARCHAR2(50) DEFAULT NULL NULL, &nbsp;&nbsp;simulationproductname VARCHAR2(255) NULL, )

ALTER TABLE d\_simulationproducts &nbsp;&nbsp;ADD PRIMARY KEY ( &nbsp;&nbsp;&nbsp;&nbsp;id &nbsp;&nbsp;)

> > SimulationProduct.columns

=\> [#\<ActiveRecord::ConnectionAdapters::OracleColumn:0x52bf750 @primary=true, @scale=0, @name="id", @null=false, etc...\>

and do not override the id accessor in my model, nor manipulatig set\_sequence\_name

When I try following in the console

SimulationProduct.create(:id=\>1000)

it raises me the error : OCIError: ORA-02289: sequence does not exist

What am I doing wrong ?

Any hint is really appreciated, Michael
