Documente Academic
Documente Profesional
Documente Cultură
Table dropped.
SQL> ed
Wrote file afiedt.buf
Table created.
SQL> ed
Wrote file afiedt.buf
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> ed
Wrote file afiedt.buf
1 select constraint_name,constraint_type
2 from user_constraints
3* where table_name='branch_mstr'
4 /
no rows selected
SQL> ed
Wrote file afiedt.buf
1 select constraint_name,constraint_type
2 from user_constraints
3* where table_name=upper('branch_mstr')
4 /
CONSTRAINT_NAME C
------------------------------ -
BRANCHNO_NN C
NAME_NN C
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> ed
Wrote file afiedt.buf
1 select constraint_name,constraint_type
2 from user_constraints
3* where table_name=upper('branch_mstr')
4
SQL>
SQL>
SQL> insert into branch_mstr values(1001,'APET');
1 row created.
SQL> ed
Wrote file afiedt.buf
1 row created.
SQL> ed
Wrote file afiedt.buf
SQL> ed
Wrote file afiedt.buf
BRANCH_NO NAME
---------- --------------------
1001 APET
1001 SRNAG
Table dropped.
SQL> ed
Wrote file afiedt.buf
Table created.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select constraint_name,constraint_type,index_name
2 from user_tables
3
SQL>
SQL>
SQL> ed
Wrote file afiedt.buf
line 3 truncated.
1 select constraint_name,constraint_type,index_name
2 from user_constraints
3* where table_name='BRANCH_MSTR
SQL> /
ERROR:
ORA-01756: quoted string not properly terminated
SQL> ed
Wrote file afiedt.buf
1 select constraint_name,constraint_type,index_name
2 from user_constraints
3* where table_name='BRANCH_MSTR'
SQL> /
CONSTRAINT_NAME C INDEX_NAME
------------------------------ - ------------------------------
NAME_NN C
BRANCHNO_UNQ U BRANCHNO_UNQ
------------------------------ - ------------------------------
NAME_NN C
BRANCHNO_UNQ U BRANCHNO_UNQ
1 select empno,ename,sal,deptno
2 from emp
3 where deptno=10
4* The sta display 10th dept details
5 /
The sta display 10th dept details
*
ERROR at line 4:
ORA-00933: SQL command not properly ended
SQL> ed
Wrote file afiedt.buf
1 select empno,ename,sal,deptno
2 from emp
3 where deptno=10
4* --The sta display 10th dept details
5 /
SQL> ed
Wrote file afiedt.buf
1 select empno,ename,sal,deptno
2 from emp
3 /*where deptno=10
4* order by sal desc*/
5 /
14 rows selected.
SQL> ed
Wrote file afiedt.buf
1 declare
2 vsal number:=2000;
3 vsal:=3000;
4 begin
5 null;
6* end;
7 /
vsal:=3000;
*
ERROR at line 3:
ORA-06550: line 3, column 5:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
constant exception <an identifier>
<a double-quoted delimited-identifier> table long double ref
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "=" to continue.
SQL> ed
Wrote file afiedt.buf
1 declare
2 vsal number:=2000;
3 begin
4 vsal:=3000;
5* end;
6 /
1 declare
2 vsal number:=2000;
3 begin
4 vsal:=3000;
5* end;
6 .
SQL> ed
Wrote file afiedt.buf
1 declare
2 vsal number:=2000;
3 begin
4 vsal:=3000;
5* end;
6
7 .
SQL> clear screen
SQL> create table
2
SQL>
SQL> ed
Wrote file afiedt.buf
SQL> ed
Wrote file afiedt.buf
Table created.
SQL> ed
Wrote file afiedt.buf
ENAME
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
14 rows selected.
Table created.
14 rows selected.
14 rows deleted.
USERID DOD
-------------------- ---------
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
JONES 29-DEC-15
14 rows selected.
SQL> rollback;
Rollback complete.
SQL> rollback;
Rollback complete.
no rows selected
14 rows selected.
14 rows deleted.
USERID DOD
-------------------- ---------
JONES 29-DEC-15
SQL> rollback;
Rollback complete.
Table created.
14 rows selected.
no rows selected
Trigger created.
SQL> ed
Wrote file afiedt.buf
Trigger created.
Trigger created.
1 row created.
15 rows selected.
SQL> rollback;
Rollback complete.
14 rows selected.
14 rows selected.
Table created.
Trigger created.
3 rows deleted.
SQL> rollback;
Rollback complete.
SQL> rollback;
Rollback complete.
14 rows selected.
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
SQL> create or
2 .
SQL> ed
Wrote file afiedt.buf
Trigger created.
SQL> ed
Wrote file afiedt.buf
SQL> rollback;
Rollback complete.
SQL> ed
Wrote file afiedt.buf
line 15 truncated.
1 create or replace trigger trg_cnt
2 before delete
3 on dept
4 for each row
5 declare
6 cnt number;
7 begin
8 select count(*) into cnt
9 from emp
10 where deptno=:old.deptno;
11 if cnt>3 then
12 raise_application_error
13 (-20346,:old.deptno||' is having more than 3 emps');
14 end if;
15* end
SQL>
SQL>
SQL> create or replace
2 .
SQL> ed
Wrote file afiedt.buf
Trigger created.
Table created.
SQL> ed
Wrote file afiedt.buf
Table created.
SQL> ed
Wrote file afiedt.buf
Table created.
SQL> ed
Wrote file afiedt.buf
Trigger created.
SQL> insert into emp(empno,ename,deptno) values(1001,'JAN',20);
insert into emp(empno,ename,deptno) values(1001,'JAN',20)
*
ERROR at line 1:
ORA-01400: cannot insert NULL into ("JONES"."EMP"."JOB")
SQL> ed
Wrote file afiedt.buf
1 row created.
6 rows updated.
6 rows deleted.
1001 JAN 20
6 rows selected.
6 rows selected.
SQL> rollback;
Rollback complete.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> exit