| Desc | MySQL | Oracle |
| show create table | show create table TABLE_NAME | select table_name,dbms_metadata.get_ddl(‘TABLE’,’TABLE_NAME’)from dual,user_tables where table_name=’TABLE_NAME’; |
| select table | select * from dba_tables where table_name=’TABLE_NAME’ | |
| select db link | select * from user_db_links; select * from dba_db_links; | |
| create table when not exists | declare already_exists exception; columns_indexed exception; pragma exception_init( already_exists, -955 ); pragma exception_init(columns_indexed, -1408); begin execute immediate ‘create table MAPPING_LINKS( SOURCE_ID NUMBER(10,0), LINK(10,0) )’; execute immediate ‘create index IDX_MAPPING_LINKS_SOURCEID on MAPPING_LINKS (SOURCE_ID)’; dbms_output.put_line( ‘created’ ); exception when already_exists or columns_indexed then dbms_output.put_line( ‘skipped’ ); end; / |
declare
already_exists exception;
columns_indexed exception;
pragma exception_init( already_exists, -955 );
pragma exception_init(columns_indexed, -1408);
begin
execute immediate 'create table MAPPING_LINKS( SOURCE_ID NUMBER(10,0), LINK(10,0) )';
execute immediate 'create index IDX_MAPPING_LINKS_SOURCEID on MAPPING_LINKS (SOURCE_ID)';
dbms_output.put_line( 'created' );
exception
when already_exists or columns_indexed then
dbms_output.put_line( 'skipped' );
end;
/
declare |