Решения практических упражнений дисциплины "Теория экономических информационных систем", страница 6

center 'Список сотрудников' skip –

center '    по отделам    ' skip –

center '-----------------------------' skip 3

column a format a10 heading 'Отдел'

column b format a10 heading 'Фамилия | сотрудника'

column с format a8 heading 'Дата | приема'

column d format 9,99,999 heading 'Месячный | оклад | в ($)'

col e like d heading 'Годовой | оклад | в ($) '

col f like d heading 'Общий | доход | в ($) '

break on a skip page on report

compute sum of def on report

set term on

select initcap(d.dname) a, initcap(e.ename) b,

to_char(e.hiredate,'dd.mm.yy') c, e.sal d,

e.sal*12 e, e.sal*12+nvl(e.comm,0) f

from     emp e, dept d

where e.deptno = d.deptno

order by d.dname

/

column a clear

column b clear

col с clear

col d clear

column f clear

rem Восстановить значения параметров среды SQL*Pius,

rem которые они имели до выполнения командного файла

start login, sql

set echo on

результат

Server: Msg 195, Level 15, State 5, Line 1

'echo' is not a recognized option.

Server: Msg 195, Level 15, State 1, Line 2

'feed' is not a recognized option.

Server: Msg 195, Level 15, State 1, Line 3

'pages' is not a recognized SET statement.

Server: Msg 195, Level 15, State 1, Line 4

'lines' is not a recognized SET statement.

Server: Msg 195, Level 15, State 1, Line 5

'term' is not a recognized option.

Server: Msg 195, Level 15, State 1, Line 7

'to_char' is not a recognized function name.

Server: Msg 135, Level 15, State 1, Line 20

Cannot use a BREAK statement outside the scope of a WHILE statement.

Server: Msg 195, Level 15, State 1, Line 22

'term' is not a recognized option.

Server: Msg 195, Level 15, State 1, Line 23

'initcap' is not a recognized function name.

Server: Msg 195, Level 15, State 1, Line 38

'echo' is not a recognized option.

Решения упражнений: урок 11

      CREATE   TABLE COMPANY_CARS (

             CHASSIS_NUMBER VARCHAR2(20 )

                  CONSTRAINT CC_CH_NO_NNULL NOT NULL

                  CONSTRAINT CC_CH_NO_PK PRIMARY KEY,

        MAKE    VARCHAR2 ( 15 )

             CONSTRAINT CC_MAKE_CHKUPP

                   CHECK (MAKE=UPPER (MAKE) ) ,

        MODEL   VARCHAR2(15)

             CONSTRAINT CC_MODEL_CHKUPP

                   CHECK (MODEL=UPPER (MODEL) ) ,

        CUB_CAP NUMBER (4),

        COLOUR VARCHAR2 ( 10 ) ,

        DOR     DATE,

        REG_NO VARCHAR2 (10)

            CONSTRAINT CC_REG_NO_CHKUPP

                   CHECK (REG_NO = UPPER (REG_NO))

            CONSTRAINT CC_REG_NO_NNULL NOT NULL,

        EMPNO   NUMBER ( 4 )

           CONSTRAINT CC_EMPNO_NNULL NOT NULL

           CONSTRAINT CC_EMPNO_FK

                   REFERENCES EMP (EMPNO),

        DEPTNO NUMBER (2)

           CONSTRAINT CC_DEPTNO_NNULL NOT NULL

           CONSTRAINT CC_DEPTNO_FK

                   REFERENCES DEPT (DEPTNO)

          );

результат

Server: Msg 2715, Level 16, State 7, Line 1

Column or parameter #1: Cannot find data type VARCHAR2.

Server: Msg 1767, Level 16, State 1, Line 1

Foreign key 'CC_EMPNO_FK' references invalid table 'EMP'.

Server: Msg 1750, Level 16, State 1, Line 1

Could not create constraint. See previous errors.

Решения упражнений: урок 12

      COLUMN  TABLE_NAME FORMAT A22

      COLUMN  COMMENTS FORMAT A50 WORD_WRAP

      SELECT    *

      FROM       DICTIONARY;

результат

Incorrect syntax near the keyword 'COLUMN'.

     SELECT     TABLE_NAME

     FROM        USER_TABLES

     WHERE     TABLE_NAME = ' COMPANY_CARS ' ;

результат

Invalid object name 'USER_TABLES'.

     SELECT     OBJECT_NAME

     FROM        USER_OBJECTS

     WHERE     OBJECT_NAME = 'COMPANY_CARS'

     AND           OBJECT_TYPE = 'TABLE';

Server: Msg 208, Level 16, State 1, Line 1

Invalid object name 'USER_OBJECTS'.

     SELECT     CONSTRAINT_NAME,

                        CONSTRAINT_TYPE,

                        TABLE_NAME

     FROM        USER_CONSTRAINTS

     WHERE     TABLE_NAME = ' COMPANY_CARS ' ;