PCS Infotech Papers: Sample Questions 7 - 8 of 25

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 7

» Database » MySQL

MCQ▾

Question

Can PL/SQL reserved words be used in SQL?

Choices

Choice (4) Response

a.

Yes

b.

No

c.

None of the above

d.

Question does not provide sufficient data or is vague

Answer

a.

Explanation

  • Yes, PL/SQL reserved words can be used with quotation.

  • The $RESERVED_WORDS data dictionary view provides additional information on each reserved word.

  • Words reserved by PL/SQL are classified as keywords or reserved words.

  • Never to be used as identifiers.

  • Keywords can be used as identifiers but not recommended.

Question number: 8

» Database » MySQL

Essay Question▾

Describe in Detail

Which are the mandatory parts of PL/SQL procedure?

Explanation

  • The PL/SQL stored procedure is a PL/SQL block with performs one or more specific task.

  • The procedure contains a header and a body

Header

  • The section before IS keyword is called procedure header.

  • Elements of procedure’s header are:

  • Schema:

    • Optional name of the schema to which the procedure belongs.

    • Default is the current user.

    • We can specify a different user- the current user must have privileges to create a procedure.

  • Name:

    • Convention dictates that procedure name starts with a verb.

  • Parameters:

    • Optional list of parameters.

    • PL/SQL function parameters have different modes- IN, OUT and IN OUT.

  • AUTHID:

    • Determines execution privileges- privileges of the procedure owner or the privileges of current user specified by CURRENT_USER.

Body:

  • Similar syntax as an anonymous block- consist of the declaration, execution, and exception.

  • Declaration and exception sections are optional.

  • At least one executable statement must be in the execution section.

  • PL/SQL procedure can have a RETURN statement, which does not take any expression or constant.