oracle SQL plus如何在SQL文件中结束命令? [英] oracle SQL plus how to end command in SQL file?
问题描述
我有几个命令的SQL文件.
在脚本中结束行的正确方法是什么?
是否同时使用[/]分号[;]?
常规sql和存储过程代码之间是否有区别?
谢谢
对于普通的SQL语句,单独在一行上的/
或命令末尾的;
都可以正常工作. /p>
对于包含PL/SQL代码的语句,例如CREATE FUNCTION
,CREATE PROCEDURE
,CREATE PACKAGE
,CREATE TYPE
或匿名块(DECLARE
/BEGIN
/END
),/
执行命令.
根据我的经验,人们更喜欢在可能的情况下使用分号,而仅在需要时才使用斜杠.
请注意,对于SQLPlus客户端命令(例如SET
或EXECUTE
),根本不需要命令终止符,尽管人们经常出于习惯而以分号结尾.
I have SQL file with few commands.
What it the correct way to end lines in the script?
Is it slash [/] semicolon [;] both?
Is there any diffarent between regular sqls and Stored procedure code?
Thank you
For normal SQL statements, either a /
on a line by itself, or a ;
at the end of the command, will work fine.
For statements that include PL/SQL code, such as CREATE FUNCTION
, CREATE PROCEDURE
, CREATE PACKAGE
, CREATE TYPE
, or anonymous blocks (DECLARE
/BEGIN
/END
), a ;
will not execute the command. Since PL/SQL uses semicolons as line terminators, its use as a command terminator must be suppressed in these statements. So in these cases, you must use /
to execute the command.
In my experience, people prefer to use the semicolon when possible and use the slash only when required.
Note that for SQLPlus client commands -- such as SET
or EXECUTE
-- no command terminator is necessary at all, although people often end them with a semicolon out of habit.
这篇关于oracle SQL plus如何在SQL文件中结束命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!