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 SP coding style

Oracle SP coding style

Scheduled Pinned Locked Moved Database
sharepointoraclediscussion
9 Posts 4 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.
  • M Offline
    M Offline
    Mycroft Holmes
    wrote on last edited by
    #1

    I'm not a big fan of Oracle and am quite happy to delegate the coding of the more complex stored procedures to others. Because of this lack of knowledge I need some opinions. When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table. The proc is complex and there are a number of steps so the temp table is valid but I have problems with the use of concatenated strings. I would think this would negate any benefit from compiling the proc as this would on validate the concatenation of the strings and not their content.

    Never underestimate the power of human stupidity RAH

    G P J 3 Replies Last reply
    0
    • M Mycroft Holmes

      I'm not a big fan of Oracle and am quite happy to delegate the coding of the more complex stored procedures to others. Because of this lack of knowledge I need some opinions. When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table. The proc is complex and there are a number of steps so the temp table is valid but I have problems with the use of concatenated strings. I would think this would negate any benefit from compiling the proc as this would on validate the concatenation of the strings and not their content.

      Never underestimate the power of human stupidity RAH

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      EXECUTE IMMEDIATE is a generally accepted method of coding dynamic sql in PLSql. I use this methodology and have not had any issues - yes it can take a bit to get the concatenation of quotes etc correct - however in the end this works fine. If you are concerned about the content of the queries you could put the queries into a meta table and pull the queries in and build your dynamic sql at runtime.

      Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        I'm not a big fan of Oracle and am quite happy to delegate the coding of the more complex stored procedures to others. Because of this lack of knowledge I need some opinions. When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table. The proc is complex and there are a number of steps so the temp table is valid but I have problems with the use of concatenated strings. I would think this would negate any benefit from compiling the proc as this would on validate the concatenation of the strings and not their content.

        Never underestimate the power of human stupidity RAH

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Not that this helps but... I didn't know Oracle supported stored procedures, when I had to use it (1996-2001, Oracle 6?), we never used stored procedures, only PRO*C. And it was good. :cool:

        G M 2 Replies Last reply
        0
        • P PIEBALDconsult

          Not that this helps but... I didn't know Oracle supported stored procedures, when I had to use it (1996-2001, Oracle 6?), we never used stored procedures, only PRO*C. And it was good. :cool:

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #4

          You are correct, in terms of the naming convention they are called procedures - they are basically the same as Microsoft's stored procedures. Also procedures can be stored in packages(basically classes).

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          1 Reply Last reply
          0
          • G GuyThiebaut

            EXECUTE IMMEDIATE is a generally accepted method of coding dynamic sql in PLSql. I use this methodology and have not had any issues - yes it can take a bit to get the concatenation of quotes etc correct - however in the end this works fine. If you are concerned about the content of the queries you could put the queries into a meta table and pull the queries in and build your dynamic sql at runtime.

            Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            My point is that I don't think EVERY query should be dynamic sql. It has it's place but not for every single query.

            Never underestimate the power of human stupidity RAH

            G 1 Reply Last reply
            0
            • P PIEBALDconsult

              Not that this helps but... I didn't know Oracle supported stored procedures, when I had to use it (1996-2001, Oracle 6?), we never used stored procedures, only PRO*C. And it was good. :cool:

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              Even way back when I was using it there were procedures (about the same time). I pointed out to the developer that I could more easily do the string concatenation in c#, as per your prefferred method, than have him do it in PL/SQL. I pulled in another dev who has very good Oracle skills, the coding style will be changing to proper PL/SQL rather than dynamic sql.

              Never underestimate the power of human stupidity RAH

              1 Reply Last reply
              0
              • M Mycroft Holmes

                My point is that I don't think EVERY query should be dynamic sql. It has it's place but not for every single query.

                Never underestimate the power of human stupidity RAH

                G Offline
                G Offline
                GuyThiebaut
                wrote on last edited by
                #7

                I completely agree :thumbsup:

                Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
                1 Reply Last reply
                0
                • M Mycroft Holmes

                  I'm not a big fan of Oracle and am quite happy to delegate the coding of the more complex stored procedures to others. Because of this lack of knowledge I need some opinions. When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table. The proc is complex and there are a number of steps so the temp table is valid but I have problems with the use of concatenated strings. I would think this would negate any benefit from compiling the proc as this would on validate the concatenation of the strings and not their content.

                  Never underestimate the power of human stupidity RAH

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #8

                  Mycroft Holmes wrote:

                  When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table.

                  Only if it can't be done using normal PL/SQL. Which would mean almost never.

                  M 1 Reply Last reply
                  0
                  • J jschell

                    Mycroft Holmes wrote:

                    When building a SP is it reasonable to create a series of strings and then EXECUTE IMMEDIATE to load the results into a temp table.

                    Only if it can't be done using normal PL/SQL. Which would mean almost never.

                    M Offline
                    M Offline
                    Mycroft Holmes
                    wrote on last edited by
                    #9

                    That was my opinion, but without the authority of experience I am glad to have it confirmed. That dev now has a refactoring (rewrite) job to do. Luckilly this was the first couple of jobs I have given him.

                    Never underestimate the power of human stupidity RAH

                    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