473,396 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Combining 'search' values in DECODE

Hello list,

When using 'decode' is it possible to combine 2 different search
values into 1

e.g

decode(a.country, 'CH', di.identity,'JA', di.identity, de.identity)

it would be nice to say something like

decode(a.country, 'CH or JA', di.identity, de.identity)

I'm not suggesting that that is the correct syntax, but is it
possible, like it would be in a 'case' statement to give the result
for 2 values, an either or, rather than having to explicitly give the
result for each value. i can't find any examples of this.

This is Oracle 8.1.3, by the way, I know there's something else you
can use instead of DECODE, in Oracle 9.

Many thanks in advance

David
Jul 19 '05 #1
1 7854

Originally posted by David Stephenson
Hello list,

When using 'decode' is it possible to combine 2 different search
values into 1

e.g

decode(a.country, 'CH', di.identity,'JA', di.identity, de.identity)

it would be nice to say something like

decode(a.country, 'CH or JA', di.identity, de.identity)

I'm not suggesting that that is the correct syntax, but is it
possible, like it would be in a 'case' statement to give the result
for 2 values, an either or, rather than having to explicitly give the
result for each value. i can't find any examples of this.

This is Oracle 8.1.3, by the way, I know there's something else you
can use instead of DECODE, in Oracle 9.

Many thanks in advance

David

No, with DECODE you have to do it that way.

The "something else" is CASE:

CASE WHEN a.country IN ('CH','JA') THEN di.identity ELSE de.identity END

This works in 8.1.7, but I don't know about 8.1.3.

--
Posted via http://dbforums.com
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: epascual | last post by:
I need to combine fields values: FirstName and Last Name to Full Name in the same table. I like to put the value on the full name after completing entry for the full name. Thanks for the help. ...
23
blyxx86
by: blyxx86 | last post by:
I am trying to filter multiple entries with only one search box. That way the user can type whatever they want and find all the values that contain what they enter. Private Sub...
2
by: cfwillia | last post by:
I'm trying to make a field in my report (pulling from a query) that will list all of the text in several fields separated by commas. I have a text box where the control source is: = & ", " & &...
8
by: alive84 | last post by:
Hi there I have wrote a little script, that is used to search specific values that the User tips in. Private Sub cmdSearch_Click() Dim LSQL As String Dim LSearchString As String
0
by: pcross29 | last post by:
I've got a table that has 3 fields: CarModel, CarColor and CarRegistration. I want to summarize the number of records by CarModel and CarColor. Easy with a sum query: Group By fields CarColor...
3
by: hutch75 | last post by:
Question could also be asked, how to compare data between two arrays and perform an action (print cmd) everytime there is a match? The problem I'm having with the code below is that the comparison...
1
by: David Stephenson | last post by:
Hello list, When using 'decode' is it possible to combine 2 different search values into 1 e.g decode(a.country, 'CH', di.identity,'JA', di.identity, de.identity) it would be nice to say...
0
by: nomvula | last post by:
i have a form with a dropdown values when a user select and click the search button i need to display information on another form based on the selection i've created an onclick in my search button...
2
by: VBnewb13 | last post by:
I have a text box that I would like to type values in separated by a "," and be able to pull all matching values from the table it is searching. Here is what I have so far: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.