![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The documentation <URL:http://tinyurl.com/zm653> explicity states: No two identically-named procedures within a schema are permitted to have exactly the same number of parameters. A duplicate signature raises an SQL error (SQLSTATE 42723). For example, given the statements: CREATE PROCEDURE PART (IN NUMBER INT, OUT PART_NAME CHAR(35)) ... CREATE PROCEDURE PART (IN COST DECIMAL(5,3), OUT COUNT INT) ... the second statement will fail because the number of parameters in the procedure is the same, even if the data types are not. B. |
#3
| |||
| |||
|
#4
| |||
| |||
|
#5
| |||
| |||
|
|
AJ, As noted by others it's only possible for functions, not procedures. This is, in fact, the first time I see such a question, so I'm curious whether you are porting of another product (which one). AFAIK no other vendor supports overloading procedures by parameter type and very few support function overloading by type to begin with. Cheers Serge |
#6
| |||
| |||
|
|
Hi Serge No, not porting from another product. Just trying to implement the audit trail from hell. My insert/update/delete triggers CALL a SP. The insert/delete triggers are easy - they call a SP, passing (TABLE, PK, OPERATION, USER) However, the update trigger is more. It calls the SP with TABLE, PK, OPERATION, USER, COLUMN, OLDVAL, NEWVAL) where the COLUMN type and OLD/NEW values can be DATE, CHAR/VARCHAR, or INTEGER. I wanted to overload the SP by type, using wrapper SPs to call the one that actually does the audit trail work. This seemed better than clouding my triggers up w/ a bunch of dummy SP params, or trying to CAST(), or using different SPs. I'm also a Java developer, so overloading by type makes sense to me. I wound up CALLing different SPs from the update triggers based on type. Why is overloading by type in SP a big deal? DB2 is so strongly typed I would think its easy. Yes, it would be easy. But the customer base has shown little interest. |
![]() |
| Thread Tools | |
| Display Modes | |
| |