mrinal212

download mrinal212

of 5

Transcript of mrinal212

  • 8/8/2019 mrinal212

    1/5

    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: hrEnter password:

    Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith 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> edWrote file afiedt.buf

    1* create table emp45(employee_id number(10), job_id varachar2(10), salary number(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 number(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> edWrote file afiedt.buf

    1 insert into emp66 (employee_id, job_id, salary)

    2* values(1, hr, 100)SQL> /values(1, hr, 100)

  • 8/8/2019 mrinal212

    2/5

    *ERROR at line 2:ORA-00984: column not allowed here

    SQL> edWrote 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> edWrote 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> edWrote 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 emp882 set department_id = (select department_id3 from employees4 where employee_id = 100)5 where job_id = (select job_id6 from employees7 where employee_id = 200);

    0 rows updated.

    SQL> select * from emp88;

  • 8/8/2019 mrinal212

    3/5

    DEPARTMENT_ID JOB_ID------------- --------------------

    2 hr

    SQL> select job_id2 from employees3 where employee_id=200;

    JOB_ID----------AD_ASST

    SQL> delete from emp882 where department_id = (select department_id3 from departments4 where department_name5 like '%public%');

    0 rows deleted.

    SQL> insert into select employee_id2 from emp663 where department_id = 504 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_id2 from emp663 where department_id = 504 with check option)5* values (2, 'smith', 'jsmith')

    SQL> /where department_id = 50

    *ERROR at line 3:ORA-00904: "DEPARTMENT_ID": invalid identifier

    SQL> edWrote file afiedt.buf

    1 insert into( select employee_id2 from emp663 where department_id = 504 with check option)5* values (2, 'smith', 'jsmith')

    SQL> /where department_id = 50

    *

    ERROR at line 3:ORA-00904: "DEPARTMENT_ID": invalid identifier

  • 8/8/2019 mrinal212

    4/5

    SQL> edWrote file afiedt.buf

    1 insert into( select employee_id2 from emp663 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> edWrote file afiedt.buf

    1 insert into( select employee_id2 from emp663 where department_id = 504 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_id2 from emp663 where department_id = 504 with check option)5* values 2

    SQL> /where department_id = 50

    *ERROR at line 3:ORA-00904: "DEPARTMENT_ID": invalid identifier

    SQL> edWrote file afiedt.buf

    1 insert into( select employee_id2 from emp663 where employee_id = 504 with check option)5* values (2)

    SQL> /from emp66

    *

    ERROR at line 2:ORA-01402: view WITH CHECK OPTION where-clause violation

  • 8/8/2019 mrinal212

    5/5

    SQL> select *2 from emp66;

    EMPLOYEE_ID JOB_ID SALARY----------- ---------- ----------

    1 hr 10

    SQL> insert into(select employee_id,job_id2 from emp663 where employee_id=14 with check option)5 values (1,'ht');

    1 row created.

    SQL> select *2 from emp66;

    EMPLOYEE_ID JOB_ID SALARY----------- ---------- ----------1 hr 101 ht

    SQL>