Professional Documents
Culture Documents
values(279,'MAINTENANCE',204,2700);
--correction
insert into departments (department_id, department_name, manager_id, location_id)
values(310, '310Dept',145, 1700);
update employees
set last_name ='stuart'
where last_name = 'Greenberg';
update employees
set email = LOWER(email);
commit;
commit;
rollback;
commit;
commit;
rollback;
savepoint save01;
savepoint save02;
savepoint save03;
ROLLBACK TO save02;
commit;
desc emp_new;
-- ALTER TABLE statement
alter table emp rename to emp_new;
alter table emp_new add(testcol varchar2(100));
alter table emp_new rename column testcol to testnew;
alter table emp_new drop column testnew;
alter table emp_new add primary key (emp_id,ename);
alter table emp_new drop primary key;
alter table emp_new rename column empid to emp_id;
--Read
create table oratest(id number);
insert into oratest values(1);
alter table oratest read only;
insert into oratest values(3); -- SQL Error: ORA-12081: update operation not
allowed on table "HR"."ORATEST"
update oratest set id = 2; -- SQL Error: ORA-12081: update operation not allowed on
table "HR"."ORATEST"
delete from oratest; -- SQL Error: ORA-12081: update operation not allowed on table
"HR"."ORATEST"
truncate oratest; -- SQL Error: ORA-03290: Invalid truncate command - missing
CLUSTER or TABLE keyword
alter table oratest add (descrpt varchar2(50));
descr oratest;
alter table oratest read write;
delete from oratest;
drop table oratest;
drop table oratest purge;
rollback;
desc empd50;
update empd50
set last_name = 'Warner'
where last_name = 'Vollman';
update empd50
set department_id = 40
where last_name = 'Warner'; -- SQL Error: ORA-01402: view WITH CHECK OPTION where-
clause violation
desc emp_vu;
-- Sequence
create sequence SEQ_INT_BY100
increment by 100
start with 1000
maxvalue 100000
minvalue 1000
cache 20;