在对MYSQL移植到Oracle时 数据库一些专有写法的差异进行备注。
1. show create table tablename;
Oracle: select table_name,dbms_metadata.get_ddl('TABLE','TABLE_NAME')from dual,user_tables where table_name='TABLE_NAME';
注意:TABLE_NAME 指表名 需要大写。
2. desc tablename;
Oracle:select column_name,data_type,nullable from all_tab_columns where owner='LANCE' and table_name='TABLE_NAME';
注意:TABLE_NAME 指表名 需要大写。 LANCE为当前用户名称。
3. show tables ,第二种写法: SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA='当前数据库名称';
Oracle:: select TABLE_NAME from user_tables;
注意:此处 TABLE_NAME 为 user_tables的字段名称,请不要修改。
4.show databases
Oracle: select name as database from v$database;