0% found this document useful (0 votes)
16 views2 pages

Shreya

The document details a SQL session where a user attempts to create a table but encounters an error due to a name conflict. After successfully creating a new table 'studentt', the user inserts four records and retrieves them. Additionally, a PL/SQL block is executed to fetch and display records from the 'studentt' table based on a specific department filter.

Uploaded by

nehabamane6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

Shreya

The document details a SQL session where a user attempts to create a table but encounters an error due to a name conflict. After successfully creating a new table 'studentt', the user inserts four records and retrieves them. Additionally, a PL/SQL block is executed to fetch and display records from the 'studentt' table based on a specific department filter.

Uploaded by

nehabamane6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

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>

You might also like