简体   繁体   English

IBM netezza SQL数据库中运行存储过程的错误

[英]error of running a stored proceudre in IBM netezza SQL database

I need to create a stored procedure in IBM netezza SQL database from IBM Aginity workbench. 我需要从IBM Aginity工作台在IBM netezza SQL数据库中创建一个存储过程。

This is my SQL code to create the SP: 这是我创建SP的SQL代码:

CREATE OR REPLACE PROCEDURE "SP_drop_a_table_if_exists"(varchar(128))
RETURNS boolean
EXECUTE AS OWNER
LANGUAGE NZPLSQL AS
BEGIN_PROC
declare
    oname alias for $1;
    o record;
begin
    select otype into o
from (
     select 'TABLE' otype from _v_table where tablename = upper(oname)
    union all
    select 'VIEW' otype from _v_view where viewname = upper(oname)
 ) x;

 if found then
    execute immediate 'DROP '||o.otype||' '||oname;
 end if;
end;
END_PROC;

I created successfully. 我创建成功。

But, when I ran it, 但是,当我运行它时,

   CALL SP_drop_a_table_if_exists('test_a_table':: varchar(128))

I got error: 我收到错误消息:

 ERROR[42S02] error: function 'sp_drop_a_table_if_exists(varchar)' does not exists
 unable to identify a function that satisdy the given argument types
 you may need to add explicit typecasts

Any help would be appreciated ! 任何帮助,将不胜感激 !

You created your stored procedure with mixed case inside of double quotes... 您使用双引号内的混合大小写创建了存储过程...

CREATE OR REPLACE PROCEDURE "SP_drop_a_table_if_exists"(varchar(128))

...but when you call the stored procedure you don't use double quotes, so the name is being converted all upper case. ...但是当您调用存储过程时,您不会使用双引号,因此名称将全部转换为大写。

CALL SP_drop_a_table_if_exists('test_a_table':: varchar(128))

Try this instead: 尝试以下方法:

CALL "SP_drop_a_table_if_exists"('test_a_table':: varchar(128)) 呼叫“ SP_drop_a_table_if_exists”('test_a_table':: varchar(128))

I should also mention that more recent versions of NPS support this syntax for the DROP TABLE command: 我还应该提到,最新版本的NPS支持DROP TABLE命令的此语法:

DROP TABLE TABLENAME IF EXISTS;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将CSV文件中的数据导入IBM Netezza SQL数据库时出错 - error of importing data from csv file to IBM netezza sql database 将数据从txt文件导入IBM netezza SQL数据库时出错 - error of importing data from txt file to IBM netezza SQL database Win7上Aginity工作台在IBM netezza SQL数据库上执行SQL查询时出错 - Error of SQL query on IBM netezza SQL database from Aginity workbench on Win7 在Win 7上从IBM netezza数据库导出sql数据表到txt文件的错误 - error of exporting a sql data table from IBM netezza database to a txt file on win 7 在IBM netezza SQL表中找到多个列的独特组合的错误 - error of finding distinct cobinations of muiltiple columns in IBM netezza SQL table 在IBM netezza数据库的SQL表中查找部分重复的行 - find partial duplicated rows in a SQL table in IBM netezza database 在win 7的IBM netezza Aginity工作台中查找数据库大小的错误 - error of finding size of database in IBM netezza Aginity workbench on win 7 在win 7上从Aginity工作台找到IBM netezza sql数据库上的表大小 - find the table size on IBM netezza sql database from Aginity workbench on win 7 将SQL数据库从一台服务器复制到IBM netezza Aginity工作台上的另一台服务器 - copy a SQL database from one server to another server on IBM netezza Aginity workbench 如果从Aginity工作台将47G数据文件导入到IBM netezza数据库,则会发生错误 - error if importing a 47G data file to IBM netezza database from Aginity workbench
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM