PL/SQL Developer 中执行过程出现问题
这是我第一次尝试创建过程并执行它。 首先我创建简单的表。表的数据库方案如下:
表名称:Ziaci
列:
- ZiakId - 主键,数字
- 姓氏,varchar2
- FirstName,varchar2
- TriedaId - forgein 键,数字
存储过程仅在表中插入数据,我使用此 SQL cmd 创建了存储过程
create procedure ziaci_proc(surname_in in varchar2,
firstname_in in varchar2, triedaid_in in number)
is
begin
insert into ziaci (surname, firstname,triedaid) values (surname_in,firstname_in,triedaid_in);
end;
:尝试将此过程调用为:
execute ziaci_proc('X','Y',1)
我收到此错误:
ORA-00900 无效的 SQL 语句
PL/SQL Developer IDE 中的执行字带有红色下划线。
我测试了这个程序,效果很好。
我只能用这个 SQL 命令执行这个过程:
begin
ziaci_proc('A','B',2);
end;
有什么问题,谢谢帮助。
I this is my first attempt to create procedure and execute it.
First I create simple table. DB scheme of table is here:
Table name: Ziaci
Columns:
- ZiakId - primary key, number
- Surname, varchar2
- FirstName, varchar2
- TriedaId - forgein key, number
Store procedure only insert data in table, I created store procudure with this SQL cmd:
create procedure ziaci_proc(surname_in in varchar2,
firstname_in in varchar2, triedaid_in in number)
is
begin
insert into ziaci (surname, firstname,triedaid) values (surname_in,firstname_in,triedaid_in);
end;
And I try call this procudure as:
execute ziaci_proc('X','Y',1)
I get this error:
ORA-00900 invalid SQL statement
An in PL/SQL Developer IDE is with red color underlined execute word.
I test this procedure and it works good.
I can only execute this procedure with this SQL command:
begin
ziaci_proc('A','B',2);
end;
What is bad, thank for help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如上所述使用
execute
调用存储过程特定于 SQL*Plus。事实上,SQL*Plus 将execute some_proc()
转换为BEGIN some_proc(); END;
,您可以通过尝试调用不存在的过程来亲眼看到这一点:Calling stored procedures using
execute
as above is specific to SQL*Plus. In fact, SQL*Plus convertsexecute some_proc()
intoBEGIN some_proc(); END;
, You can see this for yourself by attempting to call a procedure that doesn't exist:我认为您正在“SQL 窗口”中编写命令。您应该使用“命令行窗口”成功执行此行:
I think you're writing command in "SQL Window". You should use "Command Window" to succesfully execute this line: