?
Solved

Why am I getting this error when trying to create a stored procedure? [SQL Error (-9704) : For SPL routine, parameter must be named.]

Posted on 2008-10-29
3
Medium Priority
?
1,060 Views
Last Modified: 2013-12-25
I am trying to create a stored procedure that will in turn runs scripts to create tables. However, I only want these scripts to be executed when the tables don't already exist. Below is the procedure I am creating:

CREATE DBA PROCEDURE createauditTBL(tblName) ;
  DEFINE tblOwner CHAR(20);
  DEFINE tblName  CHAR(20);
  DEFINE l_stmnt  CHAR(50);

  LET tblOwner = NULL;

  SELECT owner into tblOwner FROM systables WHERE tabname = tblName;

  IF tblOwner IS NULL OR tblOwner[1,1] = " " THEN
    -- We can run the script to create the table...
    LET l_stmnt = "create_"||tblName||".sh";
    SYSTEM l_stmnt;
  ELSE
    -- No need to create, DBA must decide if the need to manual drop this table
    RAISE EXCEPTION -746, 0, "The table "||tblName||" already exists";
  END IF
END PROCEDURE;
0
Comment
Question by:ShaneLJM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
TheLastStraw earned 2000 total points
ID: 22832607
Try defininging parameter tblname
ie
CREATE DBA PROCEDURE createauditTBL(tblName CHAR(20)) ;
0
 
LVL 2

Expert Comment

by:TheLastStraw
ID: 22837521
Your parameter tblname should be define as a datatype, I believe your DEFINE statement of same name will not act on the parameter passed but defines a new variable probably causing some name conflict. Version I have available to me makes me unable to simulate your issue but you couldtry definevariable as per my previous post and remove the DEFINE statment within the procedure.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question