![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
create procedure foo @a int as print "hello" go foo @a = 44 go hello |
|
foo go Msg 201, Level 16, State 2 |
|
foo @a = 44, @b = 44 go hello |
#2
| |||
| |||
|
|
How can I get Sybase to print a warning or error when an unknown argument is given to a stored procedure? Okay so far - if I leave out the parameter @a then it gives an error. But if I specify a nonexistent parameter it silently ignores it: foo @a = 44, @b = 44 go hello (return status = 0) Can I make Sybase warn about bad parameters? I'm using 11.9.2 with OCS 12.5. |
#3
| |||
| |||
|
|
How can I get Sybase to print a warning or error when an unknown argument is given to a stored procedure? create procedure foo @a int as print "hello" go foo @a = 44 go hello (return status = 0) foo go Msg 201, Level 16, State 2 Server 'TEST_LN', Procedure 'foo' Procedure foo expects parameter @a, which was not supplied. (return status = -6) Okay so far - if I leave out the parameter @a then it gives an error. But if I specify a nonexistent parameter it silently ignores it: foo @a = 44, @b = 44 go hello (return status = 0) Can I make Sybase warn about bad parameters? I'm using 11.9.2 with OCS 12.5. -- Ed Avis <ed (AT) membled (DOT) com |
#4
| |||
| |||
|
|
You can't (AFAIK). Sybase will simply silently ignore any additional parameters that are supplied. |
#5
| |||
| |||
|
|
Michael Peppler wrote: You can't (AFAIK). Sybase will simply silently ignore any additional parameters that are supplied. You can kludge it. For example, if your proc expects only one parameter: create procedure sp_myproc @param1 varchar(255), @param2 varchar(255) = null as if @param2 is not null begin print "Too many parameters" return -1 end |
#6
| |||
| |||
|
|
But that doesn't work with named parameters. |
#7
| |||
| |||
|
|
Michael Peppler wrote: But that doesn't work with named parameters. Good point. |
![]() |
| Thread Tools | |
| Display Modes | |
| |