0

我使用了我的笔记/W3schools 和 Google,但找不到问题。当我运行该过程时,我收到以下消息:

警告 程序创建时出现编译错误

我创建了一个基于划船俱乐部的数据库,并且所有表格都可以正常工作。成功执行内部连接、立方体等。

我正在尝试运行以下过程:

CREATE OR REPLACE PROCEDURE totalCost (boatName IN NVARCHAR2)
IS
    total NUMBER;
    boatCost NUMBER;
    numPeople NUMBER;
BEGIN
    SELECT COST INTO boatCost FROM Races WHERE winning_boat = 'IronPrice';
    SELECT boat_size INTO numPeople FROM Boat_size WHERE winning_boat = 'IronPrice';
    total:=boatCost*numPeople;
    DBMS_OUTPUT.PUT_LINE('The total cost for this boat is '||total);
END totalCost;
/

CREATE TABLE Boats (
    Boat_Name VARCHAR (20),
    Boat_size Number (5),
    Fname VARCHAR (20),
    Riggin_Style VARCHAR (10),
    Price Number (20),
    Register_plate VARCHAR (20),
    Primary Key(Boat_Name),
    FOREIGN KEY (Register_plate) REFERENCES TRAILERS(Register_plate),
    FOREIGN KEY (Fname) REFERENCES Coaches(Fname));

CREATE TABLE RACES (
    Location VARCHAR (20),
    Style VARCHAR (20),
    Cost Number(5),
    Season VARCHAR (10),
    Winning_Club VARCHAR (20),
    Winning_Boat VARCHAR (20),
    Primary Key(Location))
4

1 回答 1

2

查看您从中选择的代码,Boat_size而脚本中的表被调用Boats

提示1:create ... procedure ...创建表后移动,则程序使用的对象将已经存在。

提示 2:show errors在 a 之后立即添加create ... procedure ...,让 SQL*Plus 告诉您刚刚编译的代码中存在哪些错误。

于 2013-05-05T17:05:06.997 回答