0% found this document useful (0 votes)
3 views5 pages

Oracle SQL*Plus Commands and Errors

sql

Uploaded by

dayanandbhivase
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)
3 views5 pages

Oracle SQL*Plus Commands and Errors

sql

Uploaded by

dayanandbhivase
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 Tue Jul 22 10:05:59 2025

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

Enter user-name: scott


Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied

Enter user-name: scott


Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release [Link].0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set linesize 100 pagesize 100;


SQL> .select * from tab;
SP2-0734: unknown command beginning ".select * ..." - rest of line ignored.
SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
BONUS TABLE
CARS TABLE
CARS2 TABLE
DEPT TABLE
EMP TABLE
EMPLOYEES TABLE
SALGRADE TABLE
SECONDCARS TABLE
SHOWROOM TABLE
SHOWROOM1 TABLE

10 rows selected.

SQL> truncate table cars;

Table truncated.

SQL> describe cars;


Name Null? Type
----------------------------------------------------- --------
------------------------------------
CNO NOT NULL NUMBER
CNAME NOT NULL VARCHAR2(10)
CLNAME NOT NULL VARCHAR2(10)
COMPANY NOT NULL VARCHAR2(5)

SQL> select * from cars;

no rows selected

SQL> drop table cars;


drop table cars
*
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys

SQL> drop table cars;


drop table cars
*
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys

SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
BONUS TABLE
CARS TABLE
CARS2 TABLE
DEPT TABLE
EMP TABLE
EMPLOYEES TABLE
SALGRADE TABLE
SECONDCARS TABLE
SHOWROOM TABLE
SHOWROOM1 TABLE

10 rows selected.

SQL> drop table secondcars;

Table dropped.

SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
BIN$KMEA21KYRISVa0KvGVAT7w==$0 TABLE
BONUS TABLE
CARS TABLE
CARS2 TABLE
DEPT TABLE
EMP TABLE
EMPLOYEES TABLE
SALGRADE TABLE
SHOWROOM TABLE
SHOWROOM1 TABLE

10 rows selected.

SQL> show recyclebin;


ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
SECONDCARS BIN$KMEA21KYRISVa0KvGVAT7w==$0 TABLE 2025-07-22:10:10:36
SQL> flashback table secondcars to before drop;

Flashback complete.

SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
BONUS TABLE
CARS TABLE
CARS2 TABLE
DEPT TABLE
EMP TABLE
EMPLOYEES TABLE
SALGRADE TABLE
SECONDCARS TABLE
SHOWROOM TABLE
SHOWROOM1 TABLE

10 rows selected.

SQL> show recyclebin;


SQL> drop table secondcars purge;

Table dropped.

SQL> select * from tab;

TNAME TABTYPE CLUSTERID


------------------------------ ------- ----------
BONUS TABLE
CARS TABLE
CARS2 TABLE
DEPT TABLE
EMP TABLE
EMPLOYEES TABLE
SALGRADE TABLE
SHOWROOM TABLE
SHOWROOM1 TABLE

9 rows selected.

SQL> insert into cars1 value('1','vw','white');


insert into cars1 value('1','vw','white')
*
ERROR at line 1:
ORA-00928: missing SELECT keyword

SQL> insert into showroom value('1','vw','white');


insert into showroom value('1','vw','white')
*
ERROR at line 1:
ORA-00928: missing SELECT keyword

SQL> insert into showroom values('1','vw','white');


insert into showroom values('1','vw','white')
*
ERROR at line 1:
ORA-01722: invalid number

SQL> describe cars1;


ERROR:
ORA-04043: object cars1 does not exist
SQL> describe cars2;
Name Null? Type
----------------------------------------------------- --------
------------------------------------
CNO NOT NULL NUMBER(2)
CNAME NOT NULL VARCHAR2(10)
COLOR NOT NULL VARCHAR2(10)

SQL> describe showroom;


Name Null? Type
----------------------------------------------------- --------
------------------------------------
SNAME NOT NULL VARCHAR2(10)
LOC NOT NULL VARCHAR2(10)
CNO NUMBER

SQL> insert into cars2 values('1','vw','brown');

1 row created.

SQL> select * from cars2;

CNO CNAME COLOR


---------- ---------- ----------
1 vw brown

SQL> update cars2


2
SQL>
SQL> insert into cars2 values('2','tata','black');

1 row created.

SQL> update cars2


2 set cname='toyota'
3 where cno='1';

1 row updated.

SQL> select * from cars2;

CNO CNAME COLOR


---------- ---------- ----------
1 toyota brown
2 tata black

SQL> delete from cars2


2 where cno='2';

1 row deleted.

SQL> select * from cars2;

CNO CNAME COLOR


---------- ---------- ----------
1 toyota brown
SQL>

You might also like