我用如下语句创建了一个存储过程,执行下面这条创建语句的时候没有报任何错误
create or replace procedure course1 as select * from evaluate where score='87'但当我要执行这个存储过程的时候却提示无效的sql语句。执行语句如下
exec course1求解啊,各位大神!
plsql存储过程
create or replace procedure course1 as select * from evaluate where score='87'但当我要执行这个存储过程的时候却提示无效的sql语句。执行语句如下
exec course1求解啊,各位大神!
plsql存储过程
这里无论写什么都能创建出来一个存储过程的。
select * from evaluate where grade=canshu;
end;这样写仍然在执行的时候提示无效的sql语句啊,谁能帮忙说一下具体怎么改吗?
v_count number;
begin
select count(*) into v_count from evaluate where grade=canshu;
dbms_output.put_line('有'||v_count||'条符合记录的数据');
end;先把PL/SQL学明白了再写存储过程
存储过程(procedure)
语法:
create [or replace] procedure 存储过程名字(arg1{in|out|inout} type,...,argn {in|out|inout} type)
is|as
定义变量、类型
begin
执行部分
exception
异常处理
end 存储过程名;
创建存储过程传入的参数类型不能带申明字符的大小
就是你varchar2后面的(100)
v_count number;
begin
select count(*) into v_count from evaluate where score='87';
dbms_output.put_line('有'||v_count||'条符合记录的数据');
end;
SQL> exec course1;
PL/SQL procedure successfully completed
SQL>
v_count number;
begin
select count(1) into v_count from evaluate where score='87';
dbms_output.put_line('有'||v_count||'条符合记录的数据');
end;