Create Table using DBMS_SQL package and size not exceeding 64K

I have a size contraint that my SQL size should not exceed 64K.
Now I would appriciate if some one could tell me how to create a table using
Dynamic sql along with usage of DBMS_SQL package.
Brief Scenario: Users at my site are not given permission to create table.
I need to write a procedure which the users could use to create a table .ALso my SQL size should not exceed 64K. Once this Procedure is created using DBMS_SQL package ,user should pass the table name to create a table.
Thanks/

"If a user doesn't have permission to create a table then how do you expect they will be able to do this"
Well, it depends on what you want to do. I could write a stored proc that creates a table in my schema and give some other user execute privilege on it. They would then be able to create a able in my schema without any explicitly granted create table privilege.
Similarly, assuming I have CREATE ANY TABLE granted directly to me, I could write a stroe proc that would create a table in another users schema. As long as they have quota on their default tablespace, they do not need CREATE TABLE privileges.
SQL> CREATE USER a IDENTIFIED BY a
  2  DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp;
User created.
SQL> GRANT CREATE SESSION TO a;
Grant succeeded.
SQL> CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10));
CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10))
ERROR at line 1:
ORA-01950: no privileges on tablespace 'USERS'So, give them quota on the tablespace and try again
SQL> ALTER USER a QUOTA UNLIMITED ON users;
User altered.
SQL> CREATE TABLE a.t (id NUMBER, descr VARCHAR2(10));
Table created.Now lets see if it really belongs to a:
SQL> connect a/a
Connected.
SQL> SELECT table_name FROM user_tables;
TABLE_NAME
T
SQL> INSERT INTO t VALUES (1, 'One');
1 row created.Yes, it definitely belongs to a. Just to show that ther is nothing up my sleeve:
SQL> create table t1 (id NUMBER, descr VARCHAR2(10));
create table t1 (id NUMBER, descr VARCHAR2(10))
ERROR at line 1:
ORA-01031: insufficient privilegesI can almost, but not quite, see a rationale for the second case if you want to enforce some sort of naming or location standards but the whole thing seems odd to me.
Users cannot create tables, so lets give them a procedure to create tables?
John

Similar Messages

  • How to Create Table Using Column Drag and Drop Feature

    Hi:
    I am new to Oracle SQL dev Data Modeler tool and would like to know if there is a way to create a new table by re-using the existing columns or column groups. The idea is to maintain consistency and save table design time. If columns created previously can be re-used and require drag and drop of column in the right pane, then only new columns need to be manually created.
    Any thoughts on this will be appreciated.
    Thanks!

    Hi Kent
    I checked out the video and tried it in Oracle designer, it works and works great!
    My other question is that I may have several set of columns that I may want to group depending on the table requirements. Can I have multiple templates and choose which one to apply to?
    Also, how do I choose the table where the table template needs to be applied. As I may be interested in applying the table template to selected tables only.
    Thanks
    Edited by: user648132 on Feb 20, 2012 10:47 AM

  • Unable to create tables through dbms_sql

    Hai
    I got the below error when i am createing table through dbms_sql package at any user except sys user.Our database is 8.1.6 standard edition
    SQL>CONNECT MOHAN/MOHAN;
    SQL> CREATE OR REPLACE Procedure EXECUTESQL (SQLStatement IN VARCHAR2) IS cursor
    _name INTEGER; ret
    2 INTEGER; BEGIN cursor_name := DBMS_SQL.OPEN_CURSOR; DBMS_SQL.PARSE(cursor_n
    ame, SQLStatement,
    3 DBMS_SQL.native); ret := DBMS_SQL.Execute(cursor_name); DBMS_SQL.CLOSE_CURS
    OR(cursor_name); END;
    4 /
    Procedure created.
    SQL> exec EXECUTESQL('create table test(name number)');
    BEGIN EXECUTESQL('create table test(name number)'); END;
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 782
    ORA-06512: at "SYS.DBMS_SQL", line 32
    ORA-06512: at "MOHAN.EXECUTESQL", line 2
    ORA-06512: at line 1
    Any idea about that
    Thanks in advance
    mohan

    Since you are using Oracle 8.1.6, you can use EXECUTE IMMEDIATE instead of DBMS_SQL. Make sure that the necessary privileges have been granted directly, not through roles. Click on the link below for more about privileges and roles and the error message that you got:
    http://osi.oracle.com/~tkyte/Misc/RolesAndProcedures.html
    Once you have the privileges granted properly, you should be able to use the code below. I should point out that this is still doing things the hard way. You can just issue the create table statement from the SQL prompt. I must assume that this is just a minimal experiment and that the eventual code involves more.
    SQL> CREATE OR REPLACE PROCEDURE executesql
      2    (SQLStatement IN VARCHAR2)
      3  IS
      4  BEGIN
      5    EXECUTE IMMEDIATE SQLStatement;
      6  END executesql;
      7  /
    Procedure created.
    SQL> EXEC executesql ('CREATE TABLE test (name NUMBER)')
    PL/SQL procedure successfully completed.
    SQL> DESC test
    Name                                      Null?    Type
    NAME                                               NUMBER

  • Dynamic SQL using DBMS_SQL Package

    Hi,
    How do i construct a
    "select * from :table_name(input parameter)"
    in a store proc in Oracle8 ?
    I know this is only possible using DBMS_SQL package in Oracle 8.
    I know that this is easily done using native Dyanamic SQL 8i onwards.
    Also I want to return the resultset obtained above through a REF cursor.
    Please Help !!!
    Will be greatly indebted to anyone who can supply the code or direct me to some helpful information on the net.
    Thanks in advance.
    Peeyush

    You are asking for two things here, use the tablename dynamically
    as bind variable to fetch the resultset and send the resultset to
    a stored procedure.
    I thought of doing both of them with REF Cursors, no Dynamic SQL here.
    Consider the following test,SQL> create or replace package ref_types as
      2       type r_cursor(pSal NUMBER) is ref cursor;
      3  end;
      4  /
    Package created.
    -- Please note that I did some quick and dirty coding to switch
    -- between the table names to show the results.
    SQL> create or replace procedure p_dynamic_table
      2  (pRefCur IN ref_types.r_cursor, pTable varchar2) as
      3     emp_rec my_emp%ROWTYPE;
      4     inv_rec test444%ROWTYPE;
      5  begin
      6    loop
      7       IF UPPER(pTable) = 'MY_EMP' Then
      8          fetch pRefcur into emp_rec;
      9       Elsif UPPER(pTable) = 'INV' THEN
    10          fetch pRefCur into inv_rec;
    11       Else
    12          exit;
    13       End if;
    14       exit when pRefcur%NOTFOUND;
    15       If UPPER(pTable) = 'MY_EMP' Then
    16          dbms_output.put_line(emp_rec.empno);
    17       Elsif UPPER(pTable) = 'INV' Then
    18          dbms_output.put_line(inv_rec.seq);
    19       Else
    20         Null;
    21       End if;
    22    end loop;
    23  end;
    24  /
    Procedure created.
    SQL> declare
      2     vRefCur         ref_types.r_cursor;
      3     vTableName      Varchar2(30);
      4  begin
      5    vTableName := 'my_emp';
      6    open vRefCur for 'select * from ' || vTableName;
      7    p_dynamic_table(vRefCur, vTableName);
      8    close vRefCur;
      9    vTableName := 'inv';
    10    open vRefCur for 'select * from ' || vTableName;
    11    p_dynamic_table(vRefCur, vTableName);
    12    close vRefCur;
    13  end;
    14  /
    7369
    7499
    7521
    7566
    7654
    7698
    7782
    7788
    7839
    7844
    7876
    7900
    7902
    7934
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    PL/SQL procedure successfully completed.Thx,
    Sri

  • Logical error in creating tables using db link in solaris

    Hi,
    While creating table using the syntax create table newtab...as select * from tab@dblink .. I am facing a problem. The newtab table created is having a structure different (from datalength point of view of varchar2 and char datatypes) from the source. The data length is getting tripled i.e. if a column a is varchar2(20) in tab then it is becoming --- a varchar2(60) in newtab. This is happening in solaris environment when the two databases are in 2 different servers. Please let me know if there are any patches to resolve the problem.
    Thanks
    Arnab

    ORA-02019: connection description for remote database not foundHave you used this database link successfully for some other queries?
    The error posted seems to indicate that the DB Link is not functional at all. Has it worked for any other type of DML operation or is this the first time you ever tried to use the link?

  • "Use Toolkit Package" and "Gather" - When do you have to run them?

    Greetings,
      I have inherited a huge task sequence (MDT 2012 integrated with SCCM 2012) that calls "Use Toolkit Package" and "Gather" many many times even though there are only a few reboots.
      Is it true that the "Use Toolkit package" step (followed immediately by Gather) only need to be run right at the beginning of the TS and only after every reboot?
      Is it also true that the "Gather" step on it's own only needs to be run when you have run another step which may alter/create a variable which is used in the rules? (i.e. customsettings.ini).
    Thanks
    David Z

    Thanks.
    My question was when exactly do you need to run the steps. I suspect that many people have task sequences with loads of "use toolkit package" and "gather" in places when they are NOT needed.
    First let's look at the step "Use Toolkit Package". There is no reference to that task sequence step in the MDT documentation. Im aware that this simply copies the "deployment share" so all the scripts etc that are necessary for future task sequence steps
    are available (In MDT only environments this was not necessary as the UNC path to the deployment share was always available - so this is an SCCM only step). Your reference states that it copies it to the local hard drive. This is not entirely true. I understand
    that when Winpe is loaded, it is loaded into a ramdrive and therefore my "Use Toolkit package" step which is the first in the task sequence is loaded somewhere into the "RAM" drive (probably under "X" drive somewhere?).
    So my assumption is that "Use toolkit package" must be run as the first task sequence step, then any time immediately after the winpe system is restarted. If, during winpe and before the OS is loaded onto the hard drive, you format the hard drive (which
    is often the case), you do not need to run "Use Toolkit.." as it still exists in the RAM drive. When you apply the OS and restart, and then run "Use toolkit.." again, it must magically work out that it is to then load to the hard drive and not the RAM drive.
    However, once the "deployment share" has been loaded to hard drive, Im assuming that you never need to run the "Use toolkit.." again even if the system restarts as once it is loaded to the hard drive, it remains there (assuming you dont format disks again
    which is unlikely after the OS has loaded).
    The answer to "when must you run Gather" is alot trickier. The first assumption is that Gather has to be run immediately after "Use toolkit..." as the system has initialised or restarted and none of the variables created by "gather" exist.
    Im guessing that "gather" may need to be run when you suspect that something in the rules file has changed. For example, you may have run a task sequence step that sets variable "A" for the first time. Your rules file may generate another variable, "B",
    based on variable "A" so "gather" must be run to evaluate "B".
    However, once the OS has loaded and "gather" has been run, the variables.dat file is created and remains permanently on disk so that if the machine is restarted again, you dont have to run "gather" as all the variables persist in variables.dat.
    All of the above is an educated guess as I have searched the web extensively and have not found a definitive explanation. I would be grateful if anything above could be confirmed/denied so this could remain as a definitive guide  that may not help just
    me, but others :-).
    Thanks
    David Z

  • How to get list of tables used in packages

    Dear All
    Can you pls tell me how to get list of tables used in packages
    Regards

    select referenced_name
      from user_dependencies
    where name = 'your_package'
       and referenced_type = 'TABLE'Regards,
    Rob.

  • How to create table using Procedure

    Hi,
    I want to create table using procedure .
    How to write procedure for the table creation?
    thanks in advance.

    Use dynamic sql or DBMS_UTILITY.EXEC_DDL_STATEMENT:
    SQL> desc tbl1
    ERROR:
    ORA-04043: object tbl1 does not exist
    SQL> begin
      2      execute immediate 'create table tbl1(x number)';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> desc tbl1
    Name                                      Null?    Type
    X                                                  NUMBER
    SQL> drop table tbl1
      2  /
    Table dropped.
    SQL> begin
      2      DBMS_UTILITY.EXEC_DDL_STATEMENT('create table tbl1(x number)');
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> desc tbl1
    Name                                      Null?    Type
    X                                                  NUMBER
    SQL>  SY.

  • Capture process created by using DBMS_CAPTURE_ADM package won't enqueue

    I created Capture process using DBMS_CAPTURE_ADM.CREATE_CAPTURE on Oracle 9.2.0.6 database. It captured events, but didn't enqueue. My understanding of the difference of Capture creation between using DBMS_CAPTURE_ADM package and DBMS_STREAMS_ADM package is that the former way needs the DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION (or in schema, global level) procedure. Is there other differences? Any idea why the Capture process won't enqueue? Any help is appreciated.

    To implement a streams on the same database, just skip all about propagation. Only one setup queue is done and the apply process queue name is the capture process queue name. I used this technique to setup a Streams to MQ series:
    [http://www.smenu.org/tutorial_streams_14_MQ.html|http://www.smenu.org/tutorial_streams_14_MQ.html]

  • Why we have setup tables in LO extraction and why not in CO-PA,Generic,FI-S

    HI Friends
                    Why we have setup tables in LO extraction and why not in CO-PA,Generic,FI-SL. Please clarify.
    Thanks&Regards
    Revathi
    <removed by moderator>
    Edited by: Siegfried Szameitat on Nov 13, 2008 12:07 PM

    Hi revathi,
    The R/3 database structure for accounting is much more easier than the Logistical structure.
    Once you post in a ledger that is done. You can correct, but that give just another posting.
    BI can get information direct out of this (relatively) simple database structure.
    In LO, you can have an order with multiple deliveries to more than one delivery addresses. And the payer can also be different.
    When 1 item (orderline) changes, this can have its reflection on order, supply, delivery, invoice, etc.
    Therefore a special record structure is build for Logistical reports.and this structure now is used for BI.
    In order to have this special structre filled with your starting position, you must run a set-up. from that moment on R/3 will keep filling this LO-database.
    If you wouldn't run the setup. BI would start with data from the moment you start the filling of LO (with the logistica cocpit)
    I hope I have been clear.
    Udo

  • I had Premier pro given me by the college I attend and do no use wi fi and do not use cloud. My laptop completely died and will be sent back to Apple for exchange. How can I reinstall Premier Pro on a new Apple computer since the old one is completly dead

    I had Premier pro given me by the college I attend and do no use wi fi and do not use cloud. My laptop completely died and will be sent back to Apple for exchange. How can I reinstall Premier Pro on a new Apple computer since the old one is completly dead and could not be unregistered?

    Hi,
    You have not specified which version of Premiere Pro was given to you. If you don't have the disc (which i suppose you don't have) you will have to download it online.
    As far as your registration is concerned, for Premiere Pro CS6 or earlier you will have to reach Adobe chat support for further help: http://helpx.adobe.com/contact.html
    For Premiere Pro CC and later, you will not have much problems reactivating it.
    Thanks,
    Rameez

  • How I can delete my account from Itunes Store? [I am not using it anymore and will not]]

    How I can delete my account from Itunes Store? [I am not using it anymore and will not]

    Just stop using it and remove your payment info.
    There is no need to do more.

  • Is there a way to play video clips that use adobe flash and if not when are you going to resolve your problem with them ? I won't buy another apple product until you do and I Know I,m not the online.

    Is there a way to play video clips that use adobe flash and if not when are you going to resolve your problem with them ? I won't buy another apple product until you do and I Know I,m not the only one.

    Use the search feature and type in Flash and there are like thousands of posts on this.
    You seem to think you are addressing Apple with your post.  This is a user forum and we are all users just like you.

  • VF11 wrongly created with RV Doc type and with not clear status.

    Hi All
    Issue: There are 2 billing documents which were created(VF01) in March are canceled (VF11) in May. Cancel document is saved with a message (No automatic clearing of billing document XXXXXXXXX) and message diagnosis saying that u201CThe Automatic clearing of billing document and reversal is not possible. This may be, for example, because the line item update is deactivatedu201D
      In the SD document flow cancel billing document is created and it's posted to accounting with Document type RV(which is not configured in the billing  types) and it is in not clear status.
    2 Sales order types are ZNRC(No Rebate u2013 Credit)    second is ZCR (CM Req With Refer).
    Order Type  : ZNRC , Billing type :ZG2, Cancel billing type :Z5, Accounting document in billing type for ZG2: is DG and accounting document in cancel billing type Z5 is :(_) blank.
    Order type:  ZCR Billing type :G2, Cancel billing type :S2, Accounting document in billing type for G2: is DG and accounting document in cancel billing type S2 is :(_) blank.                                                
          FI document type Not maintained in the cancel billing type configuration because this should be determine by reversal document type DA which is maintained in DG document type from FI side. It will be triggered in VF11)
    The above configuration is working with the order created VA01,billing VF01 and cancelling VF11 done in same period. If the order and billing done in old period and canceling(VF11) done in current period than FI document creating with RV document type and with not clear status in the document flow.
    I reviewed similar issues with SAP Note and with below explanation:
              "There are 2 procedures that are possible when Vf11 is posted.
              Old Procedure - An FI "Reversal" document was created that was not connected with the orignal.
              New Procedure - A Real FI reversal was carried out with clearing."
    In this case, our system is following with new procedure except above mentioned orders created in previous period and and canceled in current period.
      My Questions are: How the RV document is getting triggered here? why the cancel document (Reversal FI Doc) is not clearing?
         Appreciate your answers or suggestions.
    Thanks in advance,
    Sunil
    Edited by: Sunil kumar Matta on Jun 9, 2011 3:40 PM

    Thank you Ivano.
      I referred SAP note 1259505 and 339928. But initially we thought of none of the symptoms mentioned in the SAP note are matching with our issue. Then we contacted SAP online support and they suggested checking one SAP note (Mentioned above).
      Our system is following new cancellation procedure, but itu2019s failing only for some few documents.
      Finally we identified several reasons for the issue. One is profitability segment in the billing document and cancelled document is different due to some changes in segment assignments. Another one is consolidation- consolidation document does not exist in the billing document list but it is getting created in Canceled document (VF11).(Consolidation postings are switched off some time back and now itu2019s on)
      After some discussions it is decided to include accounting document type (Reversal) in cancel billing types to avoid default RV document type in canceled billing document accounting document. And non-cleared documents need to be created manually in F-32.
      Thread is closed.
    Sunil

  • I have 2 games Words with Friends and Cityville that receives a Pop-up message form iTunes...  "Connect to iTunes to use Push Notifications" and will not allow me to exit out of the app or play.  How can I get this message to STOP?

    I have 2 games Words with Friends and Cityville that receives a Pop-up message form iTunes...  "Connect to iTunes to use Push Notifications" and will not allow me to exit out of the app or play.  How can I get this message to STOP?

    Yes - I connected my phone to my computer / Itunes and went into the apps section, but from there I have no idea how to manage the push notifications.  I even tryied going into itunes that is installed on my phone.  I still cannot find anyplace to manage these popups.  I have also gone into settings - notifiations - and tried turning all notifications for these apps all off but that didnt work either.  Any guidance is MUCH appreciated - Im not sure where to go from here.

