gpatino
2006-Dec-15 17:00 UTC
Newbie: Invalid number dealing with Identity columns in Oracle
Hi all, I wonder how can I solve in RoR the problem of accessing a simple table because the URL http://localhost:3000/customers/show/2.0 is raising an Oracle error OCIError: ORA-01722: invalid number. The reason of this error is because the SELECT statement generated by ActiveRecord tries to invoke the id column as a VARCHAR : "... FROM customers WHERE customers.id = ''2.0'' " How this can be solved? Thank you in advance for your help. Gregorio --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Remko
2006-Dec-15 18:11 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
It looks like you are trying to match an integer (INT) with a text string (VARCHAR) and that is what Oracle is complaning about. You should drop the quotes in the select statement. /Remko. gpatino wrote:> Hi all, > > I wonder how can I solve in RoR the problem of accessing a simple table > because the URL > > http://localhost:3000/customers/show/2.0 > > is raising an Oracle error OCIError: ORA-01722: invalid number. > > The reason of this error is because the SELECT statement generated by > ActiveRecord tries to invoke the id column as a VARCHAR : > > "... FROM customers WHERE customers.id = ''2.0'' " > > How this can be solved? > > Thank you in advance for your help. > > Gregorio--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gpatino
2006-Dec-15 19:47 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
Hi Remko, But the problem is that I am using the Rails scaffold, so I don''t have control of the ActiveRecord statements, and I am pretty sure that my id column is a number (and my table, columns are named as the RoR documentation suggests). This is my first experience with RoR and Oracle, and I would like to know if someone, trying to implement a basic CRUD application using an Oracle Database, a simple table and a sequence, have solved. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bruce Woodward
2006-Dec-15 20:08 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
When did the params[:id] before a float ??? Shouldn''t that be; http://localhost:3000/cusomters/show/2 not http://localhost:3000/customers/show/2.0 On 12/16/06, gpatino <gpatino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > http://localhost:3000/customers/show/2.0 > > is raising an Oracle error OCIError: ORA-01722: invalid number. > > "... FROM customers WHERE customers.id = ''2.0'' " >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gregorio Alejandro Patiño Zabala
2006-Dec-15 20:25 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
Hi Bruce, You''re right, It''s supposed to be "http://localhost:3000/cusomters/show/2" But, I am just trying to implement my first RoR application against an Oracle DB. So, I don''t know why the Rail scaffold is generating my application implementing my Id as a VARCHAR, it should be a NUMBER. My question is how to solve the problem within my generation process ( I mean the only things I have made are: installing the oci8 gem, generate my app and then use the rails scripting to get my customers CRUD...) Thanks again for your help... 2006/12/15, Bruce Woodward <bruce.woodward-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > > When did the params[:id] before a float ??? > Shouldn''t that be; > http://localhost:3000/cusomters/show/2 > not > http://localhost:3000/customers/show/2.0 > > On 12/16/06, gpatino <gpatino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > http://localhost:3000/customers/show/2.0 > > > > is raising an Oracle error OCIError: ORA-01722: invalid number. > > > > "... FROM customers WHERE customers.id = ''2.0'' " > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bruce Woodward
2006-Dec-15 20:45 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
Are you saying that then you ran your migration code, rails created the id column with a type of varchar ? On 12/16/06, Gregorio Alejandro Patiño Zabala <gpatino-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Bruce, > But, I am just trying to implement my first RoR application against an > Oracle DB. > So, I don''t know why the Rail scaffold is generating my application > implementing my Id as a VARCHAR, it should be a NUMBER. My question is how > to solve the problem within my generation process ( I mean the only things I > have made are: installing the oci8 gem, generate my app and then use the > rails scripting to get my customers CRUD...)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
gpatino
2006-Dec-15 20:46 UTC
Re: Newbie: Invalid number dealing with Identity columns in Oracle
Hi all, It was solved. It was and NLS issue, but it could happen to you if you are not located in the US. We have to be sure that the way that RoR is generating the numbers, dates and so, are compliant with the NLS settings of the target database. Thank you all for your time and help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---