Guidelines for the use of semicolons and slashes in Oracle SQL
The use of semicolon (;) and slash (/) as statement terminators in Oracle SQL scripts is often confusing. To clarify their respective purposes, please refer to the following guidelines:
Semicolon (;)
slash (/)
Exceptions for slashes
In a few cases, a slash must be used:
CREATE PROCEDURE
, CREATE FUNCTION
, and CREATE PACKAGE
contain embedded semicolons. Slashes are required to execute these statements. BEGIN...END
Blocks: BEGIN...END
blocks also require slashes to execute. Best Practices
For Oracle SQL scripts, the recommended practice is to always use a semicolon at the end of each statement without adding a slash. This ensures a single execution of the statement and minimizes errors associated with repeated executions. However, for PL/SQL subroutines and statements containing embedded semicolons, a slash must be used for correct execution.
The above is the detailed content of Semicolon or Slash in Oracle SQL: When Should I Use Each?. For more information, please follow other related articles on the PHP Chinese website!