ORA-01403: no data found

I created a table. I left it empty. I created an anonymous block to extract data from the table. I got this error.
SQL> create table employee(
2 employee_id int primary key,
3 manager_id int,
4 department_id int,
5 first_name varchar2(20),
6 last_name varchar2(20),
7 email varchar2(30),
8 phone_number number(20),
9 hire_date date,
10 job_id int,
11 salary number,
12 commission_pct number);
Table created.
SQL> declare fir_name varchar2(20);
2 begin
3 select first_name into fir_name from employee;
4 end;
5 /
declare fir_name varchar2(20);
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 3
SQL> select * from employee;
no rows selected
SQL> insert into employee(first_name) values (‘learnersreference’);
1 row created.
SQL> select first_name from employee;
FIRST_NAME
——————–
learnersreference
SQL> declare fir_name varchar2(20);
2 begin
3 select first_name into fir_name from employee;
4 end;
5 /
PL/SQL procedure successfully completed.

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner

Enter your email address:

Delivered by FeedBurner