Solved

Using a wildcard or LIKE statement inside a DECODE

Posted on 2004-08-19
3
1,689 Views
Last Modified: 2008-02-26
I am trying to use a decode statement to translate a statement into a true/false values.
I have tried using:
DECODE( A.Problem_History, '%Duplicated%', 'True', 'False')
DECODE( A.Problem_History, '*Duplicated*', 'True', 'False')
but neither of those work for finding those which contain the work 'Duplicated' in the Problem_History column.

My next thought was to try a LIKE statement and if its true, pass 'True' as the returned value.
DECODE( (A.Problem_History LIKE '%Duplicated%'), 'True', 'True', 'False')

This however returns a "ORA-00907: Missing right parenthesis" error and highlights the 'LIKE' keyword.

0
Comment
Question by:Pawlikj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 11841858
You will likely have better luck placing this in the Oracle forum rather than the SQL Server one :-)
0
 
LVL 10

Expert Comment

by:Jay Toops
ID: 11842061
AND you cant use like in a decode statement ..
0
 
LVL 10

Accepted Solution

by:
Jay Toops earned 250 total points
ID: 11842253
you can do this though

case when A.Problem_History like '%duplicated%' then 'true'
else 'false'
end as bDuplicated
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question