473,287 Members | 1,880 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,287 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 7848

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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.