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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Stored Procedure Pl/SQL

Stored Procedure Pl/SQL

Scheduled Pinned Locked Moved Database
databasetutorial
6 Posts 3 Posters 2 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.
  • C Offline
    C Offline
    Civic06
    wrote on last edited by
    #1

    how to write a stored procedure in which a temporary table is created and inserts are made into that table.

    V D 2 Replies Last reply
    0
    • C Civic06

      how to write a stored procedure in which a temporary table is created and inserts are made into that table.

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      CREATE PROC prc_insert_example
      AS

      SELECT * INTO #TEMP
      FROM MYTABLE

      OR

      CREATE PROC prc_insert_example
      AS

      CREATE TABLE #My_Temp
      (
      Age int,
      FName varchar(15)
      )

      insert into #My_Temp
      select Age,FName from MYTABLE

      Do you understand ?

      Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

      C 1 Reply Last reply
      0
      • V Vimalsoft Pty Ltd

        CREATE PROC prc_insert_example
        AS

        SELECT * INTO #TEMP
        FROM MYTABLE

        OR

        CREATE PROC prc_insert_example
        AS

        CREATE TABLE #My_Temp
        (
        Age int,
        FName varchar(15)
        )

        insert into #My_Temp
        select Age,FName from MYTABLE

        Do you understand ?

        Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

        C Offline
        C Offline
        Civic06
        wrote on last edited by
        #3

        THis syntax is not correct for a oracle stored procedure unless i am doing something wrong

        V 1 Reply Last reply
        0
        • C Civic06

          THis syntax is not correct for a oracle stored procedure unless i am doing something wrong

          V Offline
          V Offline
          Vimalsoft Pty Ltd
          wrote on last edited by
          #4

          I thought you wanted a SQl example , but am worried because you posted here without using google http://www.google.co.za/search?hl=en&q=create+a+temp+table+in+oracle&meta=&aq=1&oq=Create+a+temp+table+in+[^] Please don't do this again, its against the Forums policy. i forgive you for that. :)

          Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

          C 1 Reply Last reply
          0
          • V Vimalsoft Pty Ltd

            I thought you wanted a SQl example , but am worried because you posted here without using google http://www.google.co.za/search?hl=en&q=create+a+temp+table+in+oracle&meta=&aq=1&oq=Create+a+temp+table+in+[^] Please don't do this again, its against the Forums policy. i forgive you for that. :)

            Vuyiswa Maseko, Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers." C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.somee.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/

            C Offline
            C Offline
            Civic06
            wrote on last edited by
            #5

            I tried it but it doesn't seem to work. Also, I just read that in oracle stored procedures you shouldn't create the temp table in the procedure it should exist and then you may use it in the procedure. but how can it exist in advance.

            1 Reply Last reply
            0
            • C Civic06

              how to write a stored procedure in which a temporary table is created and inserts are made into that table.

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

              Oracle (PL-SQL) doesn't have temporary tables in the same way as SQL Server (T-SQL). Read up about Oracle Global Temporary Tables. These work in a different way from SQL Server #temp tables, but give you the same end result.

              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