where can I use statement box put Null or not primary key or null in the result?

create the table test_target

(

letter_grade varchar2 (2) null,

grade_point number (3,2) not null,

max_grade number (3).

min_grade number 4

);

create the table test_source

(

letter_grade VARCHAR2 (3),

grade_point number (3,2).

max_grade number (3,2).

min_grade number (3).

created_by date,

Modified_By date

);

with the CBC 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

user_tab_columns CBC

where table_name = 'TEST_SOURCE '.

),

As TGT

(

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

of tgt user_tab_columns

where table_name = 'TEST_TARGET '.

),

col_details as

(

Select src.src_table_name, nvl (tgt.tgt_table_name, first_value (tgt_table_name) more (order of nulls last tgt_table_name)) 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,

TGT.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable

the CBC

outer join left tgt

on)

SRC.src_col_name = tgt.tgt_col_name

)

)

Select *.

de)

Select the case sensitive option

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 | 'Edit ' | tgt_col_name | ' ' || src_data_type | ' (' ||

-case when src_data_type null ('DATE') then

on the other

case

When src_data_type in ('VARCHAR', 'VARCHAR2')

then nvl (to_char (src_data_len), ' ') | ') '

otherwise decode (nvl (src_data_precision-1),-1, null, nvl (to_char (src_data_precision), ' ') |) ', ' || NVL (to_char (src_data_scale), ' ') | ')')

end

end

When tgt_col_name is null

then 'alter table ' | tgt_table_name | 'Add ' | src_col_name | ' ' || src_data_type |

-case when src_data_type null ('DATE') then

on the other

case

When src_data_type in ('VARCHAR', 'VARCHAR2')

then nvl (to_char (src_data_len), ' ') | ') '

otherwise decode (nvl (src_data_precision-1),-1, null, nvl (to_char (src_data_precision), ' ') |) ', ' || NVL (to_char (src_data_scale), ' ') | ')')

end

end

end alter_statement

of col_details

)

where alter_statement is not null;

result:

ALTER table TEST_TARGET change LETTER_GRADE VARCHAR2 (3) / / if it is null or not null primary key or want to see the result as alter table TEST_TARGET change LETTER_GRADE VARCHAR2 (3) null or not null or primary key

ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2)

ALTER table TEST_TARGET change the MIN_GRADE NUMBER (3, 0)

ALTER table TEST_TARGET add CREATED_BY

ALTER table TEST_TARGET add MODIFIED_BY

Please try:

drop table test_target purge;

drop table test_source purge;

create the table test_target

(

letter_grade varchar2 (2) primary key,.

grade_point number (3,2) not null,

max_grade number (3) unique.

min_grade number 4,

MIN_AGE number 4

);

create the table test_source

(

letter_grade VARCHAR2 (3),

grade_point number (3,2).

max_grade number (3,2).

min_grade number (3).

created_by date,

Modified_By date

);

with the CBC 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,

CBC. Nullable src_nullable, decode (T.Constraint_Type, 'P', 'Primary Key', 'U', 'Unique', ") as src_cons

user_tab_columns CBC

left join (select Cc.Column_Name, Uc.Constraint_Type

of user_cons_columns cc, uc user_constraints

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 = 'TEST_SOURCE '.

),

As TGT

(

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

of tgt user_tab_columns

left join (select Cc.Column_Name, Uc.Constraint_Type

of user_cons_columns cc, uc user_constraints

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 = 'TEST_TARGET '.

),

col_details as

(

Select src.src_table_name, nvl (tgt.tgt_table_name, first_value (tgt_table_name) more (order of nulls last tgt_table_name)) 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

the CBC

outer join full tgt

on)

SRC.src_col_name = tgt.tgt_col_name

)

)

Select *.

de)

Select the case sensitive option

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 | 'Edit ' | tgt_col_name | ' ' || src_data_type | ' (' ||

-case when src_data_type null ('DATE') then

on the other

case

When src_data_type in ('VARCHAR', 'VARCHAR2')

then nvl (to_char (src_data_len), ' ') | ') '

