To check whether there is any size mismatch between columns of two tables

Hi,
Here i got two tables T and M where i am going to migrate data from T to M. But before migrating i need to check whether all the data in source table fits into destination table columns. The datatypes of all columns in source table T is of Varchar2 only as it is a temp table.
Ex :- Table 'T' (Source table) with columns
T_Lat Varchar2(50);
T_Amt Varchar2(50);
T_Cat Varchar2(50);
T_Vat Varchar2(50);
Now I have another table 'M'(Destination Table) with columns
M_Lat Varchar2(50);
M_Amt varchar2(25);
M_Cat date;
M_Vat number;
Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any size mismatch). This check should be done dynamically.
For suppose, in T_Amt(source column of T table) if text is abt 50 characters, it cant fit M_Amt(destination column of M table). In this case it should throw an error indicating that destination column size is less for the source column.
Note:- There is no unique mapping column for these two tables and there are about 400 columns in the source table to be validate
I think it can be done using arrays or plsql tables.
Can any one help in this regard.

>
Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any size mismatch). This check should be done dynamically.
>
Just because the source table T_Amt column is defined as 50 doesn't mean any of the data is really that long. So the data itself needs to be checked. That is just what a simple query can do.
See my answer in this thread Posted: Jul 25, 2012 1:14 PM
Re: Help in Execute Immediate - Invalid relational Operator
Here is the modified sample query and results for a query of a clone of the EMP table with some modified data
select count(*) cnt,
       -- job column
       sum(case when job is null then 1 else 0 end) job_nul,
       sum(case when job = 'SALESMAN' then 1 else 0 end) job_salesman,
       min(length(job)) job_minlength, max(length(job)) job_maxlength,
       min(job) job_min, max(job) job_max,
       -- hiredate colulmn
       sum(case when hiredate is null then 1 else 0 end) hiredate_nul,
       min(hiredate) hiredate_min,
       max(hiredate) hiredate_max
        from emp1
CNT JOB_NUL JOB_SALESMAN JOB_MINLENGTH JOB_MAXLENGTH JOB_MIN JOB_MAX  HIREDATE_NUL HIREDATE_MIN HIREDATE_MAX
14    2       4            5             9             ANALYST SALESMAN 0            9/28/0001    12/3/9999With one query and ONE pass thru the table I was able to get the COUNTs, the MIN and MAX values for each column and the MIN and MAX lengths of the VARCHAR2 columns.
There are 14 total records, 2 where JOB is null, 4 where the JOB is SALESMAN. The MIN length of the JOB data is 5 and the MAX is 9.
Look at the date values. The results tell me I have some problem data.
The length data tells me if I try to put the JOB data into another table I need to define the length as at least 9 or it won't fit.
For your use case you might find that all of the data in the T_Lat column is shorter than 26 and will actually fit into the M_Lat target table column.

