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. The Lounge
  3. SQL != SQL...

SQL != SQL...

Scheduled Pinned Locked Moved The Lounge
databasesql-serveroraclecomsysadmin
60 Posts 15 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.
  • Sander RosselS Sander Rossel

    So I've been doing Oracle development, coming from SQL Server. Simple string concatenation, which is + everywhere, is || in Oracle. A little research and || seems to be the ANSI standard, which makes sense as 2 || 'A' is now unambiguous '2A' (and not a conversion error). But now I want to write a simple SELECT statement which would work in both Oracle and SQL Server. Oracle doesn't support + and SQL Server doesn't support ||, however both support CONCAT. Seems too easy for something that's uneasy already, and indeed it is... SELECT CONCAT('A', 'B') FROM TABLE works in Oracle and SQL Server. SELECT CONCAT('A', 'B', 'C') FROM TABLE works only in SQL Server... Seems like the only thing that works in both databases is CONCAT('A', CONCAT('B', 'C')). And that seems like the only reasonable solution is to write two different queries, one for Oracle and one for SQL Server because it's just too friggin difficult to implement a standard FRIGGIN STRING CONCATENATION!!! X| When does the hurting stop? :((

    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

    Regards, Sander

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

    Sander Rossel wrote:

    When does the hurting stop

    When you stop doing presentation logics in the database. I also agree with Phil, why do you need to support more than one database?

    Wrong is evil and must be defeated. - Jeff Ello

    L Sander RosselS W 3 Replies Last reply
    0
    • L Lost User

      BTW allready your subject does not work, it has to be "SQL <> SQL" ;P

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

      Works in Oracle

      Wrong is evil and must be defeated. - Jeff Ello

      L 1 Reply Last reply
      0
      • Sander RosselS Sander Rossel

        So I've been doing Oracle development, coming from SQL Server. Simple string concatenation, which is + everywhere, is || in Oracle. A little research and || seems to be the ANSI standard, which makes sense as 2 || 'A' is now unambiguous '2A' (and not a conversion error). But now I want to write a simple SELECT statement which would work in both Oracle and SQL Server. Oracle doesn't support + and SQL Server doesn't support ||, however both support CONCAT. Seems too easy for something that's uneasy already, and indeed it is... SELECT CONCAT('A', 'B') FROM TABLE works in Oracle and SQL Server. SELECT CONCAT('A', 'B', 'C') FROM TABLE works only in SQL Server... Seems like the only thing that works in both databases is CONCAT('A', CONCAT('B', 'C')). And that seems like the only reasonable solution is to write two different queries, one for Oracle and one for SQL Server because it's just too friggin difficult to implement a standard FRIGGIN STRING CONCATENATION!!! X| When does the hurting stop? :((

        Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

        Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

        Regards, Sander

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        If the minor differences between databases already make you cry, then please stay away from anything that has to do with browsers.

        The language is JavaScript. that of Mordor, which I will not utter here
        This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
        "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

        Sander RosselS W 2 Replies Last reply
        0
        • P phil o

          Sander Rossel wrote:

          When does the hurting stop? :((

          When you stop using both dbms at the same time? Or when you stop using them totally? :)

          I never finish anyth

          B Offline
          B Offline
          Brittle1618
          wrote on last edited by
          #8

          phil.o wrote:

          When you stop using both dbms at the same time?

          Well, that may be a solution(if he wants stop getting hurt ) ;)

          phil.o wrote:

          Or when you stop using them totally?

          Don't tell me that you want him to us MS access :sigh:

          P 1 Reply Last reply
          0
          • J Jorgen Andersson

            Sander Rossel wrote:

            When does the hurting stop

            When you stop doing presentation logics in the database. I also agree with Phil, why do you need to support more than one database?

            Wrong is evil and must be defeated. - Jeff Ello

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #9

            Why? Layers are soooo last decade.

            The language is JavaScript. that of Mordor, which I will not utter here
            This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
            "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

            1 Reply Last reply
            0
            • B Brittle1618

              phil.o wrote:

              When you stop using both dbms at the same time?

              Well, that may be a solution(if he wants stop getting hurt ) ;)

              phil.o wrote:

              Or when you stop using them totally?

              Don't tell me that you want him to us MS access :sigh:

              P Offline
              P Offline
              phil o
              wrote on last edited by
              #10

              Brittle1618 wrote:

              Don't tell me that you want him to us MS access :sigh:

              No, I'm not so cruel :) A simple Excel sheet will do it :D

              I never finish anyth

              1 Reply Last reply
              0
              • P phil o

                Sander Rossel wrote:

                When does the hurting stop? :((

                When you stop using both dbms at the same time? Or when you stop using them totally? :)

                I never finish anyth

                Sander RosselS Offline
                Sander RosselS Offline
                Sander Rossel
                wrote on last edited by
                #11

                Maybe when I retire?

                Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                Regards, Sander

                P 1 Reply Last reply
                0
                • J Jorgen Andersson

                  Sander Rossel wrote:

                  When does the hurting stop

                  When you stop doing presentation logics in the database. I also agree with Phil, why do you need to support more than one database?

                  Wrong is evil and must be defeated. - Jeff Ello

                  Sander RosselS Offline
                  Sander RosselS Offline
                  Sander Rossel
                  wrote on last edited by
                  #12

                  Our company uses Oracle and SQL Server, both from C#. SQL Server support isn't really a requirement (now), but I was pretty sure it would work as it's SQL in it's simplest form (although apparently there is no 'simple' form of SQL)... Anyway, screw SQL Server support.

                  Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                  Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                  Regards, Sander

                  J 1 Reply Last reply
                  0
                  • L Lost User

                    If the minor differences between databases already make you cry, then please stay away from anything that has to do with browsers.

                    The language is JavaScript. that of Mordor, which I will not utter here
                    This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                    "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

                    Sander RosselS Offline
                    Sander RosselS Offline
                    Sander Rossel
                    wrote on last edited by
                    #13

                    CDP1802 wrote:

                    stay away from anything that has to do with browsers

                    As a full-stack web developer that'll be difficult. And yes it makes me cry and gives me nightmares, why can't we all just get along? Sometimes I want to go back to my safe and simple WinForms, now that's good technology :)

                    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                    Regards, Sander

                    L 1 Reply Last reply
                    0
                    • Sander RosselS Sander Rossel

                      CDP1802 wrote:

                      stay away from anything that has to do with browsers

                      As a full-stack web developer that'll be difficult. And yes it makes me cry and gives me nightmares, why can't we all just get along? Sometimes I want to go back to my safe and simple WinForms, now that's good technology :)

                      Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                      Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                      Regards, Sander

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #14

                      Very true, but some people think it just does not feel right if it is not as complicated and convoluted as possible. Browsers, CSS, JavaScript HTMl, throw them all away and build a native client where ever possible. Then you will certainly have a better UI. As for the databases, perhaps you should use a ORM as abstraction. Then you can be fairly independent of the actual database that is used. At the price (as someone already noted) that you will do everybody a favor and not do any more presentation layer stuff in the data layer.

                      The language is JavaScript. that of Mordor, which I will not utter here
                      This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                      "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

                      Sander RosselS J P 3 Replies Last reply
                      0
                      • Sander RosselS Sander Rossel

                        Our company uses Oracle and SQL Server, both from C#. SQL Server support isn't really a requirement (now), but I was pretty sure it would work as it's SQL in it's simplest form (although apparently there is no 'simple' form of SQL)... Anyway, screw SQL Server support.

                        Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                        Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                        Regards, Sander

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

                        It'll get even funnier when you realize that even when the SQL is completely compatible, the results may not be. For example: Oracle doesn't have an empty string.

                        Wrong is evil and must be defeated. - Jeff Ello

                        Sander RosselS P 2 Replies Last reply
                        0
                        • Sander RosselS Sander Rossel

                          So I've been doing Oracle development, coming from SQL Server. Simple string concatenation, which is + everywhere, is || in Oracle. A little research and || seems to be the ANSI standard, which makes sense as 2 || 'A' is now unambiguous '2A' (and not a conversion error). But now I want to write a simple SELECT statement which would work in both Oracle and SQL Server. Oracle doesn't support + and SQL Server doesn't support ||, however both support CONCAT. Seems too easy for something that's uneasy already, and indeed it is... SELECT CONCAT('A', 'B') FROM TABLE works in Oracle and SQL Server. SELECT CONCAT('A', 'B', 'C') FROM TABLE works only in SQL Server... Seems like the only thing that works in both databases is CONCAT('A', CONCAT('B', 'C')). And that seems like the only reasonable solution is to write two different queries, one for Oracle and one for SQL Server because it's just too friggin difficult to implement a standard FRIGGIN STRING CONCATENATION!!! X| When does the hurting stop? :((

                          Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                          Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                          Regards, Sander

                          C Offline
                          C Offline
                          Corporal Agarn
                          wrote on last edited by
                          #16

                          So what you are saying is T-SQL <> PL/SQL? :)

                          Mongo: Mongo only pawn... in game of life.

                          Sander RosselS W 2 Replies Last reply
                          0
                          • L Lost User

                            Very true, but some people think it just does not feel right if it is not as complicated and convoluted as possible. Browsers, CSS, JavaScript HTMl, throw them all away and build a native client where ever possible. Then you will certainly have a better UI. As for the databases, perhaps you should use a ORM as abstraction. Then you can be fairly independent of the actual database that is used. At the price (as someone already noted) that you will do everybody a favor and not do any more presentation layer stuff in the data layer.

                            The language is JavaScript. that of Mordor, which I will not utter here
                            This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                            "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

                            Sander RosselS Offline
                            Sander RosselS Offline
                            Sander Rossel
                            wrote on last edited by
                            #17

                            CDP1802 wrote:

                            perhaps you should use a ORM as abstraction

                            This is the 'dynamic everything should be possible' kind of code. In my experience ORM's don't handle that very well... We've tried some solutions, but ultimately decided to build our own solution, which is what I'm now doing :laugh:

                            CDP1802 wrote:

                            you will do everybody a favor and not do any more presentation layer stuff in the data layer

                            I'm not ;)

                            Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                            Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                            Regards, Sander

                            L 1 Reply Last reply
                            0
                            • J Jorgen Andersson

                              It'll get even funnier when you realize that even when the SQL is completely compatible, the results may not be. For example: Oracle doesn't have an empty string.

                              Wrong is evil and must be defeated. - Jeff Ello

                              Sander RosselS Offline
                              Sander RosselS Offline
                              Sander Rossel
                              wrote on last edited by
                              #18

                              Jörgen Andersson wrote:

                              For example: Oracle doesn't have an empty string.

                              Or a bit/bool data type...

                              Jörgen Andersson wrote:

                              It'll get even funnier

                              I'm not laughing ;p

                              Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                              Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                              Regards, Sander

                              1 Reply Last reply
                              0
                              • Sander RosselS Sander Rossel

                                CDP1802 wrote:

                                perhaps you should use a ORM as abstraction

                                This is the 'dynamic everything should be possible' kind of code. In my experience ORM's don't handle that very well... We've tried some solutions, but ultimately decided to build our own solution, which is what I'm now doing :laugh:

                                CDP1802 wrote:

                                you will do everybody a favor and not do any more presentation layer stuff in the data layer

                                I'm not ;)

                                Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                                Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                                Regards, Sander

                                L Offline
                                L Offline
                                Lost User
                                wrote on last edited by
                                #19

                                Sander Rossel wrote:

                                This is the 'dynamic everything should be possible' kind of code.

                                Good luck. Everybody and his dog must give it a try, I guess.

                                The language is JavaScript. that of Mordor, which I will not utter here
                                This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                                "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

                                1 Reply Last reply
                                0
                                • J Jorgen Andersson

                                  Works in Oracle

                                  Wrong is evil and must be defeated. - Jeff Ello

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #20

                                  Works in SQL Server

                                  PooperPig - Coming Soon

                                  1 Reply Last reply
                                  0
                                  • Sander RosselS Sander Rossel

                                    Maybe when I retire?

                                    Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                                    Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                                    Regards, Sander

                                    P Offline
                                    P Offline
                                    phil o
                                    wrote on last edited by
                                    #21

                                    I don't think so. At that time, extensive usage of both systems during your carreer will have caused severe brain damages, displacing the moral pain to a physical, unsustainable pain. Better stick to Excel as early as possible ;P

                                    I never finish anyth

                                    Sander RosselS 1 Reply Last reply
                                    0
                                    • L Lost User

                                      Very true, but some people think it just does not feel right if it is not as complicated and convoluted as possible. Browsers, CSS, JavaScript HTMl, throw them all away and build a native client where ever possible. Then you will certainly have a better UI. As for the databases, perhaps you should use a ORM as abstraction. Then you can be fairly independent of the actual database that is used. At the price (as someone already noted) that you will do everybody a favor and not do any more presentation layer stuff in the data layer.

                                      The language is JavaScript. that of Mordor, which I will not utter here
                                      This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a fucking golf cart.
                                      "I don't know, extraterrestrial?" "You mean like from space?" "No, from Canada." If software development were a circus, we would all be the clowns.

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

                                      CDP1802 wrote:

                                      perhaps you should use a ORM as abstraction

                                      Works fine for CRUD, but...

                                      Wrong is evil and must be defeated. - Jeff Ello

                                      L 1 Reply Last reply
                                      0
                                      • Sander RosselS Sander Rossel

                                        So I've been doing Oracle development, coming from SQL Server. Simple string concatenation, which is + everywhere, is || in Oracle. A little research and || seems to be the ANSI standard, which makes sense as 2 || 'A' is now unambiguous '2A' (and not a conversion error). But now I want to write a simple SELECT statement which would work in both Oracle and SQL Server. Oracle doesn't support + and SQL Server doesn't support ||, however both support CONCAT. Seems too easy for something that's uneasy already, and indeed it is... SELECT CONCAT('A', 'B') FROM TABLE works in Oracle and SQL Server. SELECT CONCAT('A', 'B', 'C') FROM TABLE works only in SQL Server... Seems like the only thing that works in both databases is CONCAT('A', CONCAT('B', 'C')). And that seems like the only reasonable solution is to write two different queries, one for Oracle and one for SQL Server because it's just too friggin difficult to implement a standard FRIGGIN STRING CONCATENATION!!! X| When does the hurting stop? :((

                                        Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                                        Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                                        Regards, Sander

                                        M Offline
                                        M Offline
                                        Marc Clifton
                                        wrote on last edited by
                                        #23

                                        That's why I use a SQL builder. SQL - it's not Structured, it's not just Query, and it's not a Language. How the f*** did it get that acronym? Marc

                                        Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

                                        J Sander RosselS 2 Replies Last reply
                                        0
                                        • Sander RosselS Sander Rossel

                                          So I've been doing Oracle development, coming from SQL Server. Simple string concatenation, which is + everywhere, is || in Oracle. A little research and || seems to be the ANSI standard, which makes sense as 2 || 'A' is now unambiguous '2A' (and not a conversion error). But now I want to write a simple SELECT statement which would work in both Oracle and SQL Server. Oracle doesn't support + and SQL Server doesn't support ||, however both support CONCAT. Seems too easy for something that's uneasy already, and indeed it is... SELECT CONCAT('A', 'B') FROM TABLE works in Oracle and SQL Server. SELECT CONCAT('A', 'B', 'C') FROM TABLE works only in SQL Server... Seems like the only thing that works in both databases is CONCAT('A', CONCAT('B', 'C')). And that seems like the only reasonable solution is to write two different queries, one for Oracle and one for SQL Server because it's just too friggin difficult to implement a standard FRIGGIN STRING CONCATENATION!!! X| When does the hurting stop? :((

                                          Visit my blog at Sander's bits - Writing the code you need. Or read my articles at my CodeProject profile.

                                          Simplicity is prerequisite for reliability. — Edsger W. Dijkstra

                                          Regards, Sander

                                          L Offline
                                          L Offline
                                          Lost User
                                          wrote on last edited by
                                          #24

                                          SQL92 ftw :)

                                          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                                          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