Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8351547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:39:47+00:00 2026-06-09T08:39:47+00:00

How to convert this T-SQL query into Oracle? if((select case when (select top 1

  • 0

How to convert this T-SQL query into Oracle?

if((select case 
       when (select  top 1 AlertMessage   
             from ims.dbo.alertlist 
             where SystemID=@meter 
             order by TimePeriod desc
            ) like '%NO_COMMUNICATION_Resolved' then 1 
       else 0 end)=1)
begin
     INSERT INTO [ims].[dbo].[alertlist]
          ([SiteID],[ThresholdNumber],[SystemID],
           [AlertMessage],[TimePeriod],[AlertType],[PollID]) 
     VALUES 
          (1,@thresnumber,@meter,@message,getdate(),1,0)
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:39:48+00:00Added an answer on June 9, 2026 at 8:39 am

    As pointed out by Dan Puzey, your question is too broad and it would require a lot of trial and error. However, I’ll try to put you on the right track with something that might solve the first part of your problem.

    DECLARE v_IsMessageResolved int;
    
    -- This query will retrieve the value of the first row returned by the sub-query, mimicking the TOP 1 of SQL Server, and it will store the value of MessageResolved in a Variable
    SELECT
      MessageResolved into v_IsMessageResolved
    FROM
      (
      -- This query will return 1 for all the Messages that match the LIKE clause, ordered by TimePeriod in descending order.
      SELECT
        CASE
          WHEN AlertMessage LIKE '%NO_COMMUNICATION_Resolved' THEN 1
          ELSE 0
        END AS MessageResolved
        ,RANK() OVER (ORDER BY TimePeriod DESC) AS MessageRank
      FROM
        ims.alertlist 
      WHERE
        (SystemID = :meter)
      )
    WHERE
      (MessageRank = 1)
    
    -- At this point, it will be a matter of checking the value of v_IsMessageResolved and, if it's "1", run the INSERT
    

    Please note that I know SQL Server very well, but I never used Oracle, therefore my solution might not be perfect (or even run at all, as I don’t have an environment to test it). This also means that you can find the answers to the remaining questions you might have with a simple search, as I did. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert this SQL query to L2S.. SELECT TOP 5 vt.* FROM
I'm unable to convert this SQL query into a working linq statement select sum(cena),
How would I convert this query from SQL to Linq: SELECT status As 'Status',
I am trying to convert the following SQL into NHibernate: SELECT * FROM dbo.Customer
I'm trying to convert this SQL query to LINQ: SELECT Items.p_Name Product, DiamondCategory.dc_Name Category,
I'm trying to convert this SQL into a Linq2SQL query, however, I'm at the
How do I convert the following query into linq to sql query? select invoice.id,
I need to perform this Oracle query in SQL Server: select case_id, channel_index, min(su_min)
I am trying to convert this sql into my LINQ query and am having
I'm trying to find a way to convert this very complex SQL Query into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.