r****5 发帖数: 618 | 1 要写一个procedure,这个procedure的要求是:能加新的customer,但是这个
procedure不能有具体的值,而是有parameter,并且可以使用来输入新的record. 我这
样写的, 但是"Warning, procedure created with compliation errors".
CREATE OR REPLACE PROCEDURE Create_Customer(
v-custnum IN customers.cust_num%TYPE,
v_name IN customers.cust_name%TYPE,
v_address IN customers.cust_address%TYPE)
AS
BEGIN
INSERT INTO customers
VAlUES(v-custnum,v_name,v_address);
END create_customer;
END;
/
另外我用cursor写的。也是同样的errors。大家帮我看看有什么不对?
CREATE OR REPLACE PROCEDURE Create_Customer(
v-custnum IN customers.cust_num%TYPE,
v_name IN customers.cust_name%TYPE,
v_address IN customers.cust_address%TYPE)
AS
new_cust customers%ROWTYPE;
CURSOR c1 is
INSERT INTO customers (cust_num,cust_name,cust_address)
VAlUES(v-custnum,v_name,v_address);
BEGIN
OPEN c1(v-custnum,v_name,v_address);
DBMS_OUTPUT.PUT(' '||'NUMBER'||' '||'MODEL'||' '||'YEAR ');
DBMS_OUTPUT.NEW_LINE;
LOOP
FETCH c1 INTO new_cust;
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.NEW_LINE;
DBMS_OUTPUT.PUT(' '||new_cust.cust_num||' '||
new_cust.cust_namel||' '||
new_cust.cust_address);
DBMS_OUTPUT.NEW_LINE;
END LOOP;
CLOSE c1;
END;
/ | B*****g 发帖数: 34098 | 2 第一个有2个end,去掉一个
第二个不知所云
【在 r****5 的大作中提到】 : 要写一个procedure,这个procedure的要求是:能加新的customer,但是这个 : procedure不能有具体的值,而是有parameter,并且可以使用来输入新的record. 我这 : 样写的, 但是"Warning, procedure created with compliation errors". : CREATE OR REPLACE PROCEDURE Create_Customer( : v-custnum IN customers.cust_num%TYPE, : v_name IN customers.cust_name%TYPE, : v_address IN customers.cust_address%TYPE) : AS : BEGIN : INSERT INTO customers
| r****5 发帖数: 618 | 3 去掉一个, 仍旧不work: encountered the symbol "-" when expecting one of the
following: n out longd double ref char tie interval date binary nationa
character nchar.
CREATE OR REPLACE PROCEDURE Create_Customer(
v-custnum IN customers.cust_num%TYPE,
v_name IN customers.cust_name%TYPE,
v_address IN customers.cust_address%TYPE)
AS
BEGIN
INSERT INTO customers
VAlUES(v-custnum,v_name,v_address);
END;
/
【在 B*****g 的大作中提到】 : 第一个有2个end,去掉一个 : 第二个不知所云
|
|