PL/SQL Developer 中执行过程的问题

2023-11-02数据库问题
1

本文介绍了PL/SQL Developer 中执行过程的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

这是我第一次尝试创建过程并执行它.首先我创建简单的表.表的数据库方案在这里:

表名:Ziaci

列:

  • ZiakId - 主键、数字
  • 姓氏,varchar2
  • 名字,varchar2
  • TriedaId - 伪造密钥、号码

存储过程只在表中插入数据,我用这个 SQL cmd 创建了存储过程:

create procedure ziaci_proc(surname_in in varchar2,varchar2 中的 firstname_in,数字中的 tryaid_in)是开始插入 ziaci (surname, firstname,triedaid) 值 (surname_in,firstname_in,triedaid_in);结尾;

我试着把这个程序称为:

执行ziaci_proc('X','Y',1)

我收到此错误:

ORA-00900 无效的 SQL 语句

PL/SQL Developer IDE 中的一个带有红色下划线的执行字.

我测试了这个程序,效果很好.

我只能用这个 SQL 命令来执行这个过程:

开始ziaci_proc('A','B',2);结尾;

有什么不好的,谢谢帮助.

解决方案

使用上述 execute 调用存储过程是特定于 SQL*Plus 的.实际上,SQL*Plus 将 execute some_proc() 转换为 BEGIN some_proc();END;,你可以通过尝试调用一个不存在的过程来亲眼看到这一点:

<前>SQL> 执行 some_proc()开始 some_proc();结尾;*第 1 行的错误:ORA-06550:第 1 行,第 7 列:PLS-00201:必须声明标识符SOME_PROC"ORA-06550:第 1 行,第 7 列:PL/SQL:语句被忽略

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.

解决方案

Calling stored procedures using execute as above is specific to SQL*Plus. In fact, SQL*Plus converts execute some_proc() into BEGIN some_proc(); END;, You can see this for yourself by attempting to call a procedure that doesn't exist:

SQL> execute some_proc()
BEGIN some_proc(); END;

      *
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'SOME_PROC' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

这篇关于PL/SQL Developer 中执行过程的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

Mysql目录里的ibtmp1文件过大造成磁盘占满的解决办法
ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致...
2025-01-02 数据库问题
151

按天分组的 SQL 查询
SQL query to group by day(按天分组的 SQL 查询)...
2024-04-16 数据库问题
77

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

MySQL groupwise MAX() 返回意外结果
MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)...
2024-04-16 数据库问题
13

MySQL SELECT 按组最频繁
MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)...
2024-04-16 数据库问题
16

在 Group By 查询中包含缺失的月份
Include missing months in Group By query(在 Group By 查询中包含缺失的月份)...
2024-04-16 数据库问题
12