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. Creating Table dynamically in Oracle 9i

Creating Table dynamically in Oracle 9i

Scheduled Pinned Locked Moved Database
8 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
    Mygrp
    wrote on last edited by
    #1

    SQL> create or replace procedure create_tablename(name varchar2) is 2 3 str varchar2(20) := name; 4 v_str varchar2(255); 5 Begin 6 v_str := 'Create table '||'AFR'||'_'||str||'(rollno NUMBER(2),name varchar2(10))'; 7 Execute immediate v_str; 8 End; 9 / Procedure created. SQL> variable abc varchar2(20) SQL> exec create_tablename(:abc); BEGIN create_tablename(:abc); END; * ERROR at line 1: ORA-01031: insufficient privileges ORA-06512: at "SCOTT.CREATE_TABLENAME", line 7 ORA-06512: at line 1 hey can any1 suggest what exactly the problem is? The above code is for creating the table dynamically in Oracle 9i....

    J 1 Reply Last reply
    0
    • M Mygrp

      SQL> create or replace procedure create_tablename(name varchar2) is 2 3 str varchar2(20) := name; 4 v_str varchar2(255); 5 Begin 6 v_str := 'Create table '||'AFR'||'_'||str||'(rollno NUMBER(2),name varchar2(10))'; 7 Execute immediate v_str; 8 End; 9 / Procedure created. SQL> variable abc varchar2(20) SQL> exec create_tablename(:abc); BEGIN create_tablename(:abc); END; * ERROR at line 1: ORA-01031: insufficient privileges ORA-06512: at "SCOTT.CREATE_TABLENAME", line 7 ORA-06512: at line 1 hey can any1 suggest what exactly the problem is? The above code is for creating the table dynamically in Oracle 9i....

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

      That's as close to a clear text message as you get from Oracle. ORA-01031 means you're not having the privilege to do what you just tried to do. ORA-06512 tell you where the error happened. So it means that your user is not having Create Table rights in tablespace Scott.

      S 1 Reply Last reply
      0
      • J Jorgen Andersson

        That's as close to a clear text message as you get from Oracle. ORA-01031 means you're not having the privilege to do what you just tried to do. ORA-06512 tell you where the error happened. So it means that your user is not having Create Table rights in tablespace Scott.

        S Offline
        S Offline
        scottgp
        wrote on last edited by
        #3

        Technically it's the SCOTT schema, not necessarily a SCOTT tablespace. Scott (coincidentally)

        J 1 Reply Last reply
        0
        • S scottgp

          Technically it's the SCOTT schema, not necessarily a SCOTT tablespace. Scott (coincidentally)

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

          Quite correct.

          M 1 Reply Last reply
          0
          • J Jorgen Andersson

            Quite correct.

            M Offline
            M Offline
            Mygrp
            wrote on last edited by
            #5

            Firstly thnx for your quick reply. And could you suggest a way in which the above error could be corrected. Even tried logging in as user:system. But it did not help. Same error.

            S J 2 Replies Last reply
            0
            • M Mygrp

              Firstly thnx for your quick reply. And could you suggest a way in which the above error could be corrected. Even tried logging in as user:system. But it did not help. Same error.

              S Offline
              S Offline
              scottgp
              wrote on last edited by
              #6

              Does Scott have 'create table' privileges?

              1 Reply Last reply
              0
              • M Mygrp

                Firstly thnx for your quick reply. And could you suggest a way in which the above error could be corrected. Even tried logging in as user:system. But it did not help. Same error.

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

                Login with sys and whatever password you have, and set the correct correct privileges for user scott. Or create a new user with the proper access rights for schema scott. Or (this is from memory and might not be correct) add "SQLNET.AUTHENTICATION_SERVICES = (NTS)" into sqlnet.ora to be able to use NT security

                R 1 Reply Last reply
                0
                • J Jorgen Andersson

                  Login with sys and whatever password you have, and set the correct correct privileges for user scott. Or create a new user with the proper access rights for schema scott. Or (this is from memory and might not be correct) add "SQLNET.AUTHENTICATION_SERVICES = (NTS)" into sqlnet.ora to be able to use NT security

                  R Offline
                  R Offline
                  RussellT
                  wrote on last edited by
                  #8

                  I suppose it is unkind to laugh at people who are fumbling around with problems in technologies they do not understand, but this is a funny little exchange. First: SQLNET.AUTHENTICATION_SERVICES has nothing to do with the person's problem. Second: The person's error is quite self-explanatory. Third: One wonders why he (or his helpers here) did not just Google the error message. The solution would have been quickly found. The problem is that the person is either 1) trying to create a table in his own schema without having the CREATE TABLE privilege, or 2) trying to create a table in another schema without the CREATE ANY TABLE privilege. In addition, the user's account must have a quota on its default tablespace or have the UNLIMITED TABLESPACE privilege without one of which the ORA-01536 error will occur. Kind regards, Russ

                  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