oracle oracle中这些各种sql表的等价物是什么

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5297830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 23:03:07  来源:igfitidea点击:

what are the equivalent of these various sql table in oracle

sqloraclesyntax

提问by FerdzBM

SQL tables:

SQL 表:

sys.types sysobjects syscolumns sysindexes INFORMATION_SCHEMA.COLUMNS

sys.types sysobjects syscolumns sysindexes INFORMATION_SCHEMA.COLUMNS

Can you also help me convert this to oracle syntax

你能不能帮我把这个转换成oracle语法

DECLARE @tableUpdateCount tinyint
set @tableUpdateCount = 0
/* 
* CALCDETL.ALIAS - 1
*/
if exists (select * from syscolumns where id = (select id from sysobjects where name = 'ABC' and type = 'U') and name = 'ALIAS' and xusertype = (select user_type_id from sys.types where name = 'nvarchar') and prec = 20)
begin
    set @tableUpdateCount = @tableUpdateCount + 1
    print ' '
    print '1.  ABC.ALIAS exists'
end

are there any tools out there that can easily convert sql-to-oracle syntax?

是否有任何工具可以轻松地将 sql-to-oracle 语法转换?

Thanks!

谢谢!

采纳答案by sgokhales

This will definately help you out. It's free.

这肯定会帮助你。免费。

Btw, for converting your SQL syntax-> Oracle syntax, you must first, go through this comparison.

顺便说一句,要转换您的SQL syntax-> Oracle syntax,您必须首先进行此比较。

回答by CloudyMarble

sysobjects  <-> USER_OBJECTS
syscolumns  <-> USER_TAB_COLUMNS
sysindexes <-> USER_INDEXES

you can use ALL/DBA instead of USER depending on the scope you like to search in (and your Role in the Database)

您可以使用 ALL/DBA 而不是 USER,具体取决于您想搜索的范围(以及您在数据库中的角色)

See the Referencefor more Info.

有关更多信息,请参阅参考资料

And Check: Oracle Functions Pl/SQLfor the conversion

并检查:Oracle Functions Pl/SQL的转换

回答by Alaa

set ServerOutPut on;

DECLARE
     tableUpdateCount number(1) := 0;
     Id number(5);
/* 
* CALCDETL.ALIAS - 1
*/
Begin
select id into Id from syscolumns where id = (select id from sysobjects where name = 'ABC' and type = 'U') and name = 'ALIAS' and xusertype = (select user_type_id from sys.types where name = 'nvarchar') and prec = 20);

    tableUpdateCount := tableUpdateCount + 1; 
    dbms_outPut.Put_line('');
    dbms_outPut.Put_line('1.  ABC.ALIAS exists'); 
Exception
    when No_Data_found then
          dbms_outPut.Put_line('ABC.ALIAS not found');
End;