You are on page 1of 6

Microsoft Windows XP [Version 5.1.

2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Newhorizon>set oracle_sid=newhoriz
C:\Documents and Settings\Newhorizon>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 21 01:37:23 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: hr
Enter password:
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> create table emp45(employee_id number(10), job_id varachar2(10), salary num
ber(4,2));
create table emp45(employee_id number(10), job_id varachar2(10), salary number(4
,2))
*
ERROR at line 1:
ORA-00907: missing right parenthesis

SQL> ed
Wrote file afiedt.buf
1* create table emp45(employee_id number(10), job_id varachar2(10), salary num
ber(4,2))
SQL> /
create table emp45(employee_id number(10), job_id varachar2(10), salary number(4
,2))
*
ERROR at line 1:
ORA-00907: missing right parenthesis

SQL> create table emp66 (employee_id number(10), job_id varchar2(10), salary num
ber(6,4));
Table created.
SQL> insert into emp66 (employee_id, job_id, salary)
2 values(114, hr, 10000);
values(114, hr, 10000)
*
ERROR at line 2:
ORA-00984: column not allowed here

SQL> ed
Wrote file afiedt.buf
1 insert into emp66 (employee_id, job_id, salary)
2* values(1, hr, 100)
SQL> /
values(1, hr, 100)
*
ERROR at line 2:
ORA-00984: column not allowed here

SQL> ed
Wrote file afiedt.buf
1 insert into emp66 (employee_id, job_id, salary)
2* values(1, hr, 10)
SQL> /
values(1, hr, 10)
*
ERROR at line 2:
ORA-00984: column not allowed here

SQL> ed
Wrote file afiedt.buf
1 insert into emp66 (employee_id, job_id, salary)
2* values(1,' hr', 10)
SQL> /
1 row created.
SQL> create table emp88(department_id number(20), job_id varchar2(20));
Table created.
SQL> inert into emp88(department_id, job_id)
SP2-0734: unknown command beginning "inert into..." - rest of line ignored.
SQL> ed
Wrote file afiedt.buf
1* create table emp88(department_id number(20), job_id varchar2(20))
SQL> /
create table emp88(department_id number(20), job_id varchar2(20))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object

SQL> insert into emp88 (department_id , job_id)


2 values (2, 'hr');
1 row created.
SQL> update emp88
2 set department_id = (select department_id
3 from employees
4 where employee_id = 100)
5 where job_id = (select job_id
6 from employees
7 where employee_id = 200);
0 rows updated.
SQL> select * from emp88;
DEPARTMENT_ID JOB_ID
------------- --------------------
2 hr
SQL> select job_id
2 from employees
3 where employee_id=200;
JOB_ID
----------
AD_ASST
SQL> delete from emp88
2 where department_id = (select department_id
3 from departments
4 where department_name
5 like '%public%');
0 rows deleted.
SQL> insert into select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5 values (2, 'smith', 'jsmith');
insert into select employee_id
*
ERROR at line 1:
ORA-00903: invalid table name

SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5* values (2, 'smith', 'jsmith')
SQL> /
where department_id = 50
*
ERROR at line 3:
ORA-00904: "DEPARTMENT_ID": invalid identifier

SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5* values (2, 'smith', 'jsmith')
SQL> /
where department_id = 50
*
ERROR at line 3:
ORA-00904: "DEPARTMENT_ID": invalid identifier
SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5* values (2, 'smith', 'jsmith')
SQL> /
where department_id = 50
*
ERROR at line 3:
ORA-00904: "DEPARTMENT_ID": invalid identifier

SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5* values (2)
SQL> /
where department_id = 50
*
ERROR at line 3:
ORA-00904: "DEPARTMENT_ID": invalid identifier

SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where department_id = 50
4 with check option)
5* values 2
SQL> /
where department_id = 50
*
ERROR at line 3:
ORA-00904: "DEPARTMENT_ID": invalid identifier

SQL> ed
Wrote file afiedt.buf
1 insert into( select employee_id
2 from emp66
3 where employee_id = 50
4 with check option)
5* values (2)
SQL> /
from emp66
*
ERROR at line 2:
ORA-01402: view WITH CHECK OPTION where-clause violation
SQL> select *
2 from emp66;
EMPLOYEE_ID JOB_ID SALARY
----------- ---------- ----------
1 hr 10
SQL> insert into(select employee_id,job_id
2 from emp66
3 where employee_id=1
4 with check option)
5 values (1,'ht');
1 row created.
SQL> select *
2 from emp66;
EMPLOYEE_ID JOB_ID SALARY
----------- ---------- ----------
1 hr 10
1 ht
SQL> create table sal_history (empid number(10), hiredate date, salary number(8,
2));
create table sal_history (empid number(10), hiredate date, salary number(8,2))
*
ERROR at line 1:
ORA-00955: name is already used by an existing object

SQL> ed
Wrote file afiedt.buf
1* create table sal_histo (empid number(10), hiredate date, salary number(8,2)
)
SQL> /
Table created.
SQL> create table sal_hi (empid number(10), hiredate date, salary number(8,2));
Table created.
SQL> insert all
2 into sal_histo values (empid, hiredate, salary)
3 into sal_hi values (empid, hiredate, salary)
4 select employee_id empid, hire_date hiredate,
5 salary sal, manager_id mgr
6 from employees
7 where employee_id > 200;
into sal_hi values (empid, hiredate, salary)
*
ERROR at line 3:
ORA-00904: "SALARY": invalid identifier

SQL> ed
Wrote file afiedt.buf
1 insert all
2 into sal_histo values (empid, hiredate, salary)
3 into sal_hi values (empid, hiredate, salary)
4 select employee_id empid, hire_date hiredate,
5 salary , manager_id mgr
6 from employees
7* where employee_id > 200
SQL> /
12 rows created.
SQL> select *
2 from sal_histo;
EMPID HIREDATE SALARY
---------- --------- ----------
201 17-FEB-96 13650
202 17-AUG-97 6300
203 07-JUN-94 6825
204 07-JUN-94 10500
205 07-JUN-94 12600
206 07-JUN-94 8715
6 rows selected.
SQL> select *
2 from sal_hi;
EMPID HIREDATE SALARY
---------- --------- ----------
201 17-FEB-96 13650
202 17-AUG-97 6300
203 07-JUN-94 6825
204 07-JUN-94 10500
205 07-JUN-94 12600
206 07-JUN-94 8715
6 rows selected.
SQL>

You might also like