SQL Oracle 中的命令“REM INSERTING into TABLE_NAME”究竟是做什么的?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8932354/
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-01 14:04:24  来源:igfitidea点击:

What does exactly do the command "REM INSERTING into TABLE_NAME" in Oracle?

sqloracle

提问by MadMad666

I have some SQL scripts for Oracle and I wonder to know exactly what is the objective of the following line:

我有一些用于 Oracle 的 SQL 脚本,我想知道以下行的确切目标是什么:

REM INSERTING into TABLE_NAME

REM INSERTING into TABLE_NAME

After this line I get the inserts for the table.

在这一行之后,我得到了表格的插入物。

Insert into TABLE_NAME (ID,ENUM_KEY,NAME,DESCRIPTION) values (3,3,'T_EXIT_POINT','T_EXIT_POINT');
Insert into TABLE_NAME (ID,ENUM_KEY,NAME,DESCRIPTION) values (4,4,'T_CONDITION','T_CONDITION');

Anyone can explain me this REM INSERTING, or where to find documentation about it?

任何人都可以向我解释这一点REM INSERTING,或者在哪里可以找到有关它的文档?

回答by Eddie Awad

REM, or short for REMARK, is used in SQL*Plus to indicate the beginning of a comment in a SQL script. Read more about REM in the documentation here.

REM 或 REMARK 的缩写,在 SQL*Plus 中用于指示 SQL 脚本中注释的开始。在此处的文档中阅读有关 REM 的更多信息。

Instead of

代替

 REM INSERTING into TABLE_NAME 

I suggest you use PROMPT

我建议你使用 PROMPT

 PROMPT INSERTING into TABLE_NAME 

That way the script output would contain the string "INSERTING into TABLE_NAME".

这样脚本输出将包含字符串“INSERTING into TABLE_NAME”。

More about PROMPT here. It's especially useful when you have ECHO OFF.

更多关于提示在这里。当您关闭 ECHO 时,它特别有用。

回答by duffymo

I believe REM is a comment, short for "REMARK". Everything after REM is ignored by the Oracle parser.

我相信 REM 是一个注释,是“REMARK”的缩写。Oracle 解析器将忽略 REM 之后的所有内容。

I would remove such a thing if I saw it. It adds no new information; it's little more than visual clutter. These kinds of comments should be discouraged.

如果我看到它,我会删除这样的东西。它没有添加新信息;这只不过是视觉上的混乱。这种评论应该被劝阻。

回答by Saurabh Arora

REM is just a way to provide comments in the script file as we have "/* */", "#", etc in other programming languages. Whatever is followed by "REM" in that particular line is ignored by the compiler.

REM 只是在脚本文件中提供注释的一种方式,因为我们在其他编程语言中有“/* */”、“#”等。编译器将忽略该特定行中跟在“REM”之后的任何内容。