otherwise decode (nvl (src_data_precision-1),-1, null, nvl (to_char (src_data_precision), ' ') |) ', ' || NVL (to_char (src_data_scale), ' ') | ')')

end

end

||

cases where tgt_nullable = 'Y' then 'null '.

of another end 'not null '.

|| 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 null ('DATE') then

on the other

case

When src_data_type in ('VARCHAR', 'VARCHAR2')

then nvl (to_char (src_data_len), ' ') | ') '

otherwise 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

of col_details

)

where alter_statement is not null;

priamry key and unique key you choose user_contraints

Check and change for your condition

Concerning

Mr. Mahir Quluzade

Tags: Database

Similar Questions

  • can I use my box of creative suite version 6 after installing the creative cloud?

    before installing the creative cloud adobe 2015, I want to make sure that I can still use my box installed creative suite version 6 on my mac. Can someone tell me if this is possible and what I need to consider? Thanks in advance.

    Hello

    The amount of the fine to have both versions installed on your computer. CS6 version can coexist with a CC version without causing any problems.

  • Where can I find Hyper-V? It is not under the tab 'programs & appearance, turn Windows features on or off '.

    I use a HP Pavilion laptop computer g7, which came with Windows 8 and Microsoft Home & Student.

    Where can I find Hyper-V?  It is not under the tab 'programs & appearance, turn Windows features on or off '.  I looked where HELP says it should be, but I don't the have not found.  I am interested to explore the installation of Windows XP on this laptop so I can go back & before that can be done in Windows 7 using a virtual drive.  Thanx.

    Hyper-V is available in Windows 8 Pro.

    To the top of Windows 8 for Windows 8 Pro:

    http://Windows.Microsoft.com/en-us/Windows-8/feature-packs

    Once you have upgraded:

    Press Windows key + R

    Type: optionalfeatures.exe

    Press enter

    Select it in the list

  • Where can I download puppet tool? It is not in my installation.

    See the title.

    Was not present in CC, nor when I upgraded by 2014.

    Where can I download it and put it in my program files?

    In addition, my right click menu opens to the left in 2014. How can I Exchange it right?

    Thank you.

    In addition, my right click menu opens to the left in 2014. How can I Exchange it right?

    Disable support for the tablet in the system control panel. Indeed, this can still bring your puppet tool, because I'm reasonably sure that the position of the icons is simply calculated wrongly because of this setting.

    Mylenium

  • Can I use on my Mac Mini 10.8 mid-2007 4 GB? The guy at the apple store said that it would crash

    Can I use on my mac mini 10.8 mid-2007 4 GB? The guy at the apple store said that I shouldn't exceed 10.7.5 (Lion), but that will not be taken in charge by google chrome

    10.7.5 is the highest that can go a 2007 Mini.

  • My sisters thinkpad XP pro is unstable and it has lost its drive. I can reinstall using my xp pro disk and its product key?

    My sisters thinkpad XP pro is unstable and it has lost its drive.  I can reinstall using my xp pro disk and its product key?

    I fixed it!

    I couldn't work at all Internet Explore.  I finally installed Superantispyware from a USB pendrive and it ran in safe mode without network.  So I ran Malwarebytes and ccleaner.  After a reboot, everything works great again.  I could install Microsoft Security Essentials and get current updates.  After a smart defrag it turns really well now.

    I was able to make a recovery cd set too.  It will be just as good as if I he burned them on a new computer?  I mean can the data used to make these CDs get corrupted over time?  This laptop is 6 years old.
    Thank you for your willingness to help.
    MJ
  • Can I use my drive to upgrade to Windows 7 on another computer because the original is dead?

    Reuse the disks to upgrade?

    I bought the upgrade to win7 Home premium for an XP machine. Update went well. This machine is now deceased, and destroyed hard drive. Can I use my upgrade on another XP machine disks?

    I bought the upgrade to win7 Home premium for an XP machine. Update went well. This machine is now deceased, and destroyed hard drive. Can I use my upgrade on another XP machine disks?

    As far as I know, Yes.

    May need to activate by phone.

  • Can I use internet in Holland with a rt surface that I bought at the Portugal?

    Can I use internet in Holland with a rt surface that I bought at the Portugal?

    From Internet Explorer

    Original title: rt of surface

    Hi pmeulendijks,
    The answer is Yes. It depends on your networks.

    Thank you

  • Where can I find my original premodifie file on camera raw/bridge. This is the raw image before treatment

    Where can I find my original premodifie file on camera raw/bridge. This is the raw image before treatment. THX

    You can select the setting expand to default or previous camera raw conversion.

    You can also clear the changes to your image in Camera raw, but this will erase your changes in ACR.

    In Bridge, right click on the thumbnail of the image and select develop settings >Cancel settings.

    Hope that helps.

    Kind regards

    Assani

  • How can I recover a .ts file that will not import into Movie Maker? The .ts file works fine in Media Player... help

    How can I recover a .ts file that will not import into Movie Maker?   The .ts file works fine in Media Player... help

    Hi Stuart,

    We understand that you try to import a .ts file to Windows Movie Maker. However, Windows Movie Maker does not support this file type. You can click on the link below for more information on what file types are supported by Windows Movie Maker:

    Can what types of files I use in Movie Maker?

    Kind regards.

  • Where can I use my Microsoft Account expiration balance?

    I see this was requested, but I don't see a response that helps me.  Only, I logged into my account after a LONG departure.  It seems that I have a balance of $39, but I don't see anywhere that I can use it.  I do not have a Windows phone, or an Xbox.  Where can I spend it then?  I really don't want to lose $39, but it almost looks like what will need to happen unless Microsoft comes in and allows me to use and drop it elsewhere (the Microsoft store so I could at least buy some hardware)...

    Thanks for the help.

    PS - there is no category / topic for that matter...  Thank you.

    You can buy apps for Windows 8/8.1/10 also.  But yes, those who are for purchases of digital memory, not physical store in box item.s

  • Where can I use the Images I buy?

    I've been a customer of the Club Photo Dollar up to what Adobe bought them.

    I am now an Adobe customer with a ton of CPD credits.

    Can I use the images I buy:

    1. in my blog?

    2. in my LinkedIn messages?

    3. in my newsletter (3000 recipients)?

    I can't find the info anywhere use. Thanks - Rich

    Hi rich,

    I recommend you go through the purchase of licenses Adobe Stock conditions carefully.

    Please find the link below:

    Legal terms of use | Adobe

    Also look at the common FAQ frequently asked Questions, Adobe Stock

    In general, if you have the intention of any monetary gain you should go for the extended licenses.

    Please let me know if you need more information.

    Kind regards

    Gerard

  • where can I get CPU temprature in windows 7 (I know it's possible in the bios), but I want to know if this is also possible in windows 7

    Hello

    where can I get the CPU temprature in windows 7, I mean in what section of the control panel? I know that you can search the temprature of processor in the bios, but I want to know if this is also possible in the windows auto.

    Thank you

    Johan

    Hi Johan,.

    A processor overheating may fail or cause damage to other components in your PC

    Unfortunately, there is no built-in in Windows 7 utility that allows to monitor the temperature of the processor.

    There are some third party software that you can install the same.

    Note: The use of third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    It will be useful.

    Thank you and best regards,

  • need to download the latest 3.6 where can I find it? 4.0 does not work with my zone alarm

    The laptop was closed while firefox has been updated on its own. Now, it is broken with the message 'bad image '. I need to load down the 3.6 version, but I can only find 4.0. I can't use 4.0 because my current version of zonealarm is not compatible. Please notify.

    You can get Firefox 3.6 http://www.mozilla.com/en-US/firefox/all-older.html

  • Opening a link using "Open link in a new window" does not work. I can only use option 'open in a new tab '. Is this normal with the Firefox 4?

    I have really no more info. When I upgraded my Firefox to the latest version I noticed that I can ' t use this open in a new window option. I reinstalled the software using the U.S. English version (first time I chose the UK English version), but in vain.

    I solved the problem by disabling the Yahoo toolbar extension.

Maybe you are looking for