Search code examples
databasedb2procedureduplicate-detection

Stored procedure duplicated ? in DB2


I've created a stored procedure in db2, and I've modified it a couple of times, but in my db manager (Dbbeaver) and RazorSQL the same stored procedure appears two times. How can I determine what the last version is?


Solution

  • On zOS DB2 the following will show the alter timestamp:

    SELECT 
        name,
        alteredts  
    FROM 
        SYSIBM.SYSROUTINES 
    WHERE 
        NAME = 'myproc'
    AND SCHEMA = 'myschema'
    

    You'll need to have read rights to the SYSIBM tables. Also, if two SPs have the same name, it might be because they have overloaded parameters.