What does "IS" do in Oracle procedures?

Viewed 3493

I want to create a procedure in Oracle; however, any sample that I look on the internet, has an "IS" syntax, which I couldn't find any functionality for it.

CREATE [OR REPLACE] PROCEDURE procedure_name
    [ (parameter [,parameter]) ]

IS
    [declaration_section]

BEGIN
    executable_section

[EXCEPTION
    exception_section]

END [procedure_name];

Does anyone know what does "IS" do?

2 Answers

IS is part of Create procedure syntax: (can be replace with AS)

It separate the procedure definition from its contents.

The optional declaration section that follows allows you to declare local variables.

IS, in this context, tells us (and the compiler) that what follows is the body of the procedure. Its absence tells us (and the compiler) that it is merely a declaration (e.g. a forward declaration in a package body):

create or replace package body mypkg is

  -- this is just a forward declaration for the procedure
  procedure myproc (id in number);

  -- this is the full definition of the procedure
  procedure myproc (id in number)
  IS
    ..body of myproc..;

end mypkg;

In the case of a schema-level procedure, we could (in theory) have a syntax that makes the IS optional since there is no need for forward declarations; but (thankfully) the designers of PL/SQL kept the syntax consistent with the in-package syntax so IS is still required anyway.

Related