SQL*Plus: Release 10.2.0.1.
0 - Production on Fri Oct 18 11:12:14 2024
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn
Enter user-name: system
Enter password:
Connected.
SQL> create table stud(stud_id number, stud_name varchar2(10), stud_department
varchar2(10));
create table stud(stud_id number, stud_name varchar2(10), stud_department
varchar2(10))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object
SQL> create table studentt(stud_id number, stud_name varchar2(10), stud_department
varchar2(10));
Table created.
SQL> insert into studentt values(1, 'Shreya', 'AI');
1 row created.
SQL> insert into studentt values(2, 'Pranali', 'CO');
1 row created.
SQL> insert into studentt values(3, 'Divya', 'IT');
1 row created.
SQL> insert into studentt values(4, 'Praktisha', 'EE');
1 row created.
SQL> select*from studentt;
STUD_ID STUD_NAME STUD_DEPAR
---------- ---------- ----------
1 Shreya AI
2 Pranali CO
3 Divya IT
4 Praktisha EE
SQL> declare
2 CURSOR c2 IS select*from studentt
3 where stud_department='CO';
4 srec studentt%rowtype;
5 begin
6 open c2;
7 loop
8 fetch c2 into srec;
9 dbms_output.put_line(srec.stud_id ||''|| srec.stud_name ||''||
srec.stud_department);
10 exit when c2%notfound;
11 end loop;
12 close c2;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>