# Using Oracle without sequences

**URL:** <https://www.ruby-forum.com/t/using-oracle-without-sequences/103248>\
**Category:** Rails\
**Created:** [May 3, 2007, 11:34am UTC](https://www.ruby-forum.com/t/using-oracle-without-sequences/103248 "2007-05-03T11:34:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![boemitsu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a4c791/32.png) [@boemitsu](https://www.ruby-forum.com/u/boemitsu)\
**Post date:** [May 3, 2007, 11:34am UTC](https://www.ruby-forum.com/t/using-oracle-without-sequences/103248/1 "2007-05-03T11:34:30Z")

</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 (  
id NUMBER(38,0) NOT NULL,  
simulationproducttype VARCHAR2(50) DEFAULT NULL NULL,  
position NUMBER(38,0) DEFAULT NULL NULL,  
productcategory VARCHAR2(50) DEFAULT NULL NULL,  
simulationproductname VARCHAR2(255) NULL,  
)

ALTER TABLE d\_simulationproducts  
ADD PRIMARY KEY (  
id  
)

> > 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
