Home » SQL & PL/SQL » SQL & PL/SQL » Stored Procedure in migrating data (oracle 11.2.0.3)
Stored Procedure in migrating data [message #644066] Tue, 27 October 2015 14:23 Go to next message
amy.wilson
Messages: 39
Registered: September 2015
Location: Www
Member
Hi All,

We are working on Oracle 11.2.0.3.

We are migrating data from Siebel to SFDC.

In this process we have created database tables in SFDC. But some columns are missing and some columns are not matched in SFDC.

Now we would like to write a Stored procedure to migrate data from Siebel to SFDC.

But here my query is, how can we write a stored procedure which will convert the columns data and from SIEBEL to SFDC and how can we map the data and load the data without having insufficient columns and their respective data.?

As am aware we can load the data if we have similar number of columns and data types by using UTL files/collections. But am not aware how can we load the data in the above siutation

Can any one please advise.

Thanks,

Re: Stored Procedure in migrating data [message #644067 is a reply to message #644066] Tue, 27 October 2015 14:33 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
https://community.oracle.com/thread/3817605

you should post this on Salesforce forum.

https://www.google.com/webhp?hl=en&tab=ww#hl=en&q=salesforce+forum
Re: Stored Procedure in migrating data [message #644147 is a reply to message #644067] Wed, 28 October 2015 09:49 Go to previous messageGo to next message
amy.wilson
Messages: 39
Registered: September 2015
Location: Www
Member
Here I would like to know am trying to load data from one table to another table. But there is mismatch in data types and sizes. In this case how can we convert the data types and data sizes.

If columns in two tables have same data type and same size we can directly use INSERT into table ( columns) select (column list.)

Can you advise how can we convert the data types and sizes and how can we load the data from one table to another table.

Appreciate your help.
Re: Stored Procedure in migrating data [message #644148 is a reply to message #644147] Wed, 28 October 2015 09:55 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
amy.wilson wrote on Wed, 28 October 2015 07:49
Here I would like to know am trying to load data from one table to another table. But there is mismatch in data types and sizes. In this case how can we convert the data types and data sizes.

If columns in two tables have same data type and same size we can directly use INSERT into table ( columns) select (column list.)

Can you advise how can we convert the data types and sizes and how can we load the data from one table to another table.

Appreciate your help.


answer depends upon specifics of both source & target columns.

If source column is VARCHAR2(30) & target column is CHAR(20), then possible insurmountable problem exists
Re: Stored Procedure in migrating data [message #644149 is a reply to message #644148] Wed, 28 October 2015 10:04 Go to previous messageGo to next message
amy.wilson
Messages: 39
Registered: September 2015
Location: Www
Member
Yes.

This is one case I have and in another case,

I have Varchar2(28) in source but in target is Number(12) ( for ID column)

like this I have some cases. In this case can any one advise how can we do conversion and then how can we load the data?

Please advise me the method we need to follow.

Thanks
Re: Stored Procedure in migrating data [message #644150 is a reply to message #644149] Wed, 28 October 2015 10:12 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
SELECT COUNT(*), LENGTH(VARCHAR_28_COL) FROM SOURCETABLE GROUP BY LENGTH(VARCHAR_28_COL) ORDER BY 2;
& hope LENGTH never exceeds 12
Re: Stored Procedure in migrating data [message #644152 is a reply to message #644149] Wed, 28 October 2015 10:24 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Does the varchar contain non-numeric data?
Does it contain data longer than 12 chars?

If the answer to both of those is no then a simple to_number is all you need.
If either is yes then someone needs to define rules for how to the convert the data. We can not help you with that, only some-one familiar with the systems in question can. We can potentially help with how to implement the rules once they are defined.

It still seems to be the case that you're asking your question in the wrong forum.
Re: Stored Procedure in migrating data [message #644153 is a reply to message #644152] Wed, 28 October 2015 10:32 Go to previous messageGo to next message
amy.wilson
Messages: 39
Registered: September 2015
Location: Www
Member
I think am asking the question in the right forum.

Because am asking about the data load from one to other tables with columns have different data types and data sizes.

you please ignore what are the systems am working on.

The data in teh column , some values are 16 characters and some are more than 27.

We have no rules why they defined varchar2 in one system and why it's number in another system. But our goal is to keep same data type and same data size in both the systems. and need to load the data successfully with out fail.

your suggestions would be appreciated.
Re: Stored Procedure in migrating data [message #644154 is a reply to message #644153] Wed, 28 October 2015 10:48 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can't stick a 27 character string in a number(12). At all. Ever.
So either you change the size/type of the number(12) so it can hold the data from the old system or you define some rules for data conversion.
Re: Stored Procedure in migrating data [message #644185 is a reply to message #644153] Thu, 29 October 2015 07:00 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
amy.wilson wrote on Wed, 28 October 2015 10:32
...

The data in teh column , some values are 16 characters and some are more than 27.

We have no rules why they defined varchar2 in one system and why it's number in another system. But our goal is to keep same data type and same data size in both the systems. and need to load the data successfully with out fail.

your suggestions would be appreciated.


No one is talking about rules of WHY the data is the way it is. It is what it is. No, the "rules" people are talking about are business rules about how you are going to convert, say, [siebel.empid varchar2(10)] to [sfdc.emipd number]. Let's say a typical siebel.empid has a value of 'AC-123-XY'. You will need to define a rule on what numeric value you want that to become when you put it in sfdc.empid. And it might not be as simple as 'strip out the non-numeric characters'. What if you have values 'AC-123-XY' and 'BD-123-YZ'? As was pointed out in your thread on this same subject on the OTN forum, there will be no substitute for the manual work of identifying EVERY column in BOTH systems, mapping them from one system to the other, and defining a local business rule for each. We can help with the technique, but only you can do the analysis and rule defintion.
Re: Stored Procedure in migrating data [message #644203 is a reply to message #644185] Fri, 30 October 2015 03:39 Go to previous message
javon13
Messages: 17
Registered: October 2015
Junior Member
Hi, besides business rules which EdStevens mentioned and which makes this migration non-trivial thing, it is good to put another question. How much data do you need to migrate and how fast. In general, there are faster ways how to migrate data. You can use insert..select statements and make all transformations there using just functions like case, decode, nvl. This approach is pretty fast.
If you need to use procedures I recommend use bulk collect altogether.
Previous Topic: Sending SMS through Oracle Database
Next Topic: query
Goto Forum:
  


Current Time: Wed Apr 24 22:30:39 CDT 2024