Home » SQL & PL/SQL » SQL & PL/SQL » Case Criteria
Case Criteria [message #332114] Mon, 07 July 2008 09:42 Go to next message
doicomehereoften1
Messages: 13
Registered: June 2008
Location: CO
Junior Member
I'm just trying to gather more info about Case expressions. Is it possible to specify multiple criteria in each When clause? I haven't found any blogs or forum posts talking about it, and manuals don't really give much info about it either.

For example:
When cola >= 0 and colb Like "%to%" Then "SELECTED"
Re: Case Criteria [message #332119 is a reply to message #332114] Mon, 07 July 2008 09:56 Go to previous messageGo to next message
Kevin Meade
Messages: 2101
Registered: December 1999
Location: Connecticut USA
Senior Member
Do you have access to an Oracle Instance, and sqlplus? If so, may I suggest you write a simple select statement that includes a CASE example of multiple test conditions and see if it works.

Kevin
Re: Case Criteria [message #332122 is a reply to message #332114] Mon, 07 July 2008 10:04 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Yes, you can.
Kevin's advice still stands - practice is by far the best way to learn.

FYI, you should use ' rather than " in oracle - the double quote is used in a lot of DDL to indicate that the case and format of a column is to be kept intact, wheras the single quote is just uses as a string delimiter.
Re: Case Criteria [message #332132 is a reply to message #332114] Mon, 07 July 2008 10:28 Go to previous messageGo to next message
doicomehereoften1
Messages: 13
Registered: June 2008
Location: CO
Junior Member
Unfortunately, I don't have access to SQL*Plus or *Developer at my workstation, I have to use an intermediary person at the moment, so trying to test things can be frustrating.

Thank you for confirming my thoughts JRowbottom! And the " just slipped out, woops!
Re: Case Criteria [message #332141 is a reply to message #332132] Mon, 07 July 2008 10:42 Go to previous messageGo to next message
Michel Cadot
Messages: 64133
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://apex.oracle.com/i/index.html

Create an account and you can test your query on it.

Regards
Michel
Re: Case Criteria [message #332147 is a reply to message #332132] Mon, 07 July 2008 11:35 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
doicomehereoften1 wrote on Mon, 07 July 2008 17:28
Unfortunately, I don't have access to SQL*Plus or *Developer at my workstation, I have to use an intermediary person at the moment, so trying to test things can be frustrating.


If you have the rights to install applications on your workstation, install a standard Oracle 10 XE database. It takes up very little space and is ideal for testing purposes (that is, if there is an XE version for your OS)
Re: Case Criteria [message #332150 is a reply to message #332114] Mon, 07 July 2008 11:51 Go to previous message
doicomehereoften1
Messages: 13
Registered: June 2008
Location: CO
Junior Member
Thanks for the tips!
Previous Topic: Return boolean value for match & non matched records (was:Problem)
Next Topic: Display Result at specific or first row
Goto Forum:
  


Current Time: Thu Dec 08 04:16:32 CST 2016

Total time taken to generate the page: 0.13014 seconds