My query is missing the alter number and default... How can I corrected.

USER_A
create table TBL_A (       FIELD_A1 number not null,
FIELD_A2 varchar2(50),
FIELD_A3 date,
FIELD_A4 number(5,2) default 0,
FIELD_A5 varchar2(10) not null
USER_B
create table TBL_A (       FIELD_A1 number not null,
FIELD_A2 varchar2(20),
FIELD_A4 number(5,2) not null,
FIELD_A5 varchar2(10),
FIELD_A6 number(2) not null
I see the result like below after running below query only error is second line and rest is correct so how can I correct second line? :
alter table TBL_A modify FIELD_A5 VARCHAR2  (10)  not null
alter table TBL_A modify FIELD_A4 NUMBER 5, 2) null                    // want to see only this one like alter table TBL_A modify FIELD_A4 NUMBER (5,2) default 0,   rest is correct!
alter table TBL_A modify FIELD_A2 VARCHAR2  (50)  null
alter table TBL_A drop FIELD_A6
alter table TBL_A add FIELD_A3   DATE
MYQUERY:
with src as
  select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale,
        src.nullable src_nullable,decode(T.Constraint_Type,'P', 'Primary Key','U','Unique','') as src_cons
    from  all_tab_columns src
    left join (select Cc.Column_Name,Uc.Constraint_Type
                 from user_cons_columns cc, user_constraints uc
                 where Cc.Constraint_Name = Uc.Constraint_Name
                   and Cc.Table_Name = Uc.Table_Name) t
      on T.Column_Name = Src.Column_Name
   where table_name = 'TBL_A' and owner='USER_A'
tgt as
  select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len,
   tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale, tgt.nullable tgt_nullable,
   decode(T.Constraint_Type,'P', 'Primary Key','U','Unique','') as tgt_cons
    from all_tab_columns tgt
     left join (select Cc.Column_Name,Uc.Constraint_Type
                 from user_cons_columns cc, user_constraints uc
                 where Cc.Constraint_Name = Uc.Constraint_Name
                   and Cc.Table_Name = Uc.Table_Name) t
      on T.Column_Name = tgt.Column_Name
   where table_name = 'TBL_A' and owner='USER_B'
col_details as
  select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name,
         src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable,src_cons,
         tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable,tgt_cons
    from src
    full outer join tgt
      on (
          src.src_col_name = tgt.tgt_col_name
select *
  from (
        select case
                when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or tgt_nullable != src_nullable
                  then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' ' ||
                  case when src_data_type in ('DATE') then null
                       else
                            case
                              when src_data_type in ('VARCHAR', 'VARCHAR2')
                                then ' (' ||nvl(to_char(src_data_len), ' ') || ') '
                              else  decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')')
                            end
                  end
                  ||
                  case when src_nullable = 'Y' then ' null '
                    else ' not null ' end
                  || tgt_cons
                when tgt_col_name is null
                  then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' ||  ' ' || ' ' || src_data_type || ' ' ||
                  case when src_data_type in ('DATE') then null
                       else
                            case
                              when src_data_type in ('VARCHAR', 'VARCHAR2')
                                then '('|| nvl(to_char(src_data_len), ' ') || ') '
                              else  decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')')
                            end
                  end
                || tgt_cons
               when src_col_name is null
                 then 'alter table '|| tgt_table_name ||' drop '||tgt_col_name
               end alter_statement
          from col_details
where alter_statement is not null;

Stop reinventing the wheel. Oracle provides DBMS_METADATA_DIFF package:
SQL> desc u1.tbl_a
Name                                      Null?    Type
FIELD_A1                                  NOT NULL NUMBER
FIELD_A2                                           VARCHAR2(20)
FIELD_A4                                  NOT NULL NUMBER(5,2)
FIELD_A5                                           VARCHAR2(10)
FIELD_A6                                  NOT NULL NUMBER(2)
SQL> desc u2.tbl_a
Name                                      Null?    Type
FIELD_A1                                  NOT NULL NUMBER
FIELD_A2                                           VARCHAR2(50)
FIELD_A3                                           DATE
FIELD_A4                                           NUMBER(5,2)
FIELD_A5                                  NOT NULL VARCHAR2(10)
SQL> select dbms_metadata_diff.compare_alter('TABLE','TBL_A','TBL_A','U1','U2') from dual
  2  /
DBMS_METADATA_DIFF.COMPARE_ALTER('TABLE','TBL_A','TBL_A','U1','U2')
ALTER TABLE "U1"."TBL_A" ADD ("FIELD_A3" DATE)
  ALTER TABLE "U1"."TBL_A" DROP ("FIELD_A6")
  ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50))
  ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0)
  ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A4" NULL)
  ALTER TABLE "U1"."TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE)
SQL>
SY.

Similar Messages

  • I would like to put Dreamweaver 8 on a new computer.  There is no "deactivate" function and the technical support person I chatted with recommended I come here.  Can I just use the serial number again?  How can I deactive?  Has anyone else run into this?

      There is no "deactivate" function and the technical support person I chatted with recommended I come here.  Can I just use the serial number again?  How can I deactive?  Has anyone else run into this?  How can I get Dreamweaver 8, which is no longer being activated by Adobe, on a new computer?  Is it even worth doing or do I need to get a new version.  What are the killer features I'm missing?

    If you manage to get it installed on your current OS, don't forget to install the 8.02 update.
    Adobe - Dreamweaver Support Center : Updaters
    Nancy O.

  • I cannot sync my newer contacts I have created on my iPhone to the iCloud so they do not appear in iMessage on my Mac. Only the phone number does. How can I fix this?

    I cannot sync my newer contacts I have created on my iPhone to the iCloud so they do not appear in iMessage on my Mac. Only the phone number does. How can I fix this?

    okay. I looked and my default account and it is my mobile me account... how do I transfer those to the cloud?

  • Somehow a random number appeared on the bottom of all my slides on keynote- it is always the same number regardless of the slide number I am- how can I remove it??

    Somehow a random number (white font on black square) appeared on the bottom of all my slides on keynote… it is always the same number regardless of the slide number I am… how can I remove it??

    Sorry!  I hope I didn't waste anybody's time.  I should have looked first for previous posts and I would have seen other people having the same issue and how they solved it.  Problem solved.  Thanks

  • At my iPhone 4 I missed the App "App store". How can I get the App again???

    At my iPhone 4 I missed the App "App store". How can I get the App again???

    The App Store app cannot be deleted so look for it using Spotlight or manually in all the app pages and folders.
    Also check Settings > General > Restrictions: should be OFF
         iTunes : ON?
         Installing Apps: ON?
         Apps: All?

  • HT201210 I have an Iphone 4 where the imei number is erased, how can I put back on it the imei number

    I have an Iphone 4 where the imei number is erased, how can I put back on it the imei number

    They would have to do more than that to remove or alter the IMEI, or, as brad805 already said, the logic board has been damaged. The person they got if from was probably trying to dump it.

  • I bought a second hand ipad 4 4g the first user forgot the apple id and password, how can i restore the ipad and create a new id and password for it?

    i bought a second hand ipad 4 4g the first user forgot the apple id and password, how can i restore the ipad and create a new id and password for it?

    You cannot get around Activation Lock without the oringinal owner disassociating the iPad from their account.
    See the Activation Lock FAQ for what you and they need to know.

  • I accidentally deleted the program pages and Keynote how can I recover them? in the Apple store they paid steel ...

    I accidentally deleted the program pages and Keynote how can I recover them? in the Apple store they paid steel ...

    Any apps you've had installed on your iPad can be downloaded again.
    Go to App Store on your iPad and select 'Updates' and then tap on Purchased. You can then view all purchases made on the iPad or purchases made on other devices by selecting the 'Not on this iPad' tab.
    Regards,
    Steve

  • HT5621 I have changed my apple id recently and the changes have been reflected on my iPad for both the apps store and the iCloud, however, my iphone still insist on using my old apple id for the iCloud while the app store is fine. how can i correct the pr

    I have changed my apple id recently and the changes have been reflected on my iPad for both the apps store and the iCloud, however, my iphone still insist on using my old apple id for the iCloud while the app store is fine. how can i correct the problem?
    Thanks

    Hi Baem_leeds
    Welcome to the Support Communities!
    If you change your Apple ID you will need to sign in with the new information or password the next time you use an Apple service or feature that uses Apple ID. If you have multiple devices that use features and services that require an Apple ID, you will need to sign in again on each device.
    The links below will provide additional information:
    Where can I use my Apple ID?
    http://support.apple.com/kb/HT5616
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    Cheers,
    Judy

  • TS3274 MY IPAD STATES 'SAFARI CUOLD NOT OPEN THE PAGE BECAUSE THE SERVER STOPPED RESPONDING". HOW CAN I CORRECT THIS?

    MY IPAD STATES " SAFARI COULD NPT OPEN THE PAGE BECAUSE SERVER STOPPED RESPONDING" HOW CAN I CORRECT THIS?

    Sometimes there's a hiccup in the router and resetting the router like diavonex staes will solve the problem.
    Sometimes though, the website you are trying to visit has an internal problem with its server. In that case you can only wait until they fox it.
    If other websites load properly and only one is having a problem then most likely the problem lies in the web server of the site you are trying to visit.

  • Just landed in Colombia with s5 and can't get a signal, I have the global plan and phone, how can I services?

    i have a global phone and  plan but I just landed in Colombia and can't get a signal

    there are are no 3 switches, you have a choice between cdma,gsm, or global network. I appreciate you trying to help but you shouldn't talk down to someone when you don't know what you're talking about.
    anyway. I couldnt call that number because my phone wasn't connecting to the roaming towers.. Guess why
    becsuse the douchebag at verizon I talked to at customer service (*611) before I left the airport In USA forgot to turn on the global option on, on his end even though he said he did before we hung up. What an aggravating experience.
    And by the way I was right, I had to select  gsm network after Verizon cleared my phone for international roaming and manually select the company Verizon has a roaming deal with "Claro" so I was in exactly the right area and you were completely wrong The reason it failed to register was because verizon didnt authorize international roaming. Too bad you didn't know that, that would have been helpful. you trying to give me advice is like a nascar fan telling a professional racecar driver that he's doing it wrong And that he should only do the things he suggested..

  • Our home network has multiple devices connected by iCloud. Having problem with Calendar. On one iMac, all the events are duplicated. How can I correct that problem? Under the Calendar accounts, I had my Apple id listed and also just iCloud.

    Our home network has multiple devices connected by iCloud: 2 iMacs, 2 iPhone 4s, 1 MacPro Laptop, and 1 iPad 2.  When using Calendar, all the events were
    duplicated on my husbands iMac.  On his computer, under Calendar accounts, I had included iCloud and also my iCloud ID.  I thought that because I had two accounts listed that were connected to iCloud, that might be the cause of the duplication.  When I deleted ithe calendars from one of the accounts, it resulted
    in deleting all of the events on all of our network devices!
    I have since entered some new events into Calendar from my iMac and from my iPhone.  These appear correctly on all devices except my husband's iMac where they are again all duplicated.
    I have two questions: 1)  How can I eliminate the duplicated events on my husband's computer and 2) How do I retrieve the old wiped out Calendar events from
    Time Capsule.  I don't know how to find Calendar in the Time Capsule.  If I find the Calendar information in Time Capsule, how do I transfer it to my current Calendars?
    I was obtaining phone help from one of the Apple techs at Apple Support, but our call was disconnected part way through.  Didn't know how to reconnect with the tech.
    Thanks for any help.

    The warranty entitles you to complimentary phone support for the first 90 days of ownership.

  • My iphone 4 is saying "no service" and "searching" how can i correct this issue?

    my iphone 4 is working but it says "searching" or "no service" but i put my number on to another phone and it is working just fine. How can i fix this? Please HELP!

    Restore your phone as a new device. If that does not work see if you can try a SIM from someone else's phone. If that SIM does not work then the problem is the phone. If the borrowed SIM works then the problem is with your cell provider. In fact, if you went to a retail location for your provider they should have tried another working SIM to determine where the problem is located. If the problem is in your device you will probably have to get an out of warranty replacement if your phone is out of warranty. Being a 4S I suspect the device is out of warranty.

  • I cannot view photos from pages of an on-line auction from Firegox, but I can view the photos when I view the page on IE. How can I correct this problem?

    When I open to a page from the auction on Firefox, the photos added to the auction to picture the item are not shown. Only a numerical list of the missing photos is visible: 1,2,3, etc. But when the same page is opened on IE, the photos are shown with no trouble. I asked the web site for help, but they had no idea of a problem.

    Sometimes images may be blocked by site-specific permission settings, and in other cases by extensions such as ad blockers. (If the images are displayed by a plugin, such as the Flash player, there are additional possible explanations.)
    (1) To check permissions, open the Page Info dialog and click into the Media tab. You can do this using either:
    * right-click and choose View Page Info > Media
    * Alt+t (open the classic Tools menu) > Page Info > Media
    Click in the list and arrow down through the various images and watch the box above the image preview area that says "Block images from {site}". If that box is checked for any of the source sites, uncheck it. When you're done, reload the page.
    (2) If the images weren't blocked by permissions, try the page in Firefox's Safe Mode. That's a standard diagnostic tool to bypass interference by extensions (and some custom settings). More info: [[Troubleshoot Firefox issues using Safe Mode]].
    You can restart Firefox in Safe Mode using
    Help > Restart with Add-ons Disabled
    In the dialog, click "Start in Safe Mode" (''not'' Reset)
    If the images display in Safe Mode, then most likely one of your extensions is blocking them. You might be able to solve that puzzle just by reviewing them, but if you can't find the culprit right away, you can selectively disable them in groups to narrow it down.
    You would do that in the Add-ons Manager:
    orange Firefox button (or Tools menu) > Add-ons > ''click'' Extensions ''on the left side''
    Can you track it down?

  • I can't seem to see sync my mac and iphone using iCloud with numbers and pages how can i correct this?

    Hi
    I've used Numbers and Pages for IOS for sometime now and when i use safari to look at my icloud account i can see all my files. Recently i bought Numbers for Mac and now whenever i create a spreadsheet on my mac i can't see it on my iphone but i can if i login to icloud. In fact i can only see about 16 files on my iphone when there is over 40 files.
    Although i don't yet have pages for mac i now have a similar problem with Pages, whenever i edit a file or even create a file on IOS it doesn't appear in icloud.
    I did think it was something to do with me not selecting backup to icloud so i then spent £14 to upgrade my storage to 15GB and that hasn't helped.
    I've checked all the settings and can't see anythng that will cause the problem.
    My iphone is running IOS 6 and my Mac is running Mountain Lion 10.8.2
    Does anyone know how to correct this mess?
    Many thanks in advance.
    Mick.

    Problems with buttons and links at the top of the page not working can be caused by an extension like the Yahoo! Toolbar or a Babylon extension that extents too much downwards and covers the top part of the browser window and thus makes links and buttons in that part of the screen not clickable.
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do not click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode

Maybe you are looking for