# ActiveRecord and legacy oracle tables

**URL:** <https://www.ruby-forum.com/t/activerecord-and-legacy-oracle-tables/116045>\
**Category:** Rails\
**Created:** [October 1, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/activerecord-and-legacy-oracle-tables/116045 "2007-10-01T21:52:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![reacher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reacher](https://www.ruby-forum.com/u/reacher)\
**Post date:** [October 1, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/activerecord-and-legacy-oracle-tables/116045/1 "2007-10-01T21:52:41Z")

</div>

I’m trying to connect to an existing oracle database. Some tables in  
this database do not have a standard “id” field, or any other primary  
keys. As I understand it, I can specify which table a model refers  
to:

class MyModel \< ActiveRecord::Base  
set\_table\_name “t\_mymodel”  
end

However using this method, I cannot perform a save command on my  
model. Attemnpting it yields this error:

ORA-02289: sequence does not exist

I thought by setting the sequence name to an empty string would solve  
it:

class MyModel \< ActiveRecord::Base  
set\_table\_name “t\_mymodel”  
set\_sequence\_name “”  
end

But that yields:

ORA-00936: missing expression

Any assistance would be most appreciative

---

<div class="post-metadata">

**Author:** ![reacher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/0ea827/32.png) [@reacher](https://www.ruby-forum.com/u/reacher)\
**Post date:** [October 1, 2007, 11:57pm UTC](https://www.ruby-forum.com/t/activerecord-and-legacy-oracle-tables/116045/2 "2007-10-01T23:57:07Z")

</div>

You might have luck with this:  
[http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas](http://wiki.rubyonrails.org/rails/pages/HowToUseLegacySchemas)

I’m doing some Rails work with some legacy Oracle tables but right now  
I’ve only been reading data and not writing…

Good luck!

Reacher wrote:

> I’m trying to connect to an existing oracle database. Some tables in  
> this database do not have a standard “id” field, or any other primary  
> keys. As I understand it, I can specify which table a model refers  
> to:
> 
> class MyModel \< ActiveRecord::Base  
> set\_table\_name “t\_mymodel”  
> end
> 
> However using this method, I cannot perform a save command on my  
> model. Attemnpting it yields this error:
> 
> ORA-02289: sequence does not exist
> 
> I thought by setting the sequence name to an empty string would solve  
> it:
> 
> class MyModel \< ActiveRecord::Base  
> set\_table\_name “t\_mymodel”  
> set\_sequence\_name “”  
> end
> 
> But that yields:
> 
> ORA-00936: missing expression
> 
> Any assistance would be most appreciative
