Multiple value return

I need a routine which will return 4 values . I want to call this routine in select query like below …

usage:

select col1 , col2 , routine(col3) from mytable

which routine I need ? Do I need view / store proc / function or what is the proper way to solve this ?

Please guide.

You will need a function, however, a function can only return a single value. So routine(col3) can only return a single int, varchar, date and any other data type.

Simply create an object containing the values to be returned and return the object.

an object? in sql? neat trick if you can pull that off :smiley:

or maybe you meant in php?

i agree, i would do the routine in the application layer, if possible, i.e. if the result depends on the value of col3 alone and not some other fields/rows/tables

No.

I want to do this in DB side.

What are the choices I have ?

based on the col3 value …I want to pick 4 values from other table .

sounds like a join