Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle 11g LIMIT 10000 OFFSET 0 (ActiveRecord::StatementInvalid) #150

Open
sanjusoftware opened this issue Jul 26, 2017 · 1 comment
Open

Comments

@sanjusoftware
Copy link

Trying to connect to Oracle 11g database using following Gemfile:

source 'https://rubygems.org'

gem 'mongify', '~> 1.3.1'
gem 'ruby-oci8'
gem 'activerecord-oracle_enhanced-adapter'

My translation looks like following:

table "pcm_customer" do
  column "id", :key
  column "customerid", :key
  column "customertype", :string
  column "created_at", :datetime
  column "updated_at", :datetime
end

table "pcm_custidcard", :embed_in => :customers, :on => :customerid do
  column "id", :key
  column "customerid", :integer, :references => :customers
  column "published_at", :datetime
  column "created_at", :datetime
  column "updated_at", :datetime
end

Running the following command:

mongify pr database.config translation.rb

and I get the following error:

stmt.c:243:in oci8lib_230.bundle: OCIError: ORA-00933: SQL command not properly ended: SELECT * FROM pcm_customer LIMIT 10000 OFFSET 0 (ActiveRecord::StatementInvalid)

Oracle 11g does not support LIMIT / OFFSET like above, so the error is understandable. However, I looked a lot suspecting that I was using some wrong version of the oracle-enhanced-adapter or something. But turns out, its hardcoded here: in mongify-1.3.1/lib/mongify/database/sql_connection.rb:103

Since you are using ActiveRecord to handle database queries etc, is there a particular reason why you are not letting ActiveRecord to also make the statement as well? Because this implementation is
very specific and will not work in situations like this.

Also, in the meanwhile, is there a way that I can override it?

@anlek
Copy link
Owner

anlek commented Aug 28, 2017

@sanjusoftware Currently you'd have to fork the project, modify the code and run it from your own fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants