Home » RDBMS Server » Server Administration » decode function(urgent)
decode function(urgent) [message #373770] Mon, 07 May 2001 15:36 Go to next message
parvind singh
Messages: 2
Registered: May 2001
Junior Member
select decode(temp,x,y,null) as test1||
decode (temp,z,l,null) as test2||
decode(temp,d,k,null) as test3
from table_name

Once I ran this query, then it return 3 rows.

Is there any way, can I get output in one row only ?
Re: decode function(urgent) [message #373771 is a reply to message #373770] Mon, 07 May 2001 17:37 Go to previous messageGo to next message
sundar
Messages: 23
Registered: May 2001
Junior Member
Can you please explain with an example what do you want to achieve?
Re: decode function(urgent) [message #373781 is a reply to message #373771] Tue, 08 May 2001 07:39 Go to previous messageGo to next message
parvind singh
Messages: 2
Registered: May 2001
Junior Member
I am using this set of possible in reports. In reports for one column, there is couple of possible value. If there is only one then it reurn only one rows but if there is more than one then it return more than one rows. So in report for that column valued displayed in two rows.
example. xx=00 01 02 00 03.

select decode (xx,0,00)||decode(xx,1,01)... from table

If this sql statment if there is more than one decode cond is true then it will return more than one rows, but I need only one rows in format of xx value.
Re: decode function(urgent) [message #373787 is a reply to message #373781] Tue, 08 May 2001 13:34 Go to previous messageGo to next message
sundar
Messages: 23
Registered: May 2001
Junior Member
try using a functio to concatenate all the values and
call it from a query.
assume function is conc
then try
select conc fro dual;
Re: decode function(urgent) [message #373788 is a reply to message #373781] Tue, 08 May 2001 13:39 Go to previous message
sundar
Messages: 23
Registered: May 2001
Junior Member
try using a functio to concatenate all the values and
call it from a query.
assume function is conc
then try
select conc fro dual;
Previous Topic: Re: single quote
Next Topic: adding a primary key column
Goto Forum:
  


Current Time: Sat Jun 29 00:31:58 CDT 2024