# Oracle Bug

**URL:** <https://www.ruby-forum.com/t/oracle-bug/75210>\
**Category:** Rails\
**Created:** [March 1, 2006, 1:43pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210 "2006-03-01T13:43:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 1, 2006, 1:43pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210/1 "2006-03-01T13:43:40Z")

</div>

I’m using 2 database. The first wrote in MySQL and the second in Oracle.  
If i use the command “SET\_TABLE\_NAME” to forge the model to use another  
table, there isn’t no error with MySQL, while with Oracle if i ask the  
view “\_Form.rhtml” The compiler tell me “No sequence in SELECT  
TableName\_seq.nextval id from dual”(???).  
Could someone tell me where is the bug?.  
Could it be a problem into the oci8 library?

Ivan.

---

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 1, 2006, 1:45pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210/2 "2006-03-01T13:45:22Z")

</div>

You need to create an oracle sequence that is named TableName\_seq, that  
should do it.

This is how to create a sequence:

CREATE SEQUENCE TABLENAME\_SEQ INCREMENT BY 1 START WITH 100

Chris

---

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 1, 2006, 4:11pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210/3 "2006-03-01T16:11:33Z")

</div>

Thanks Chris,  
But now the compiler tell me it:

invalid column name: INSERT INTO ago.prova\_stats (cognome, nome, id,  
telefono) VALUES(‘Medda’, ‘Ivan’, :id, 70565611)

where ago.prova\_stats is the table used by me and that have only the  
columns ‘cognome’,‘nome’ and ‘telefono’.  
My table hasn’t the column ‘id’(???).Why Rails search it?  
Ivan.

Chris wrote:

> You need to create an oracle sequence that is named TableName\_seq, that  
> should do it.
> 
> This is how to create a sequence:
> 
> CREATE SEQUENCE TABLENAME\_SEQ INCREMENT BY 1 START WITH 100
> 
> Chris

---

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 1, 2006, 4:56pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210/4 "2006-03-01T16:56:33Z")

</div>

Ok,  
Now the compiler search the ‘id’ column into the table. But tell me it:

invalid column name: select \* from (select raw\_sql\_.\*, rownum raw\_rnum\_  
from (SELECT \* FROM ago.prova\_stats WHERE (ago.prova\_stats.id = ‘1.0’) )  
raw\_sql\_ where rownum \<= 1) where raw\_rnum\_ \> 0

The problem is a bad ‘id’ type? I say Oracle to ALTER the Prova\_stats  
table,to contain the column ‘id’ and i give it the ‘NUMBER’ TYPE.  
Is it correct? I think no.

Chris wrote:

> Create the column ‘id’ and you will be ok.

---

<div class="post-metadata">

**Author:** ![axle988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e47774/32.png) [@axle988](https://www.ruby-forum.com/u/axle988)\
**Post date:** [March 1, 2006, 4:32pm UTC](https://www.ruby-forum.com/t/oracle-bug/75210/5 "2006-03-01T16:32:31Z")

</div>

Create the column ‘id’ and you will be ok.