Maybe you are looking for

  • Screen resolution in 10G and converison from 6i

    Scenario is something like this: We are converting forms from 6i to 10G. We have designed forms in 6i for 1024x768 screen resolution. We don't have any issues in 6i for screen resolution of 1024x768. We converted the form to 10G. Screen resolution is

  • Can't send mail after uploading iTUNES update

    This is the error that comes up in the mail connection doctor window; details. 1bd95300 +OK WROTE Jan 06 22:35:05.359 [kCFStreamSocketSecurityLevelNegotiatedSSL]  -- host:pop3.live.com -- port:995 -- socket:0x1bdd37b0 -- thread:0x1bd95300 QUIT READ J

  • Rendering issue with IE 7 and Vertical Menu Bar

    Can anyone tell me why the menu bar at http://www.d16acbl.org/ works beautifully with Firefox, but with IE 7.0: 1. The background of each submenu item doesn't block out underlying text, 2. The submenu for meeting minutes wraps, and 3. The third level

  • Nano not quite friends with iTunes

    Everytime I connect my iPod or a friends iPod (both nanos) to my computer after iTunes recognizes the device it ejects it. Ive changed the USB port i use (for reference I use an eMac 1.25 Ghz). If I change the permissions for iTunes by making the own

  • Any way in EBS for purchase dept to raise a request for a prepayment

    hello This morning i received a request from accounts department that they would not enter prepayments manually . Instead it should be like a PO process: the requestfor prepayment should be raised from purchasing department which should be approved a