0% found this document useful (0 votes)
2 views4 pages

Oracle SQL Commands and Errors Guide

The document contains a series of SQL commands executed in Oracle SQL*Plus, including descriptions of tables, insertions, updates, and grants of privileges. It highlights errors encountered during operations, such as invalid table names and insufficient privileges. The final state of the 'owners' table is presented, showing the successful updates and deletions made to the records.

Uploaded by

marulasiddeshks
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)
2 views4 pages

Oracle SQL Commands and Errors Guide

The document contains a series of SQL commands executed in Oracle SQL*Plus, including descriptions of tables, insertions, updates, and grants of privileges. It highlights errors encountered during operations, such as invalid table names and insufficient privileges. The final state of the 'owners' table is presented, showing the successful updates and deletions made to the records.

Uploaded by

marulasiddeshks
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

SQL*Plus: Release [Link].

0 - Production on Mon Dec 19 20:33:42 2022

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release [Link].0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> desc avengers;


ERROR:
ORA-04043: object avengers does not exist

SQL> select*from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
RANJU TABLE
LIBRARY TABLE
RANJITHA TABLE
LIBRAY TABLE
CLASSROMS TABLE
OWNERS TABLE
OFFICES TABLE

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
CONSULATMT TABLE
KAVYA TABLE

13 rows selected.

SQL> desc owners;


Name Null? Type
----------------------------------------- -------- ----------------------------
ID NOT NULL NUMBER(4)
NAME NOT NULL VARCHAR2(10)
EMAIL VARCHAR2(15)
PHONE NOT NULL NUMBER(10)
ADDRESS NOT NULL VARCHAR2(20)

SQL> insert into values(1,'ranju','ranju@[Link]',9876543212,'thumkur');


insert into values(1,'ranju','ranju@[Link]',9876543212,'thumkur')
*
ERROR at line 1:
ORA-00903: invalid table name

SQL> insert into owners values(1,'ranju','ranju@[Link]',9876543212,'thumkur');

1 row created.

SQL> insert all


2 into owners values(2,'moni','moni@[Link]',9363637489,'mandya')
3 into owners values(3,'aishu','aishu@[Link]',8765435678,'kolar')
4 select*from dual;

2 rows created.

SQL> select*from owners;

ID NAME EMAIL PHONE ADDRESS


---------- ---------- --------------- ---------- --------------------
1 ranju ranju@[Link] 9876543212 thumkur
2 moni moni@[Link] 9363637489 mandya
3 aishu aishu@[Link] 8765435678 kolar

SQL> grant select on owners to hr;

Grant succeeded.

SQL> connect hr;


Enter password: *****
Connected.
SQL> select*from [Link];

ID NAME EMAIL PHONE ADDRESS


---------- ---------- --------------- ---------- --------------------
1 ranju ranju@[Link] 9876543212 thumkur
2 moni moni@[Link] 9363637489 mandya
3 aishu aishu@[Link] 8765435678 kolar

SQL> connect scott;


Enter password: *****
Connected.
SQL> revoke select on owners from hr;

Revoke succeeded.

SQL> connect hr;


Enter password: *****
Connected.
SQL> select*from [Link];
select*from [Link]
*
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> connect scott;


Enter password: *****
Connected.
SQL> grant all on owners to hr;

Grant succeeded.

SQL> connect hr;


Enter password: *****
Connected.
SQL> insert into [Link]
value(4,'monu','monij@[Link]',9836478292,'mysore');
insert into [Link] value(4,'monu','monij@[Link]',9836478292,'mysore')
*
ERROR at line 1:
ORA-00928: missing SELECT keyword

SQL> insert into [Link]


values(4,'monu','monij@[Link]',9836478292,'mysore');

1 row created.

SQL> delect [Link]


SP2-0734: unknown command beginning "delect sco..." - rest of line ignored.
SQL> delect from [Link]
SP2-0734: unknown command beginning "delect fro..." - rest of line ignored.
SQL> delete from [Link]
2 where id=2;

1 row deleted.

SQL> select*from [Link];

ID NAME EMAIL PHONE ADDRESS


---------- ---------- --------------- ---------- --------------------
1 ranju ranju@[Link] 9876543212 thumkur
3 aishu aishu@[Link] 8765435678 kolar
4 monu monij@[Link] 9836478292 mysore

SQL> update [Link]


2 set name=monika
3 where id=3;
set name=monika
*
ERROR at line 2:
ORA-00904: "MONIKA": invalid identifier

SQL> update [Link]


2 set id=4
3 ;
update [Link]
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C005459) violated

SQL> update [Link]


2 set address=mandya
3 where name=aishu;
where name=aishu
*
ERROR at line 3:
ORA-00904: "AISHU": invalid identifier

SQL> update [Link]


2 set address=mandya
3 where id=3;
set address=mandya
*
ERROR at line 2:
ORA-00904: "MANDYA": invalid identifier

SQL> update [Link]


2 set address='mandya'
3 where id=3;

1 row updated.

SQL> select*from [Link];

ID NAME EMAIL PHONE ADDRESS


---------- ---------- --------------- ---------- --------------------
1 ranju ranju@[Link] 9876543212 thumkur
3 aishu aishu@[Link] 8765435678 mandya
4 monu monij@[Link] 9836478292 mysore

SQL> connect scott;


Enter password: *****
Connected.
SQL> revock select on owners from hr
SP2-0734: unknown command beginning "revock sel..." - rest of line ignored.
SQL> revoke select on owners from hr;

Revoke succeeded.

SQL> grant dba to hr;


grant dba to hr
*
ERROR at line 1:
ORA-01031: insufficient privileges

SQL> grant dba to hr;


grant dba to hr
*
ERROR at line 1:
ORA-01031: insufficient privileges

SQL> grant dba to scott;


grant dba to scott
*
ERROR at line 1:

You might also like