Similar Messages

  • To check whether there is any format mismatch between columns of two tables

    Hi,
    I have got a table 'T' (Source table) with columns
    T_Lat Varchar2(50);
    T_Amt Varchar2(50);
    T_Cat Varchar2(50);
    (all these above columns have numeric data)
    Actually, Here I have taken only the columns having numeric data from table 'T'
    Now I have another table 'M'(Destination Table) with columns
    M_Lat number;
    M_AMt number;
    M_Cat number;
    Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any format mismatch). This check should be done dynamically(as there are more than 50 columns in real).
    Note:- There is no unique mapping column for these two tables
    I think it can be done using arrays or plsql tables. But i dont have idea using them.
    Can any one help me in this regard.

    Why, What's wrong with these post and there responce?
    {message:id=10480898}
    {message:id=10472737}

  • To check whether there is any format mismatch between two tables

    Hi,
    I have got a table 'T' (Source table) with columns
    T_Lat Varchar2(50);
    T_Amt Varchar2(50);
    T_Cat Varchar2(50);
    Actually, Here I have taken all the columns from table 'T' having numeric data.
    Now I have another table 'M'(Destination Table) with columns
    M_Lat number;
    M_AMt number;
    M_Cat number;
    Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns respectively (to check whether there is any format mismatch). This check should be done dynamically.
    Note:- There is no unique mapping column for these two tables
    Can any one help in this regard.

    Why dont you Just [url http://docs.oracle.com/cd/B19306_01/server.102/b14231/tables.htm#sthref2223] Insert Data With DML Error Logging 

  • To check whether there is any format mismatch

    Hi,
    I have got a table 'T' (Source table) with columns
    T_Lat Varchar2(50);
    T_Amt Varchar2(50);
    T_Cat Varchar2(50);
    Actually, Here I have taken all the columns from table 'T' having numeric data.
    Now I have another table 'M'(Destination Table) with columns
    M_Lat number;
    M_AMt number;
    M_Cat number;
    Now my task is I have to do a prevalidation of the data in 'T' that whether all the data in those columns will suit for the destination table columns (to check whether there is any format mismatch)
    Note:- There is no unique mapping column for these two tables
    Can any one help in this regard.

    Hi,
    How to see if your data is in the correct format depends on your data.
    In general, see {message:id=3603878}
    For more specific requirements, something more efficient might be possible. For example,
    LTRIM ( t_lat,
          , '0123456789'
          )   IS NULLwill be true if (and only if) t_lat consists entirely of digits (or if t_lat is NULL).
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as INSERT) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    See the forum FAQ {message:id=9360002}

  • Check whether there is any Special Characters in a String ?

    Hi All,
    I am having a very large String. I like to know how to check whether there is any special characters present in a string
    Thanks,
    J.Kathir

    I am having a very large String. I like to
    I like to know how to check whether there is any
    special characters present in a stringAll characters are special in a way. You shouldn't just single a few out because they don't look "normal" to you. Maybe they have golden hearts?

  • How to check whether there are any statistics in a schema or not?

    Hi,
    I was given a task of refreshing sa schema in CRM2 instance from CRM1.
    But I did it with statistics=none.
    ++++
    exp sa/sa@CRM1 OWNER=SA file=CRM1_SA.dmp log=CRM1_SA.log statistics=none buffer=4096000
    imp sa/sa@CRM2 FULL=Y file=CRM2 SA.dmp log=CRM2 SA_IMP.log statistics=none buffer=4096000
    ++++
    Now I want to know
    1.whether I should have done with statistics?
    2.How to compare the statistics of 2 sa schemas in the CRM1 & CRM2 instances?
    Cheers,
    Kunwar

    Now I want to know
    1.whether I should have done with statistics?Statistics gathering can be done after the import is finished and is recommended.
    2.How to compare the statistics of 2 sa schemas in the CRM1 & CRM2 instances?Not sure why you would want to do this.

  • How to know whether there is any change in a transaction in ic webclient

    Hi,
    There is one activity screen in the ic web(CRM 5.0). There is two button(Change, Save , Sendnotification) on that screen.
    Sendnotification: if i click this button then it will check whether there is any change done using  below logic and will send the noti..:
    DATA:lv_transaction   TYPE REF TO if_bol_transaction_context,
    lv_entity       TYPE REF TO cl_crm_bol_entity.
    lv_transaction = lv_btorder->get_transaction( ).
          IF lv_transaction->check_save_needed( ) EQ 'X'.
             then save the changes  and send notification
          ENDIF.
    Question:
    Now i clicked on the Change button and did some changes.Then saved.
    Then again i did some changes, now i clicked on the Sendnotification button.It sent an notification.
    Now i again clicked on the Sendnotification(this time i didnt do any changes), it sent the same notification again.
    So how to know that  actully changes done or not & how to write code if there is no changes?
    During debugging , i found that the method check_save_needed always returns 'X' as long as i am in the chage mode of that activity. As a result if i dont do any changes also in the activity and click the button , it sends the notification.
    please suggest how to restrict  using coding........
    Thanks
    sudhansu

    Not solved.

  • How to check whether there r new txt files in a folder n file creation date

    How to check whether there r new text files in a specified folder and what is the date of creation of the text file.........?

    Hi
    I have been searching for a solution to find the date of creation of a file for over 6 months now but haven't found it. So I presume that it is not possible though I havent found any authentication of my assumption in any document.
    Cheers!
    Shailesh

  • My ipod touch just shows the charge symbol on the screen and i checked whether there is a problem in the charger but it works perfectly on my iphone 4 and when my ipod is connected to the computer itunes is not recognising my device pls help me

    my ipod touch just shows the charge symbol on the screen and i checked whether there is a problem in the charger but it works perfectly on my iphone 4 and when my ipod is connected to the computer itunes is not recognising my device pls help me

    tmplHi pranoop,
    If you are having an issue with your iPod touch not being recognized by iTunes when connected to your Windows computer, I would suggest that you troubleshoot using the steps in this article - 
    iPhone, iPad, or iPod not recognized in iTunes for Windows - Apple Support
    Thanks for using Apple Support Communities.
    Sincerely,
    Brett L 

  • HT4914 Can I use iTunes match if I am not sure whether there are any pirated songs in my library

    Can I use iTunes match if I am not sure whether there are any pirated songs in my library

    iTunes match should work for that. I am assuming your friend gave you some music from a flash drive, and yor not sure if he/sh pirided it or not, and this is understandible. this screen shot should help. I also sugest looking into google play, which is not as convienet as far as combining with iTunes, but is free I bleive.

  • Find whether there is any text frame in given co-ordinates

    Hi there,
    I'm using adobe indesign 2.0.2 and vb 6.
    I want to find whether there is any text frame existing in the given co-ordinates.
    Please help.
    Thanx
    Robin

    You need to tackle this the other way around: get references to all the text frames (on the spread, I suppose) and compare their coordinates with those of interest.
    Dave

  • What is the command to check if there are any active calls before restarting the voice router?

    what is the command to check if there are any active calls before restarting the voice router? thanks

    Hi.
    I can suggest show call active voice or show voice call status or show sip-ua call brief in case of SIP TSP.
    HTH
    Regards.
    Carlo

  • If there is any function module  to compare whether  there is any digit

    Dear all,
    If there is any function module  to compare whether  there is any digit except 0 in a string.....pls provide me

    Hi,
    IYou can use the following logic i guess,
    DATA: w_str TYPE string VALUE '00001'.
    IF w_str CN '0'. "If there is a digit other than zero thjis is true
      WRITE: / 'There are digits other than zero'.
    ENDIF.
    Hope this helps you.
    Regards,
    Manoj Kumar P

  • How to check if there is any problem in the interaction center inbox

    hi,
    how to check if there is any problem in the interaction inbox for recieving the attachments/cic0
    some users who are sending withattachments is not able to reach the sap indox./
    but without the attachments the mails are coming
    I want to know how we can able to find out were is the problem.
    thanks in advance
    Prajith P

    hi,
    Any update for the above query.
    Thanks & Regards
    Prajth P

  • Applescript to check if there are any events today

    I'm wondering if there's an easy way to use Applescript to just check if there is any event in a certain calendar for the current day.

    Actually, I managed to get it with some tinkering. I had issues at first with it not being able to find all day events (as it was getting the current time and all day events start at 12:00:00 AM) but I fixed that by putting the date in a string with a manually defined time of 12:00:00, converting it back to a date and using that. Here's the code:
    set {year:y, month:m, day:d, weekday:wd} to (current date)
    set str to (wd as string) & ", " & (d as string) & " " & (m as string) & ", " & (y as string) & " 12:00:00 AM"
    set today to date str
    set tomorrow to today + 60 * 60 * 24
    tell application "Calendar"
              tell calendar "Personal"
                        set curr to every event whose start date is greater than or equal to today ¬
                                  and start date is less than or equal to tomorrow
              end tell
    end tell

