473,405 Members | 2,334 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,405 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 7855

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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.