#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Variable arguments


    Hi,
    I am a newbie to SQL. I need to know a way in which I can pass variable arguments to UDF? Below is the sample code:

    for execute statement:str
    into :val1, :val2
    do begin
    fill(:val1, :val2)
    end

    Here its obvious that only 2 values are passed to UDF 'fill', but if there are more arguments (that depends on the execute statement, like val1, val2, val3 etc) then how do I pass these into UDF? Please help.

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    36
    Rep Power
    10
    One solution will be do pass to the UDF only one string parameter that will contain all your values you want to send. Something like this:

    cparatemerTosend = cast (val1 as varchar(50))||','||cast (val2 as varchar(50))||','||cast (val3 as varchar(50)).....

    fill(cparameterToSend)

    In this way you transfer the job to identify the parameters to the UDF.

IMN logo majestic logo threadwatch logo seochat tools logo