Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    1

    Unanswered: sybase stored procedure

    I have to use a suse a stored procedure in one of my sql statement
    e.g.
    UPDATE tbTable
    SET fdField1 = myProc ( fdField2, fdField3)
    WHERE
    fdField4=someval

    its giving error as sybase allows only built in functions here.

    It was possbile in oracle by creating a function.
    Any help? Any workarounds?

  2. #2
    Join Date
    Dec 2005
    Posts
    39
    you can still have the same piece of code but instead of directly setting the return value of myProc ( i doubt whether you can directly call an SP in update stmt & use it's return status to set some value) you need to take it in a variable and use that variable to set the value. something like this -

    declare @vrbl <appropriate datatype as per return value of myProc>

    select @vrbl = myProc(fdField2, fdField3)

    UPDATE tbTable
    SET fdField1 = @vrbl
    WHERE
    fdField4=someval

  3. #3
    Join Date
    Dec 2005
    Posts
    39
    sorry goofed up in the syntax, here's the right one

    execute @vrbl = myProc @fdField2, @fdField3

    you need to have @ in front of the input parameters to the SP or you can directly pass in the values.

  4. #4
    Join Date
    Dec 2005
    Location
    UK
    Posts
    1
    Try this page on user-defined functions:
    http://www.sypron.nl/udf.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •