Need syntax help

Can you see what I'm doing wrong? I'm trying to follow a tutorial, but is unable to clear the checkpoint. Any help would be greatly appreciated.
  1  CREATE TABLE department (
  2    dept_id  NUMBER(2),
  3    name     VARCHAR2(15),
  4    budget   NUMBER(11,2),
  5*   projects ProjectList)
SQL> /

Table created.


  1  BEGIN
  2     INSERT INTO department
  3        VALUES(30, 'Accounting', 1205700,
  4           ProjectList(Projects(1, 'Design New Expense Report', 3250),
  5                       Projects(2, 'Outsource Payroll', 12350),
  6                       Projects(3, 'Evaluate Merger Proposal', 2750),
  7                       Projects(4, 'Audit Accounts Payable', 1425)));
  8     INSERT INTO department
  9        VALUES(50, 'Maintenance', 925300,
 10           ProjectList(Projects(1, 'Repair Leak in Roof', 2850),
 11                       Projects(2, 'Install New Door Locks', 1700),
 12                       Projects(3, 'Wash Front Windows', 975),
 13                       Projects(4, 'Repair Faulty Wiring', 1350),
 14                       Projects(5, 'Winterize Cooling System', 1125)));
 15     INSERT INTO department
 16        VALUES(60, 'Security', 750400,
 17           ProjectList(Projects(1, 'Issue New Employee Badges', 13500),
 18                       Projects(2, 'Find Missing IC Chips', 2750),
 19                       Projects(3, 'Upgrade Alarm System', 3350),
 20                       Projects(4, 'Inspect Emergency Exits', 1900)));
 21  END;
 22*
SQL> /
                     Projects(4, 'Audit Accounts Payable', 1425)));
                     *
ERROR at line 7:
ORA-06550: line 7, column 22:
PL/SQL: ORA-00904: "PROJECTS": invalid identifier
ORA-06550: line 2, column 4:
PL/SQL: SQL Statement ignored
ORA-06550: line 14, column 22:
PL/SQL: ORA-00904: "PROJECTS": invalid identifier
ORA-06550: line 8, column 4:
PL/SQL: SQL Statement ignored
ORA-06550: line 20, column 22:
PL/SQL: ORA-00904: "PROJECTS": invalid identifier
ORA-06550: line 15, column 4:
PL/SQL: SQL Statement ignored

You should:
-Define your type of 'projects' (structure) for example:

CREATE OR REPLACE TYPE projects AS OBJECT(
   project_id    NUMBER,
   project_name  VARCHAR2(180),
   project_cost  NUMBER
);
/

-Set the type as a collection of projects projectlist rather a collection of varchar2...

CREATE OR REPLACE TYPE projectlist AS TABLE OF projects;
/

Published by: user11268895 on July 12, 2010 16:04

Tags: Database

Similar Questions

Maybe you are looking for

  • 'open f' keeps temporary files

    I try to use 'open f' in the Terminal to channel the TextEdit MAN page output, as follows: Open man | Col b | Open f where, f - reads the entries from standard input and open the results in the default text editor.  ... It seems to me that the open c

  • Lenovo Y560: Strange keyboard problems

    Apart from the BSOD and random graphics driver accidents, I met a problem that I have never seen or heard of before. My keyboard types numbers. He's not numlock, and it isn't the key with numlock fn or the other. The entire keyboard. It will happen r

  • .doc) "Windows does not recognize format". How can I remove the)?

    My computer suddenly inserted a ")" to the file extension when I tried to save my document files.  It will now save except via a temporary file.  Somehow, it must be possible to remove this bracket, so that I can return to normal.   I have Windows XP

  • Swindled by an App blackBerry smartphones

    Hello. I chose to download one based on the number of positive comments he had scoured the apps in appworld. There has been negative reviews as well, but I couldn't tell if these users problems are as a result of the program or their suppliers, etc.

  • A nano transceiver can be shared for Arc and Arc Touch Mouse Keyboard. If so how...

    I bought the ARC keyboard and touch mouse. Both have individual separated Nano transceivers. I wish I could use a nano for two products transceiver. If the answer is Yes to my question. Can you explain HOW? Thank you