我用的是PL/SQL,连接的Oracle 10g。
我在一个SQL框里输入如下,建立存储过程:
create or replace procedure test_select
as
select * from test_table t where t.subsystem_id = 4
然后执行:exec test_select
提示无效SQL语句。
在下Oracle菜鸟,以前没写过存储过程,请大家帮忙。
我在一个SQL框里输入如下,建立存储过程:
create or replace procedure test_select
as
select * from test_table t where t.subsystem_id = 4
然后执行:exec test_select
提示无效SQL语句。
在下Oracle菜鸟,以前没写过存储过程,请大家帮忙。
你的这个写法是在sqlserver里面的,oracle里面不支持这样的写法!
as
begin
--select * from test_table t where t.subsystem_id = 4
dbms_system.output_line('this is my first proc in oracle !');
end
调用exec test_select还是提示不是有效的SQL啊
其中一个窗口输入:create or replace procedure test_select
as
begin
--select * from test_table t where t.subsystem_id = 4
dbms_system.output_line('this is my first proc in oracle !');
end
另一个窗口输入:
exec test_select执行完第一个窗口没问题,执行第二个窗口弹出“无效SQL语句”
CREATE OR REPLACE PROCEDURE secure_dml
IS
BEGIN
IF TO_CHAR (SYSDATE, 'HH24:MI') NOT BETWEEN '08:00' AND '18:00'
OR TO_CHAR (SYSDATE, 'DY') IN ('SAT', 'SUN') THEN
RAISE_APPLICATION_ERROR (-20205,
'You may only make changes during normal office hours');
END IF;
END secure_dml;
CREATE OR REPLACE TRIGGER secure_employees
BEFORE INSERT OR UPDATE OR DELETE ON employees
BEGIN
secure_dml;
END secure_employees;
as
begin
--select * from test_table t where t.subsystem_id = 4
dbms_output.put_line('this is my first proc in oracle !');
end
as
begin
--select * from test_table t where t.subsystem_id = 4
dbms_output.put_line('this is my first proc in oracle !');
end
exec test_select
无效SQL语句
create or replace procedure sp_pro1(spname emp.ename%type,newsal emp.sal%type) is
begin
update emp set sal=newsal where ename=spname;
end;
/
exec sp_pro1('scott',1000);
要不用plsql连接工具 可以设这断点调试
create or replace procedure test_select
as
begin
update test_table
set created_by='test2'
where pid=5013;
end;call test_select()
出错提示:程序包或函数处于无效状态