(Paper) Class XII Informatics Practices: Chapter Wise Papers (GETTING STARTED WITH PL/SQL)

Disclaimer: This website is NOT associated with CBSE, for official website of CBSE visit - www.cbse.gov.in

Class XII Informatics Practices Paper (Chapter Wise With Answer)


GETTING STARTED WITH PL/SQL

Q.1 What is basic structure of PL/SQL block?
Ans.
The minimum sections of PL/SQL block are

  • The Declare section

  • The Master Begin and End section that contains the Exception section.

DECLARE

/ * Declaration of memory variables, constants, cursors, etc. in PL/SQL*/

BEGIN

/* SQL executable statements and PL/SQL executable statements*/
/*
This is the only block which is required

EXCEPTION
/*
Code to handle errors that may arise during the execution */

END; /* This makes the end of a PL/SQL block */
 

Q.2 What is different type of attributes in PL/SQL?

OR

Q.2 What is the difference between % TYPE and % ROWTYPE?

Ans. Attributes allow us to refer to data types and objects from the database. PL/SQL variables can have attributes. The following types of attributes supported by PL/SQL:

  • %TYPE

  • %ROWTYPE

%TYPE attribute is used when declaring variable that refers to the database columns (e.g. a table’s column).

%ROWTYPE attribute is used to declare a record based upon a collection of database columns from a table or view.
 

Q.3 Which SQL statements are not supported by PL/SQL? (HOTS)
Ans. PL/SQL does not support data definition language(DDL), such as CREATE TABLE, ALTER TABLE or DROP TABLE.
PL/SQL also not support data control language(DCL), such as GRANT or REVOKE.

Q.4 Which statement in PL/SQL is used to display data on the screen?

Ans.
DBMS_OUTPUT.PUT-LINE
statement is to display the data and messages on the screen. e.g
DBMS_OUTPUT.PUT-LINE(‘
’The value of a=’||a);
 

Q.5 What are the rules for naming a variable in PL/SQL?
Ans.
The following are the naming rules to declare the variables:

  • The variable name should not be the same as the name of a table column used in the block.

  • Two variables can have the same name, provided they are in different blocks.

  • A variable name can be up to 30 characters in length.

  • A variable name must start with letter.

  • A variable name can include $,_ and # symbols.

  • A variable name can not contain spaces.

Q.6 What symbol is used to execute the PL/SQL block?
Ans.
The / symbol is used to execute the PL/SQL block

Q.7 What is variable?
Ans. A variable is a name storage location which is used to transfer information between a PL/SQL program and the database.

Q.8 What is the use of EXIT statement?
Ans. The EXIT statement forces a loop to complete unconditionally. When an EXIT statement is encountered, the loop completes immediately and control passes to the next statement.

Q.9 What is control structure?
Ans. Control structure allows you to control the flow of your program’s execution.

Q.10 What is the body of loop?
Ans. The set of statements repeated again and again is called the body of the loop.

Q.11 Give the syntax of two forms of IF statement.
Ans.

( i ) IF condition THEN
sequence_of_statements
END IF

(ii) IF condition THEN
sequence_of_statements
ELSE
sequence_of_statements
END IF