Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. oracle 11g alias to query

oracle 11g alias to query

Scheduled Pinned Locked Moved Database
databaseoraclehelp
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hadad
    wrote on last edited by
    #1

    When migrating from oracle 10g to 11g, I've a stored procedure with a syntax like:

    select * from table1
    union
    select t,y from
    (select * from table2)aliasQuery
    where (select max(t)from (select t from table 3 where table3. t=aliasQuery.t)

    query works well with 10g but 11g returns error that aliasQuery not defined

    may be this syntax no longer supported in 11g or here is some database missing configurations

    Thanks

    Dad

    J C D 3 Replies Last reply
    0
    • H hadad

      When migrating from oracle 10g to 11g, I've a stored procedure with a syntax like:

      select * from table1
      union
      select t,y from
      (select * from table2)aliasQuery
      where (select max(t)from (select t from table 3 where table3. t=aliasQuery.t)

      query works well with 10g but 11g returns error that aliasQuery not defined

      may be this syntax no longer supported in 11g or here is some database missing configurations

      Thanks

      Dad

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      Could you check that you wrote the query correctly. It seems incorrect.

      Light moves faster than sound. That is why some people appear bright, until you hear them speak. List of common misconceptions

      1 Reply Last reply
      0
      • H hadad

        When migrating from oracle 10g to 11g, I've a stored procedure with a syntax like:

        select * from table1
        union
        select t,y from
        (select * from table2)aliasQuery
        where (select max(t)from (select t from table 3 where table3. t=aliasQuery.t)

        query works well with 10g but 11g returns error that aliasQuery not defined

        may be this syntax no longer supported in 11g or here is some database missing configurations

        Thanks

        Dad

        C Offline
        C Offline
        Chris Meech
        wrote on last edited by
        #3

        Logically speaking

        select ..
        from ( select * from table ) aliasquery
        where ...

        is no different from

        select ..
        from table aliasquery
        where ...

        Please verify the SQL you have posted. :)

        Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

        1 Reply Last reply
        0
        • H hadad

          When migrating from oracle 10g to 11g, I've a stored procedure with a syntax like:

          select * from table1
          union
          select t,y from
          (select * from table2)aliasQuery
          where (select max(t)from (select t from table 3 where table3. t=aliasQuery.t)

          query works well with 10g but 11g returns error that aliasQuery not defined

          may be this syntax no longer supported in 11g or here is some database missing configurations

          Thanks

          Dad

          D Offline
          D Offline
          David Skelly
          wrote on last edited by
          #4

          The question has been answered on stackoverflow. For anyone who wants to know, the answer is No - this does not work on 11g. For more details why, go here: http://stackoverflow.com/questions/9290653/oracle-11g-alias-to-query[^]

          B 1 Reply Last reply
          0
          • D David Skelly

            The question has been answered on stackoverflow. For anyone who wants to know, the answer is No - this does not work on 11g. For more details why, go here: http://stackoverflow.com/questions/9290653/oracle-11g-alias-to-query[^]

            B Offline
            B Offline
            Bernhard Hiller
            wrote on last edited by
            #5

            Oracle is so great! They even fix bugs which caused such queries to be possible.

            D 1 Reply Last reply
            0
            • B Bernhard Hiller

              Oracle is so great! They even fix bugs which caused such queries to be possible.

              D Offline
              D Offline
              David Skelly
              wrote on last edited by
              #6

              I know, I had to think very carefully about that one. This query used to work but only because it was a bug (in other words you thought it was good, but in fact we knew it was bad), so we fixed the bug and now your query doesn't work anymore (which you may think is bad, but really it's not, because we know it's good). If I follow the argument correctly, it has something to do with ANSI standards: you should not be able to do this in ANSI-standard SQL. So in order for Oracle to be ANSI-standard, they had to stop you from doing this. I think that's the reason.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups