Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Sqoop import from Oracle for numbers with more than 38 digits

Sqoop import from Oracle for numbers with more than 38 digits

New Contributor

Hi everybody,

 

I'm trying to import into Hive several Oracle tables using Sqoop. These tables have some columns, with NUMBER datatype, that contains numbers with more than 38 digits (e.g. 359348581549148849670250346862698439865). Now:

  • If I force the Sqoop datatype, for those columns, as DECIMAL the columns are NULL because the number of digits exceed the maximum precision (38). 
  • If I force the Sqoop datatype, for those columns, as STRING or DOUBLE, the numbers will appear in exponential notation (e.g. 3.5934858154914885E38 ).

I can think of a couple of workarounds (e.g. casting those columns as VARCHAR2(40) in the Sqoop source query), but they'll complicate considerably my scripts. Is there a simple way to import such columns in a way that preserves the original appearance?

 

Thanks!

2 REPLIES 2
Highlighted

Re: Sqoop import from Oracle for numbers with more than 38 digits

Guru
@MrCarlo ,

Have you tried to create a VIEW on top of the table in Oracle and then import the VIEW instead? It is supported in Sqoop as mentioned below:
http://sqoop.apache.org/docs/1.4.6/SqoopUserGuide.html#_selecting_the_data_to_import

Cheers
Eric
Highlighted

Re: Sqoop import from Oracle for numbers with more than 38 digits

New Contributor

@EricL , thanks for the reply. I don't have the permissions to create views on the source system. I think, I'm going to try the "CAST" approach.

 

Thanks!

Don't have an account?
Coming from Hortonworks? Activate your account here