165k views
5 votes
Which of the following lines of code is syntactically correct?

a. DECLARE order NUMBER; departure DATE; BEGIN ---- executable statements --- END
b. DECLARE order NUMBER; departure DATE BEGIN ---- executable statements --- END
c. DECLARE order NUMBER(3); departure DATE; BEGIN ---- executable statements --- END;
d. DECLARE order NUMBER(2); departure DATE; BEGIN; ---- executable statements --- END

User Gary AP
by
6.9k points

1 Answer

3 votes

Answer:

The answer is:

c.

DECLARE

order NUMBER(3);

departure DATE;

BEGIN

---- executable statements ---

END;

Explanation:

SQL Commands must close with a semicolon to be correctly parsed by the server. This is the cause why the syntax is wrong in:

A. DATE; BEGIN ---- executable statements --- END lacks semicolon in END.

B. DECLARE order NUMBER; departure DATE lacks semicolon after DATE.

D. A. DATE; BEGIN ---- executable statements --- END lacks semicolon in END.

User Papakias
by
6.8k points