If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > write a function returns more than one row

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-11-04, 04:05
pgwood pgwood is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
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....
Reply With Quote
  #2 (permalink)  
Old 04-11-04, 09:26
RobP RobP is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 04-12-04, 04:39
pgwood pgwood is offline
Registered User
 
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
File Type: txt description of table.txt (1.7 KB, 65 views)
Reply With Quote
  #4 (permalink)  
Old 04-12-04, 08:54
RobP RobP is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 04-20-04, 04:47
pgwood pgwood is offline
Registered User
 
Join Date: Apr 2004
Posts: 3
Thumbs up

That helped!!
thank you..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On