我创建了一个函数,想实现向userinfo表里插入数据的功能,userinfo表里一共有三个字段:username、password。代码如下:create or replace function fun_register(v_name varchar2, v_password varchar2);
begin
insert into userinfo values (v_name,v_password);
end;
/却报出了这样的错误:
LINE/COL ERROR
-------- -----------------------------------------------------------------------------------------
1/59 PLS-00103: Encountered the symbol ";" when expecting one of the following: return这是怎么回事呢?
begin
insert into userinfo values (v_name,v_password);
end;
/却报出了这样的错误:
LINE/COL ERROR
-------- -----------------------------------------------------------------------------------------
1/59 PLS-00103: Encountered the symbol ";" when expecting one of the following: return这是怎么回事呢?
这个函数没必要返回什么,可以改成过程
create or replace function .. (...) return TYPE as
..
begin
..
end;
begin
insert into userinfo values (v_name,v_password);
end;
begin
insert into userinfo values (v_name,v_password);
end;
begin
insert into userinfo(username,password) values (v_name,v_password);
--该表一共有三个字段,但你确只插入了2个字段的值,所以应该显示指出将要被插入的值所对应字段.即:在表名后带上将要插入的字段名称
end;
/