Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Unanswered: write a function returns more than one row

    Hi i need help in writing a function that returns a set of rows .how can this be done?help pls....

  2. #2
    Join Date
    Mar 2004
    Location
    Netherlands
    Posts
    183
    Instead of using RETURN var1,var2,var3
    use RETURN var1, avr2, var3 WITH RESUME
    (in a loop)

    So the keyword is: return ...... with resume

    Hope this helps,

    Rob Prop

  3. #3
    Join Date
    Apr 2004
    Posts
    3

    Unhappy

    Hi,
    Thanks for the prompt reply.But i have a problem again.When i create the function using the logic u mentioned i get a message saying routine created.
    but when i execute it i get an error sying the function name cannot be resolved (i.e. error no -674)

    what i am trying to do is simulate the desc keyword that we use in oracleso that we can achieve the same in informix.
    I have attached my code for u'r reference..
    Attached Files Attached Files

  4. #4
    Join Date
    Mar 2004
    Location
    Netherlands
    Posts
    183
    Hi,

    I think the error is in choosing the incoming datatype (I know for sure this is the reason you get the error). The input parameter is now a blob reference, but I think you want it as a char (probably 128, because this is the maximum table name length).

    Now when you execute the function you give a string (char) as parameter, but the function is created with a blob as parameter. So this can't be the functionm you requested (IDS thinks). This behaviour is called polymorphism and is used across several object-ralational engines.

    Drop your function and recreate it with:

    CREATE FUNCTION desc (mytable char(128)) RETURNING int,varchar(50),int,varchar(50),int,varchar(40),va rchar(25);
    etc...

    This should work,

    Rob Prop

  5. #5
    Join Date
    Apr 2004
    Posts
    3

    Thumbs up

    That helped!!
    thank you..

Posting Permissions

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