Sei sulla pagina 1di 30

REPORT ON

VOCATIONAL TRAINING
Towards the partial fulfillment of degree of
Bachelor of Engineering under
SESSION 2014-15

SUBMITTED AT
DBASE SOFTWARE
ON

PL/SQL

SUBMITTED BY :
SHREYA SHARMA
Roll No. : 0112CS121096

BANSAL INSTITUE OF SCIENCE & TECHNOLOGY


Bhopal (M.P)

Guided By:
Mr. Bhavendra Raghuwanshi
Training In-charge

-:ACKNOWLEDGEMENT:-

Every accomplishment requires efforts of many with coordination in same direction and this
work no exception.
This is small gesture and gratitude that I express for help render to me by my guide Mr.
Bhavendra Raghuwanshi, Training In-charge, DBASE SOFTWARE for suggestions and keen
interest in the training work without whose guidance and supervision completion of this
training/project would have not been possible.

Success is the manifestation of diligence, perseverance, inspired motivation and innovation. The
successful completion of my training is solely attributed to constant help guidance and
encouragement received by my guide Mr. Bhavendra Raghuwanshi.

I would also like to thank Neetesh gupta for allowing me to undergo this training.
CONTENTS

1. Certificate

2. Company Profile

3. About Oracle 10g Database

4. What is SQL and SQL*Plus ?

5. Basic Structure of PL/SQL

6. Variables and Types

7. Control Flow in PL/SQL

8. Cursors

9. Procedure, Sequence and Function

10. Package

11. Users

12. Application of PL/SQL


-:COMPANY PROFILE:-

BSNL is engaged in the business of knowledge delivery through acquiring,


creating, developing, managing, lending and licensing knowledge in the field of
Information Technology. We offer programs for young aspirants as well as IT
professionals looking to enhance their skills. Our courses are based on
scientifically structured curricula that are in tune with the latest trends and projects
in the IT world and provide a robust platform for career seekers. We consistently
strive to bridge the gap between knowledge and practice by providing our students
with the learning methodologies and industry exposure.
-:ABOUT ORACLE 10g DATABASE:-

The Oracle Database (commonly referred to as Oracle RDBMS or simply Oracle) is a


