home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases
- Path: sparky!uunet!sun-barr!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!rsoft!mindlink!a269
- From: Mischa_Sandberg@mindlink.bc.ca (Mischa Sandberg)
- Subject: Re: help needed on sybase stored procedure
- Organization: MIND LINK! - British Columbia, Canada
- Date: Thu, 19 Nov 1992 04:22:37 GMT
- Message-ID: <17581@mindlink.bc.ca>
- Sender: news@deep.rsoft.bc.ca (Usenet)
- Lines: 63
-
- > In article <1992Nov14.000317.58320@ssf-corp.dhl.com>,
- > julies@ssf-corp.dhl.com (Julie Stephens) writes:
- > |> I'm attempting to create a generic Sybase stored procedure which will
- > |> accept up to 254 input parameters. Within the stored procedure
- > |> I would like to determine how many parameters were passed to the
- > |> stored procedure & process them.
- >
- > |> Here is an example of what I'm trying to do. The problem here is
- > |> clear (see WHILE clause). The program will evaluate the temporary
- > |> variable @argName--not the input parameter @arg1.
- > |>
- > |> CREATE PROC processArguments
- > |> @arg1 varchar(255),
- > |> @arg2 varchar(255),
- > |> @arg3 varchar(255),
- > |> ...
- > |> @arg254 varchar(255)
- > |> AS
- >
- > Anyone reported this to Sybase as a feature enhancement request?
- >
- > Mark
- >
-
-
- 254 arguments !? No, I'm sorry, I guess you *are* being serious.
-
- While there is a time and place for everything, might I suggest that
- if using as many as 254 arguments might occur some time, then a list
- of arguments is not the place for them. More likely, you might want
- to create something like:
-
- create table #arg(num int, val varchar(255) null)
- create procedure ProcessArgs as
- declare @nargs int
- select @args = count from #arg
- ... operations on #arg en masse where possible and
- en loope where not ...
- go
- drop table #arg /* ... to be born again */
-
- create table #arg(num int, val varchar(255) null)
- insert #arg(1, "This is the first argument")
- ...
- insert #arg(254, "This need not be the last argument!")
- exec ProcessArgs
- drop table #arg
-
- Small tables are a pretty efficient way of dealing with lists of values
- in Sybase, and allow you the efficiency of vector operations instead of
- tedious loops, within your procedure ...
- (e.g. "update #args set val=rtrim(val) where num between 3 and 10")
-
- Then again, perhaps I'm off base, and that the actual purpose is to
- see how much Transact can be used without having to resort to any SQL :-).
-
- --
- Mischa Sandberg ... Mischa_Sandberg@mindlink.bc.ca
- or uunet!van-bc!rsoft!mindlink!Mischa_Sandberg
- *-*-*-*-*-*-*-*-*-*-*
- Engineers think equations are an approximation of reality.
- Physicists think reality is an approximation of the equations.
- Mathematicians never make the connection.
-