Insert a data in Oracle with Rails

Hi,
I tried many things to insert a data in an Oracle Table, but the Rails
compiler never Works!

I create this Oracle table:

CREATE TABLE “FOO” (
“id” int NOT NULL primary key,
“acolumn” VARCHAR(10) NULL
)

and when i tried to insert a new row the Rails compiler tell me :

OCIError: ORA-00904: invalid column name: INSERT INTO AGO.FOO (acolumn,
id) VALUES(‘pippolo’, :id)

While with MySQL I’ve no problem using the same table!.

I tell to Oracle also :

CREATE SEQUENCE FOO_SEQ INCREMENT BY 1 START WITH 100

or :

CREATE SEQUENCE FOO_sequence
START WITH 1
MAXVALUE 9999
MINVALUE 1
NOCYCLE
CACHE 200
ORDER

But It doesn’t Works!.
Where is the problem??? The column named ‘id’ is necessary with
oracle?And it must be “Auto_Increment”.

Ivan M. wrote:

OCIError: ORA-00904: invalid column name: INSERT INTO AGO.FOO (acolumn,
id) VALUES(‘pippolo’, :id)

CREATE SEQUENCE FOO_SEQ INCREMENT BY 1 START WITH 100

But It doesn’t Works!.
Where is the problem??? The column named ‘id’ is necessary with
oracle?And it must be “Auto_Increment”.

You can name the primary key column whatever you want, but the default
in Rails (not Oracle specifically) is “id”. And as there’s no
“auto-increment” in Oracle, the approach used is a sequence. By default,
that sequence is expected to be named “#{table_name}_seq”.

I suspect the problem you’re having is either the result of unexpected
pluralization (not sure what the plural of “foo” is), or the result of
referencing the table “foo” in the schema “AGO”.

Are you logging into Oracle as the user “AGO”? Where was the sequence
created?