relational database management system (RDBMS) produced and marketed by Oracle
Corporation. As of 2009, Oracle remains a major presence in database computing.[

Oracle Database 10g is the first database designed for grid computing, the most flexible and cost-
effective way to manage enterprise information. It cuts costs of management while providing the
highest possible quality of service.

In addition to providing numerous quality and performance enhancements, Oracle Database 10g
significantly reduces the costs of managing the IT environment, with a simplified install, greatly
reduced configuration and management requirements, and automatic performance diagnosis and
SQL tuning.

These and other automated management capabilities help improve DBA and developer
productivity and efficiency. And with Release 2, Oracle's focus on improving efficiencies and
reducing the cost of information management continues
-:WHAT IS SQL AND SQL*Plus:-

With the structured query language (SQL),you tell oracle which information you want to select,
insert , or delete. These four verbs are the primary words you will use to give Oracle instructions.
As of Oracle9i, you can use an additional command. As of Oracle Database 10 g, the merge
command capabilities have been extended to include greater control over the inserts, updates
and even deletes performed within a single statement. Also as of As of Oracle Database 10g,
these Basic commands are further enhanced to support flash back version queries and other
features.

With SQL*Plus, a powerful Oracle product that can take your instructions for oracle, check them
for correctness, submit them to oracle, and modify or reformat the response oracle gives, based
on orders or directions you’ve in place.

SQL is the language itself where as SQL*Plus is a program distributed by Oracle used to run
SQL Script on databases.
-:BASIC STRUCTURE OF PL/SQL :-

PL/SQL stands for Procedural Language/SQL. PL/SQL extends SQL by adding constructs found
in procedural languages, resulting in a structural language that is more powerful than SQL. The
basic unit in PL/SQL is a block. All PL/SQL programs are made up of blocks, which can be
nested within each other. Typically, each block performs a logical action in he program. A block
has the following structure:

DECLARE

/* Declarative section: variables, types, and local subprograms. */

BEGIN

/* Executable section: procedural and SQL statements go here. */

/* This is the only section of the block that is required. */

EXCEPTION

/* Exception handling section: error handling statements go here. */

END;

Only the executable section is required. The other sections are optional. The only SQL
statements allowed in a PL/SQL program are SELECT, INSERT, UPDATE, DELETE and
several other data manipulation statements plus some transaction control. However, the SELECT
statement has a special form in which a single tuple is placed in variables; more on this later.
Data definition statements like CREATE, DROP, or ALTER are not allowed. The executable
section also contains constructs such as assignments, branches, loops, procedure calls, and
triggers, which are all described below (except triggers). PL/SQL is not case sensitive. C style
comments (/* ... */) may be used.

To execute a PL/SQL program, we must follow the program text itself by

 A line with a single dot ("."), and then


 A line with run;

-:VARIABLES AND TYPES :-

Information is transmitted between a PL/SQL program and the database through variables. Every
variable has a specific type associated with it. That type can be
 One of the types used by SQL for database columns
 A generic type used in PL/SQL such as NUMBER
 Declared to be the same as the type of some database column

The most commonly used generic type is NUMBER. Variables of type NUMBER can hold either
an integer or a real number. The most commonly used character string type is VARCHAR(n),
where n is the maximum length of the string in bytes. This length is required, and there is no
default. For example, we might declare:

DECLARE

price NUMBER;

myBeer VARCHAR(20);

Note that PL/SQL allows BOOLEAN variables, even though Oracle does not support
BOOLEAN as a type for database columns.

Types in PL/SQL can be tricky. In many cases, a PL/SQL variable will be used to manipulate
data stored in a existing relation. In this case, it is essential that the variable have the same type
as the relation column. If there is any type mismatch, variable assignments and comparisons may
not work the way you expect. To be safe, instead of hard coding the type of a variable, you
should use the %TYPE operator. For example:

DECLARE

myBeer Beers.name%TYPE;
gives PL/SQL variable myBeer whatever type was declared for the name column in relation
Beers.

A variable may also have a type that is a record with several fields. The simplest way to declare
such a variable is to use %ROWTYPE on a relation name. The result is a record type in which
the fields have the same names and types as the attributes of the relation. For instance:

DECLARE

beerTuple Beers%ROWTYPE;
The initial value of any variable, regardless of its type, is NULL. We can assign values to
variables, using the ":=" operator. The assignment can occur either immediately after the type of
the variable is declared, or anywhere in the executable portion of the program. An example:

DECLARE

a NUMBER := 3;

BEGIN

a := a + 1;

END;

run;

This program has no effect when run, because there are no changes to the database.
-:CONTROL FLOW IN PL/SQL :-

PL/SQL allows you to branch and create loops in a fairly familiar way.

An IF statement looks like:

IF <condition> THEN <statement_list> ELSE <statement_list> END IF;

The ELSE part is optional. If you want a multiway branch, use:

IF <condition_1> THEN ...

ELSIF <condition_2> THEN ...

... ...

ELSIF <condition_n> THEN ...

ELSE ...

END IF;

LOOP

Loops are created with the following:

LOOP

<loop_body> /* A list of statements. */

END LOOP;

At least one of the statements in <loop_body> should be an EXIT statement of the form

EXIT WHEN <condition>;

The loop breaks if <condition> is true.


Some other useful loop-forming statements are:

 EXIT by itself is an unconditional loop break. Use it inside a conditional if you like.
 A WHILE loop can be formed with
 WHILE <condition> LOOP

 <loop_body>

END LOOP;
 A simple FOR loop can be formed with:
 FOR <var> IN <start>..<finish> LOOP

 <loop_body>

END LOOP;

Here, <var> can be any variable; it is local to the for-loop and need not be declared. Also,
<start> and <finish> are constants.
-:CURSOR IN PL/SQL :-

A cursor is a variable that runs through the tuples of some relation. This relation can be a stored
table, or it can be the answer to some query. By fetching into the cursor each tuple of the relation,
we can write a program to read and process the value of each such tuple. If the relation is stored,
we can also update or delete the tuple at the current cursor position.

Syntax:

DECLARE

/* Output variables to hold the result of the query: */

/* Cursor declaration: */

CURSOR <cursor_name> IS

SELECT <column_names>

FROM <table_name>

WHERE <condition>;

BEGIN

OPEN < cursor_name >;

LOOP

/* Retrieve each row of the result of the above query

into PL/SQL variables: */

FETCH < cursor_name > INTO variables;

/* If there are no more rows to fetch, exit the loop: */

EXIT WHEN < cursor_name > %NOTFOUND;

/* Delete the current tuple: */


DELETE FROM <table_name> WHERE CURRENT OF < cursor_name >;

/* Insert the reverse tuple: */

INSERT INTO <table_name> VALUES(variables);

END LOOP;

/* Free cursor used by the query. */

CLOSE < cursor_name >;

END;
-:PROCEDURES:-

PL/SQL procedures behave very much like procedures in other programming language.
A procedure is introduced by the keywords CREATE PROCEDURE followed by the procedure
name and its parameters. An option is to follow CREATE by OR REPLACE. The advantage of
doing so is that should you have already made the definition, you will not get an error. On the
other hand, should the previous definition be a different procedure of the same name, you will
not be warned, and the old procedure will be lost.

There can be any number of parameters, each followed by a mode and a type. The possible
modes are IN (read-only), OUT (write-only), and INOUT (read and write). Note: Unlike the type
specifier in a PL/SQL variable declaration, the type specifier in a parameter declaration must be
unconstrained. For example, CHAR(10) and VARCHAR(20) are illegal; CHAR or VARCHAR
should be used instead. The actual length of a parameter depends on the corresponding argument
that is passed in when the procedure is invoked.

Following the arguments is the keyword AS (IS is a synonym). Then comes the body, which is
essentially a PL/SQL block. We have repeated the name of the procedure after the END, but this
is optional. However, the DECLARE section should not start with the keyword DECLARE.
Rather, following AS we have:

... AS

<local_var_declarations>

BEGIN

<procedure_body>

END;

run;

We can also write functions instead of procedures. In a function declaration, we follow the
parameter list by RETURN and the type of the return value:

CREATE FUNCTION <func_name>(<param_list>) RETURN <return_type> AS ...


In the body of the function definition, "RETURN <expression>;" exits from the function and
returns the value of <expression>.

To find out what procedures and functions you have created, use the following SQL query:
select object_type, object_name

from user_objects

where object_type = 'PROCEDURE'

or object_type = 'FUNCTION';
To drop a stored procedure/function:
drop procedure <procedure_name>;

drop function <function_name>;

DISCOVERING ERRORS

PL/SQL does not always tell you about compilation errors. Instead, it gives you a cryptic
message such as "procedure created with compilation errors". If you don't see what is wrong
immediately, try issuing the command

Syntax:

show errors procedure <procedure_name>;

Alternatively, you can type, SHO ERR (short for SHOW ERRORS) to see the most recent compilation
error.

Note that the location of the error given as part of the error message is not always accurate!

PRINTING VARIABLES

Sometimes we might want to print the value of a PL/SQL local variable. A ``quick-and-dirty''
way is to store it as the sole tuple of some relation and after the PL/SQL statement print the
relation with a SELECT statement. A more couth way is to define a bind variable, which is the
only kind that may be printed with a print command. Bind variables are the kind that must be
prefixed with a colon in PL/SQL statements, such as :new discussed in the section on triggers.

The steps are as follows:

1. We declare a bind variable as follows:

VARIABLE <name> <type>


where the type can be only one of three things: NUMBER, CHAR, or CHAR(n).

2. We may then assign to the variable in a following PL/SQL statement, but we must prefix
it with a colon.
3. Finally, we can execute a statement

PRINT :<name>;

outside the PL/SQL statement

SEQUENCE IN PL/SQL

A sequence is a database item that generates a sequence of integers.

You typically use the integers generated by a sequence to populate a numeric primary key column.
You create a sequence using the CREATE SEQUENCE statement, which has the following

syntax:
/* To create a sequence: */

CREATE SEQUENCE <sequence_name>


STARTS WITH <starting_value>
INCREMENT BY 1
MAXVALUE <maximum_value>;

/* To drop a sequence: */

DROP SEQUENCE <sequence_name>;

-: FUNCTION IN PL/SQL:-

A function is similar to a procedure except that a function must return a value.

You create a function using the CREATE FUNCTION statement in DECLARE section of PL/SQL
Block for Oracle 10g Data Base.

The simplified syntax for the CREATE FUNCTION statement is as follows:


CREATE OR REPLACE FUNCTION <function_name> [(input/output variable declarations)]
RETURN <return_type>
<IS|AS>
[declaration block]
BEGIN
<PL/SQL block WITH RETURN statement>
[EXCEPTION
EXCEPTION block]
END;

There are three types of parameter: IN, OUT and IN OUT. An IN parameter is used an input
only. An IN parameter cannot be changed by the called program. An OUT parameter is initially
NULL. The program assigns the parameter a value and that value is returned to the calling
program. An IN OUT parameter may or may not have an initial value. That initial value may or
may not be modified by the called program. Any changes made to the parameter are returned to
the calling program.
-:PACKAGES:-
Packages are groups of conceptually linked Functions, Procedures,Variable,Constants & Cursors
etc. The use of packages promotes re-use of code. Packages usually have two parts, a
specification and a body, although sometimes the body is unnecessary. The specification (spec
for short) is the interface to your applications; it declares the types, variables, constants,
exceptions, cursors, and subprograms available for use. The body fully defines cursors and
subprograms, and so implements the spec.

Syntax:

PAKAGE SPECIFICATION:

CREATE OR REPLACE PACKAGE <package_name>


AS

PROCEDURE <procedure_name> ([(input/output variable declarations)]);

END <package_name>;
/

PAKAGE BODY:

CREATE OR REPLACE PACKAGE BODY <package_name>


AS

PROCEDURE <procedure_name> ([(input/output variable declarations)]);


IS
[declaration block]
BEGIN
<PL/SQL block statement>
END;

END <package_name>;
/
-:USERS:-

HR:-the default user is HR which is created at the time of oracle installation .this user do not
have all privilege so at the stating time we have to unlock its privilege by the system
administrator account, and then give him the grant of doing work which we want from it , can
also work as the administrator if all the grants are provided to it thus this user is open for doing
any work .to give grant to this ser first we should login from administrator account then go the
option of manage user then select hr in giving screen . then we select the functionality and grant
we want to provide to hr user then click on the button alter user after that locked hr user become
unlock.

SYSTEM: - This user account work as administrator whose password is provided at the time of
software installation. It has the entire grant registered for user. It gives the grant to other user as
well.
-:APPLICATION :-

ELECTRICITY BILL GENERATOR SYSTEM

USING PL/SQL

-:CREATION SCRIPT:-

CONNECT &USER@&DATABASE/&PASSWORD;

drop sequence seq_people;

create sequence seq_people


start with 1001
increment by 1
maxvalue 9999
nocache;

drop sequence seq_person_type;

create sequence seq_person_type


start with 101
increment by 1
maxvalue 999
nocache;

drop sequence seq_book_detail;

create sequence seq_book_detail


start with 201
increment by 1
maxvalue 9999
nocache;

drop sequence seq_issue_detail;


create sequence seq_issue_detail
start with 501
increment by 1
maxvalue 999
nocache;

drop sequence seq_fine_id;

create sequence seq_fine_id


start with 1
increment by 1
maxvalue 1000
nocache;

drop table people;

create table people(person_id number(6) primary key


,first_name varchar2(50) not null
,last_name varchar2(50) not null
,e_mail varchar2(50)
,date_of_birth date not null
,person_type_id number(6) not null
,gender varchar2(6) not null
,creation_date date not null
,created_by varchar2(50) not null
,last_updae_date date not null
,last_update_by varchar2(50) not null
,contact_no number(15)
,effective_start_date date not null
,effective_end_date date not null
);

drop table person_type;

create table person_type(person_type_id number(6) primary key


,system_person_type varchar2(20) not null
,user_person_type varchar2(20) not null
,creation_date date not null
,created_by varchar2(50) not null
,last_updae_date date not null
,last_update_by varchar2(50) not null
);

drop table books_detail;

create table books_detail(book_id number(6) primary key


,book_name varchar2(50) not null
,author varchar2(50) not null
,publisher varchar2(50) not null
,purchase_date date
,purchase_price number(5) not null
,status varchar2(50) not null
,creation_date date not null
,created_by varchar2(50) not null
,last_updated_date date not null
,last_update_by varchar2(50) not null
);

drop table issue_detail;

create table issue_detail(issue_id number(6) primary key


,person_id number(6) not null
,book_id number(6) not null
,issue_date date not null
,expected_return_date date not null
,actual_return_date date
,creation_date date not null
,created_by varchar2(50) not null
,last_updated_date date not null
,last_update_by varchar2(50) not null
);

drop table fine_records;

create table fine_records(fine_id number(6) primary key


,issue_id number(6) not null
,person_id number(6) not null
,book_id number(6) not null
,fine number(6) not null
,status varchar2(20) not null
,created_by varchar2(20) not null
,creation_date date not null
,last_update_by varchar2(20) not null
,last_updated_by date not null
);
-:PROCEDURE FOR PEOPLE API:-
CREATE OR REPLACE PROCEDURE per_people_api(p_first_name in varchar2
,p_last_name in varchar2
,p_e_mail in varchar2
,p_date_of_birth in date
,p_gender in varchar2
,p_contact_no in number
,p_system_person_type in varchar2
,p_user_person_type in varchar2
,p_person_id in number
,p_mode in varchar2
)
AS

v_first_name people.first_name %type := upper(p_first_name);


v_last_name people.last_name %type := upper(p_last_name) ;
v_e_mail people.e_mail %type := lower(p_e_mail) ;
v_date_of_birth date := p_date_of_birth ;
v_gender people.gender %type := p_gender ;
v_contact_no people.contact_no %type := p_contact_no ;
v_person_type_id people.person_type_id %type;
v_person_id people.person_id %type := p_person_id;
v_mode varchar2(10) := upper(p_mode);

v_first_valid_name VARCHAR2(10);
v_last_valid_name VARCHAR2(10);
v_valid_age VARCHAR2(10);
v_valid_gender VARCHAR2(10);
v_valid_per_type VARCHAR2(10);
v_valid_per_id VARCHAR2(10);

v_first_name_1 people.first_name %type;


v_last_name_1 people.last_name %type;
v_e_mail_1 people.e_mail %type ;
v_date_of_birth_1 date;
v_gender_1 people.gender %type ;
v_contact_no_1 people.contact_no %type;
v_person_type_id_1 people.person_type_id %type;

FUNCTION f_validation(p_string VARCHAR2


,p_mode VARCHAR2
);
RETURN VARCHAR2 AS
v_string VARCHAR2(50) := p_string;
v_count NUMBER(2);
v_length NUMBER(20);
v_age NUMBER(3);
v_validity VARCHAR2(20);

BEGIN
IF p_mode = 'fname' or p_mode = 'lname'
THEN v_length : = length(TRIM(v_string));
IF v_length >20 OR v_length IS NULL
THEN v_validity := 'invalid';
ELSE v_validity := 'valid';
END IF;

ELSIF p_mode = 'gender'

THEN
IF
v_string ='male' OR v_string ='female'
THEN
v_validity := 'valid';
ELSE
v_validity := 'invalid';
END IF;
ELSIF p_mode = 'age'
THEN

v_age:=to_char(SYSDATE,'yyyy')to_char(TO_DATE(v_string),'yyyy');

IF v_age >7
THEN v_validity := 'valid';
ELSE v_validity := 'invalid';
END IF;
ELSIF
p_mode = 'person_type_id'
THEN
SELECT count(*)
INTO v_count
FROM person_type
WHERE person_type_id=v_string;
IF
v_count=1
THEN
v_validity := 'valid';
ELSE
v_validity := 'invalid';
END IF;
ELSIF
p_mode = 'p_id'
THEN
SELECT count(*)
INTO v_count
FROM people
WHERE person_id = to_number(v_string);
IF
v_count=1
THEN
v_validity := 'valid';
ELSE
v_validity := 'invalid';
END IF;

END IF;
RETURN v_validity;
END;

BEGIN
IF v_mode = 'INSERT' OR v_mode = 'UPDATE'
THEN

v_first_name := trim(v_first_name);
v_last_name := trim(v_last_name);

v_first_valid_name := f_validation(v_first_name,'fname');
v_last_valid_name := f_validation(v_last_name,'lname');
v_valid_age := f_validation(v_date_of_birth,'age');
v_valid_gender := f_validation(v_gender,'gender');

IF v_mode = 'INSERT'
THEN
SELECT person_type_id
INTO v_person_type_id
FROM person_type
WHERE system_person_type=p_system_person_type
AND user_person_type=p_user_person_type ;
v_first_valid_name := f_validation(v_first_name,'fname');
v_last_valid_name := f_validation(v_last_name,'lname');
v_valid_age := f_validation(v_date_of_birth,'age');
v_valid_gender := f_validation(v_gender,'gender');

IF
v_first_valid_name = 'valid'
AND v_last_valid_name = 'valid'
AND v_valid_age = 'valid'
AND v_valid_gender = 'valid'

THEN

INSERT INTO people(person_id


,first_name
,last_name
,e_mail
,date_of_birth
,person_type_id
,gender
,creation_date
,created_by
,last_updae_date
,last_update_by
,contact_no
,effective_start_date
,effective_end_date
)
VALUES (seq_people.nextval
,v_first_name
,v_last_name
,v_e_mail
,v_date_of_birth
,v_person_type_id
,v_gender
,sysdate
,user
,sysdate
,user
,v_contact_no
,sysdate
,'31-DEC-9999'
);
ELSE
DBMS_OUTPUT.PUT_LINE('IN INSERT MODE');
DBMS_OUTPUT.PUT_LINE('FIRST_NAME_IS'||
V_FIRST_VALID_NAME);
DBMS_OUTPUT.PUT_LINE('LAST NAME IS '||V_LAST_VALID_NAME);
DBMS_OUTPUT.PUT_LINE('AGE IS '||V_VALID_AGE);
DBMS_OUTPUT.PUT_LINE('GENDER '||V_VALID_GENDER);
DBMS_OUTPUT.PUT_LINE('PERSON_TYPEE IS '||V_VALID_PER_TYPE);
END IF;
ELSIF v_mode ='UPDATE'
THEN
v_valid_per_id := f_validation(v_person_id,'p_id');

IF v_valid_per_id = 'valid'

THEN
IF p_system_person_type is not null and p_user_person_type is not null
THEN
SELECT person_type_id
INTO v_person_type_id
FROM person_type
WHERE system_person_type=p_system_person_type
AND user_person_type=p_user_person_type ;
END IF;
SELECT first_name
,last_name
,e_mail
,date_of_birth
,gender
,contact_no
,person_type_id
INTO v_first_name_1
,v_last_name_1
,v_e_mail_1
,v_date_of_birth_1
,v_gender_1
,v_contact_no_1
,v_person_type_id_1
FROM PEOPLE
WHERE person_id = v_person_id;
AND v_first_name := NVL(v_first_name,v_first_name_1);
AND v_last_name := NVL(v_last_name,v_last_name_1);
AND v_e_mail := NVL(v_e_mail,v_e_mail_1);
AND v_date_of_birth:= NVL(v_date_of_birth,v_date_of_birth_1);
AND v_gender := NVL(v_gender,v_gender_1);
AND v_contact_no := NVL(v_contact_no,v_contact_no_1);
AND v_person_type_id :=NVL(v_person_type_id,v_person_type_id_1);
AND v_first_valid_name := f_validation(v_first_name,'fname');
AND v_last_valid_name:= f_validation(v_last_name,'lname');
AND v_valid_age := f_validation(v_date_of_birth,'age');
AND v_valid_gender := f_validation(v_gender,'gender');
AND v_valid_per_type:=f_validation(v_person_type_id,'person_type_id');

IF
v_first_valid_name = 'valid'
AND v_last_valid_name = 'valid'
AND v_valid_age = 'valid'
AND v_valid_gender = 'valid'
AND v_valid_per_type = 'valid'
THEN
UPDATE people
SET
last_updae_date = sysdate
,last_update_by = user
WHERE person_id = v_person_id;
UPDATE people
SET
first_name = v_first_name
,last_name = v_last_name
,e_mail = v_e_mail
,date_of_birth = v_date_of_birth
,gender = v_gender
,contact_no = v_contact_no
,person_type_id = v_person_type_id
WHERE person_id = v_person_id;
ELSE
DBMS_OUTPUT.PUT_LINE('IN UPDATE MODE');
DBMS_OUTPUT.PUT_LINE('LASTNAMEIS'||
V_LAST_VALID_NAME);
DBMS_OUTPUT.PUT_LINE('AGE IS '||V_VALID_AGE);
DBMS_OUTPUT.PUT_LINE('GENDER '||V_VALID_GENDER);

DBMS_OUTPUT.PUT_LINE('PERSON_TYPEE IS '||V_VALID_PER_TYPE);
END IF;

ELSE
DBMS_OUTPUT.PUT_LINE('PERSON_ID IS '||v_valid_per_id);
END IF;
END IF;
ELSE
DBMS_OUTPUT.PUT_LINE('enter valid option');
END IF;

COMMIT;
EXCEPTION WHEN no_data_found
THEN DBMS_OUTPUT.PUT_LINE('no data found');
WHEN too_many_rows
THEN DBMS_OUTPUT.PUT_LINE('more than one row selected ');
WHEN others
THEN DBMS_OUTPUT.PUT_LINE('error in inserting or updating values,plz check
the values);
END;
/

Potrebbero piacerti anche