Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

MB57630 (Programmer) (OP)
5 Mar 10 9:54
I am trying to create a command in crystal with the following and I keep getting errors...somethin about an interval qualifier at the end of the statement.  Any ideas??

SELECT *
FROM  KCMS.FCT_WEK_LVL_COU
WHERE
CASE
   WHEN rpt_cd in ('58','59','60','62','63') Then 'LCM Themed'
   WHEN rpt_cd in ('21','22','23','25','26','27') Then 'Kroger Personal Finance'
   WHEN rpt_cd in ('44','45','46','48','51','53') Then 'Corporate Programs'
ELSE 'Other'
END;

Thanks!
Turkbear (TechnicalUser)
5 Mar 10 12:50
Hi,
Your CASE clause does not create a criteria for
the WHERE to use - What you want is something like this:

CODE

SELECT K.*,(
CASE
   WHEN rpt_cd in ('58','59','60','62','63') Then 'LCM Themed'
   WHEN rpt_cd in ('21','22','23','25','26','27') Then 'Kroger Personal Finance'
   WHEN rpt_cd in ('44','45','46','48','51','53') Then 'Corporate Programs'
ELSE 'Other'
END
) ReportCode
FROM  KCMS.FCT_WEK_LVL_COU K

You probably should use an explicit list of fields instead of * in this case so the rpt_cd is not repeated.



 

profile

To Paraphrase:"The Help you get is proportional to the Help you give.."

Dagon (MIS)
8 Mar 10 8:28
You would need the CASE statement to provide a condition.  Putting the statement the way you have is akin to:

select * from table
where column

instead of

select * from table
where column  = 'X'

So you would need to compare the output of your CASE statement to something e.g. a column or input variable.

Retired (not by choice) Oracle contractor.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close