home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / database / 7833 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  1.6 KB

  1. Xref: sparky comp.databases:7833 comp.databases.sybase:310
  2. Newsgroups: comp.databases,comp.databases.sybase
  3. Path: sparky!uunet!devlgw!julies
  4. From: julies@ssf-corp.dhl.com (Julie Stephens)
  5. Subject: help needed on sybase stored procedure
  6. Sender: julies@ssf-corp.dhl.com (Julie Stephens)
  7. Message-ID: <1992Nov14.000317.58320@ssf-corp.dhl.com>
  8. Date: Sat, 14 Nov 1992 00:03:17 GMT
  9. Organization: DHL Worldwide Express, Redwood City, Calif., USA
  10. Lines: 40
  11.  
  12. I'm attempting to create a generic Sybase stored procedure which will
  13. accept up to 254 input parameters.  Within the stored procedure
  14. I would like to determine how many parameters were passed to the
  15. stored procedure & process them.  To accomplish this, I'd like to
  16. have a loop which creates input parm names on the fly & retrieve 
  17. the values stored in those input parameters. Can this be done?
  18.  
  19. Here is an example of what I'm trying to do.  The problem here is
  20. clear (see WHILE clause).  The program will evaluate the temporary
  21. variable @argName--not the input parameter @arg1. 
  22.  
  23.     CREATE PROC processArguments
  24.         @arg1    varchar(255),
  25.         @arg2    varchar(255),
  26.         @arg3    varchar(255),
  27.         ...
  28.         @arg254 varchar(255)
  29.     AS
  30.     DECLARE @argName varchar(30)
  31.     DECLARE @argInt  int
  32.  
  33.     ProcessArguments:
  34.     SELECT @argInt = 1
  35.     SELECT @argName = '@arg1'
  36.  
  37.     WHILE @argName IS NOT NULL
  38.       BEGIN
  39.         (blah, blah, blah)
  40.         SELECT @argInt = @argInt + 1
  41.         SELECT @argName = '@arg' + (SELECT CONVERT(char(3), @argInt))
  42.       END
  43.  
  44. Thanks!
  45.  
  46. Julie Stephens
  47. -- 
  48. Systems Arch., DHL Airways, Inc., 333 Twin Dolphin Dr, Redwood City, CA 94065
  49. INET: julies@ssfarch.attmail.com  UUNET: uunet!ssfarch!julies
  50. VOICE: (415) 802-4694    FAX: (415) 593-1689
  51.  
  52.