Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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!

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Not able to run query using teradata

Not able to run query using teradata

The query which i have written is not running in teradata, I dont know why, syntactically it is correct but not running Giving an error message.  
Do you have any alternative solution for this query?

         mediafact_stg  m
         m.action_id in(1004,1005)
         AND not exists(select 'x'
                        Media_event me,
                        media_event_x_source mexs,
                        Subscriber_service ss1,
                        subscriber_service_activity ssa
                   And mexs.datasourceid=163
                        And mexs.mediaeventid=me.mediaeventid
                        And  me.subscriberserviceid =
                                          When m.member_partner_plan_id in(select ssxs.subscriberserviceid from subscriber_service_x_source ssxs)
                                          then m.member_partner_plan_id
                                     WHEN  ss1.subscriberserviceid=ssa.subscriberserviceid
                                                     m.t_timestamp >=(cast((cast(cast(ssa.startdt as date)as varchar(20))||' '||cast(cast(ssa.starttime as time(6))as varchar(20))) as timestamp)
)                                                    and
                                                     m.t_timestamp<=(CAST((cast(cast(ssa.enddt AS DATE )as varchar(20))||' '||cast(CAST(ssa.endtime  AS TIME(6)) as varchar(20)))as timestamp)
                                  ) and ss1.partyid=m.user_id          
                                  then ss1.subscriberserviceid


RE: Not able to run query using teradata


syntactically it is correct but not running Giving an error message
Could you give this error message ?

RE: Not able to run query using teradata

Error message : 3771: Illegal expression in when clause of case expression

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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