HiveBrain v1.2.0
Get Started
← Back to all entries
patternModerate

What is the significance of a semicolon at the end of SQL*Plus commands?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
significancethewhatsqlcommandssemicolonplusend

Problem

Some statements like create table, insert into etc take a semicolon at the end:

CREATE TABLE employees_demo
    ( employee_id    NUMBER(6)
    , first_name     VARCHAR2(20)
    , last_name      VARCHAR2(25) 
         CONSTRAINT emp_last_name_nn_demo NOT NULL
    ) ;


while others like

set echo on
connect system/manager


go through without the semicolon as well.

What is the reasoning behind this? How can I decide myself where to put the semicolon and where not?

Solution

Commants to the local instance execute on return. Multi-line commands to the server execute on semicolon

Special commands as detailed in the SQL*Plus manual are the only ones that do not accept semi-colons. Wheras SQL Commands must end with a ; in order to be parsed by the server.

Context

StackExchange Database Administrators Q#431, answer score: 16

Revisions (0)

No revisions yet.