MS SQL to Oracle

Posted on 2011-05-04
Last Modified: 2013-11-11
I have the following sql statement in my program.
sql =  “SELECT  null as ID, '- Select Team -' as Team Union Select ID, Team from Team where ID in(2,3,4) order by Team”
I am trying to make it to work in Oracle but with no luck.  Please advice.  Thanks!
        ID        Team           (this is an output in MS SQL)
1     null      - Select Team -
2      1         TeamA
3      2         TeamB
Question by:avi7
    LVL 76

    Accepted Solution

    try this:
    select id, team from (SELECT  null as ID, '- Select Team -' as Team from dual Union Select ID, Team from Team where ID in(2,3,4)) order by Team

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
    How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now