help needed on sybase stored procedure

help needed on sybase stored procedure

Post by Julie Stephe » Sun, 15 Nov 1992 09:03:17



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.  To accomplish this, I'd like to
have a loop which creates input parm names on the fly & retrieve
the values stored in those input parameters. Can this be done?

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

        CREATE PROC processArguments



                ...

        AS


        ProcessArguments:



          BEGIN
            (blah, blah, blah)


          END

Thanks!

Julie Stephens
--
Systems Arch., DHL Airways, Inc., 333 Twin Dolphin Dr, Redwood City, CA 94065

VOICE: (415) 802-4694   FAX: (415) 593-1689

 
 
 

help needed on sybase stored procedure

Post by Mark Parso » Wed, 18 Nov 1992 00:35:25


|> 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.  To accomplish this, I'd like to
|> have a loop which creates input parm names on the fly & retrieve
|> the values stored in those input parameters. Can this be done?
|>
|> 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

|>
|>   CREATE PROC processArguments



|>           ...

|>   AS


|>
|>   ProcessArguments:


|>

|>     BEGIN
|>       (blah, blah, blah)


|>     END
|>

From what I've seen(and played with) you cannot do indirect addressing
or dynamic creation of code within a stored procedure . . at least not
in Sybase(can you in other DB servers?).


like 'arg??'.  In addition to that, the system will run indefinitely


If you use a different language, or move this to the front-end,
say . . . APT . . . you could do something like this . . but not in
the server . . .

Anyone reported this to Sybase as a feature enhancement request?

Mark

 
 
 

help needed on sybase stored procedure

Post by Mark Parso » Fri, 20 Nov 1992 00:54:59



|>
|> >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.  To accomplish this, I'd like to
|> >have a loop which creates input parm names on the fly & retrieve
|> >the values stored in those input parameters. Can this be done?
|>
|> >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

|>
|> >      CREATE PROC processArguments



|> >              ...

|> >      AS


|>
|> >      ProcessArguments:


|>

|> >        BEGIN
|> >          (blah, blah, blah)


|> >        END

The suggestion on the recursive call got me thinking . . . .
Are you going to do similar processing, i.e., is the "(blah,
blah, blah)" the same?, or can you determine which processing to
do based on the actual *value* of the arg's?  Will the processing
of the args be independent of each other?

If so . . and I know this isn't as slick as we'd all like . . but
hopefully a little easier to write and debug than the recursive
call(no offense!! ;-) . . .

Redefine your first proc like such:

CREATE PROC processArguments

        ...

AS

        ...

RETURN

Now define the second process:

CREATE PROC processArguments2

AS

        begin
                blah, blah, blah
        end
RETURN

Of course, you could go straight to processArguments2 from your front
end . . but you'd have to do 254 calls whereas using the two level
method above would require only one front-end-to-server call.  The
calls between the processes within the server will take up much less
overhead than doing separate calls to the server(from the front-end)
for each possible variable.

Sybase isn't going to allow indirect variable processing . . . so this
is the . . .um . . 'cleanest' idea I can come up with . . .

Other suggestions?

Mark

 
 
 

1. Help needed on Sybase stored Procedure

|>Path: pnl-oracle!ogicse!uwm.edu!caen!uunet!csfb1!lhall

|>Newsgroups: comp.databases.sybase
|>Subject: RE: Help needed on Sybase stored Procedure

|>Date: Sat, 14 Nov 92 09:34:19 PST
|>Article-I.D.: csfb1.BxpvH8.IKp

|>Reply-To: uunet!csfb1!lhall
|>Organization: First Boston Corporation
|>Lines: 63
|>
|>Julie Stephans writes :
|>
|>-------- bigin Included TEXT -------
|>

|>Subject: help needed on sybase stored procedure
|>Organization: DHL Worldwide Express, Redwood City, Calif., USA
|>
|>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.  To accomplish this, I'd like to
|>have a loop which creates input parm names on the fly & retrieve
|>the values stored in those input parameters. Can this be done?
--

        This question made me think...what are you trying to do here.
        This is like asking directions to the store After you walk
        down a dark alley

        State your goal. Someone surely has done it before.
RJ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        To Thyne Own Self be true...
                                     myne opinions are.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. Query contains an illegal outer-join request.

3. help needed on sybase stored procedure

4. ASP & SQL Server Full-text search

5. sybase stored procedure into informix stored procedure

6. More than 16

7. Query interrupt, Kill, terminate, stop

8. Help: Need help creating a GetNextKey Stored Procedure

9. Need Sybase/Sql Server stored procedures/triggers developers:NYC/NJ

10. Need real world code exemples for Stored Procedures with Sybase

11. newbie question - need to connect to Sybase from an NT system(and use stored procedures)