HiveBrain v1.2.0
Get Started
← Back to all entries
snippetModerate

How to delete a procedure which name is ambigous?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
deleteambigousprocedurenamehowwhich

Problem

I am using informix...

I dont know how i did it, but there are two procedures with the same name in my database. When i try to remove them with a

DROP PROCEDURE myProc;


then i get a error message

ERROR: Routine (add_adr_trigger_row) ambiguous - more than one
routine resolves to given signature.
Error Code: -9700


How can i drop the procedures?

Solution

This happens when you have 2 or more procedures, with the same name, but with different numbers of input parameters.

For example, you have created 2 procedures:

CREATE PROCEDURE myProc(param1)
...
CREATE PROCEDURE myProc(param1, param2)
...


To delete the second one, you have 2 options:

The easy one:

DROP PROCEDURE myProc(param1, param2);


The hard one:

dbaccess DB -
select procname, procid, numargs from sysprocedures where procname like 'myProc';
procname  myProc
procid    1
numargs   1

procname  myProc
procid    2
**numargs   2**

UPDATE sysprocedures SET procname='myProcOLD' WHERE procid=2;
DROP PROCEDURE myProcOLD;


Even if the first method is dead simple, the first time I got called in the middle of the night for this same problem, I've chosen the second. My bad ...

Code Snippets

CREATE PROCEDURE myProc(param1)
...
CREATE PROCEDURE myProc(param1, param2)
...
DROP PROCEDURE myProc(param1, param2);
dbaccess DB -
select procname, procid, numargs from sysprocedures where procname like 'myProc';
procname  myProc
procid    1
numargs   1

procname  myProc
procid    2
**numargs   2**

UPDATE sysprocedures SET procname='myProcOLD' WHERE procid=2;
DROP PROCEDURE myProcOLD;

Context

StackExchange Database Administrators Q#9507, answer score: 14

Revisions (0)

No revisions yet.