Maybe you are looking for

  • Access c library w/o using JNI

    I have a compiled shared library from vendor with no access to the source that is needed to interact with our Java code. I do have access to the library function definitions. Is there a way to utilize the "extern" functions from the compiled library

  • Why would white space and line breaks in sql query increase runtime

    Using 11.2.0.3.0 on unix sprac server, 8 cpus 32 cores 12TB storage. We have 16 batch servers doing inserts and ~100 users doing mostly queries. We have a wierd issue,  we have a long query that takes 30 seconds to run 1st time then 10-20 secs every

  • Email shold be sent after locking an entry

    hi everyone,    I am new to HR HCM Developments. I have configured bank information service in portal. When user creates new entry it should get locked and one mail should be sent to administrator. So i implemented a badi to lock the entry. But i am

  • To move Interfaces from dev to prd/qas

    Hi Experts, I have created interfaces in XI developement system  and now want to move it QAS and PRD system How should  i go for that....do we need to define business system for QAS and PRD and make all the configuration in ID  again ? Thanks in adva

  • From a small publisher.

    I own a Sony reader, Nook and Kindle. My published EBooks sell at B&N and Amazon, I would like to sell them at Sony's Estore. The problem is that Sony is small publisher or author hostile in its business setup. Smashwords conversion while nice is als