OCIError: ORA-00904: "FALSE": invalid identifier:

1,043 views
Skip to first unread message

samt

unread,
Sep 7, 2012, 11:39:34 AM9/7/12
to oracle-...@googlegroups.com
Hi I'm getting the following error:
OCIError: ORA-00904: "FALSE": invalid identifier: INSERT INTO "XXXXX"."LISTING" ("INT_CON_ID", "VAR_NAME") VALUES (:a1, :a2) RETURNING "FALSE" INTO :returning_id

class Listing < ActiveRecord::Base
    self.table_name = ' xxx.listing'
    self.primary_key = false
end

I've tried the following: 
Listing.create({:int_con_id => 5, :var_name => 'BETTER' })

This is a legacy oracle database. also tried .new(xx) and lot's of other combinations but still the same error. Any help would be appreciated. If I'm doing a find then this works...

Sam

samt

unread,
Sep 12, 2012, 1:30:40 PM9/12/12
to oracle-...@googlegroups.com
Has anyone had the same issues or can help??

Yavor Nikolov

unread,
Sep 12, 2012, 2:05:06 PM9/12/12
to oracle-...@googlegroups.com
Hi Sam,

What are you trying to achieve? (And in particular - what do you expect from this self.primary_key = false assignment)?

I'm quite new to ActiveRecord but looking at some ActiveRecord usage examples and docs I have a feeling primary_key expects table column name. Do you really have a column named FALSE in your table?

Yavor

--
You received this message because you are subscribed to the Google Groups "Oracle enhanced adapter for ActiveRecord" group.
To view this discussion on the web visit https://groups.google.com/d/msg/oracle-enhanced/-/Fj94XUOP7lEJ.

To post to this group, send email to oracle-...@googlegroups.com.
To unsubscribe from this group, send email to oracle-enhanc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/oracle-enhanced?hl=en.

Jason Lewis

unread,
Sep 12, 2012, 10:22:42 PM9/12/12
to oracle-...@googlegroups.com

I'm guessing the goal here was to express the lack of a PK on the column?

I also have a legacy Oracle db that doesn't universally enforce pk constraints. The best solution I found for this case was to use the composite_primary_keys gem, and then do something like the following:

class Listing < ActiveRecord::Base

  set_table_name "xxx.listing"

  set_primary_keys :int_con_id

  set_sequence_name :autogenerated

end

Using CPK will avoid ActiveRecord disallowing assignment of the PK column, and the use of :autogenerated for the sequence will prevent the adapter from inferring the sequence name. I'm not sure what you were trying to do with `self.table_name`, the class method for setting the table name is set_table_name.


Hope this helps,

Jason

samt

unread,
Sep 27, 2012, 2:53:14 PM9/27/12
to oracle-...@googlegroups.com
Haven't looked at this issue for a while, just used raw sql instead, which in not preferable, but now I've got a response I'll try the suggestions.

I think I originally used set_table_name but had an issue so used self, instead. Will try all suggestions and feed back asap.

Thanks,
Sam
Reply all
Reply to author
Forward
0 new messages