Wednesday, October 8, 2008

DBMS PRACTICAL 4 TRANSACTION


SQL> create table emp57(emp_id int,name varchar(20),dept_id int);
create table emp57(emp_id int,name varchar(20),dept_id int)
*
ERROR at line 1:
ORA-00955: name is already used by an existing object


SQL> create table emp257(emp_id int,name varchar(20),dept_id int);

Table created.

SQL> create table dept257(dept_id int,dept_name varchar(20));

Table created.

SQL> insert into emp257 values(01,'MAYANK SHARMA',101);

1 row created.

SQL> insert into emp257 values(02,'BHUSHAN TALEKAR',102);

1 row created.

SQL> insert into emp257 values(03,'SAURABH SHETTY',103);

1 row created.

SQL> insert into emp257 values(04,'ADITYA LOHIA',104);

1 row created.

SQL>
SQL> insert into emp257 values(05,'SACHIN JOSHI',105);

1 row created.

SQL> insert into dept257 values(101,'INFT');

1 row created.

SQL> insert into dept257 values(102,'EXTC');

1 row created.

SQL> insert into dept257 values(103,'MECH');

1 row created.

SQL> insert into dept257 values(104,'COMP');

1 row created.

SQL> insert into dept257 values(105,'INST');

1 row created.

SQL> select * from emp257;

EMP_ID NAME DEPT_ID
---------- -------------------- ----------
1 MAYANK SHARMA 101
2 BHUSHAN TALEKAR 102
3 SAURABH SHETTY 103
4 ADITYA LOHIA 104
5 SACHIN JOSHI 105

SQL> select * from dept257;

DEPT_ID DEPT_NAME
---------- --------------------
101 INFT
102 EXTC
103 MECH
104 COMP
105 INST

SQL> rollback work;

Rollback complete.

SQL> select * from emp257;

no rows selected

SQL> select * from dept257;

no rows selected

SQL> begin transaction;
2 insert into emp257 values(01,'MAYANK SHARMA',101);
3 insert into dept257 values(101,'INFT');
4 commit work;
4 commit work;
5 /
commit work;
*
ERROR at line 4:
ORA-06550: line 4, column 12:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with

No comments:

Post a Comment

JTSEARCH