Create table or MV in PL/SQL

Hey everybody,



It is probably a very simple question, but I can't seem to create a table in a PL/SQL procedure. I have something like this:



PROCEDURE TEST_PROC IS

BEGIN

RUN IMMEDIATELY "CREATE TABLE TEST_TBL AS SELECT * FROM DUAL';"

END TEST_PROC;



I get an error of privs when I try to execute the proc. I also tried everything first create a view, materialized in a very similar way, but it also did not work.



I did some research and on a blog, they created a table by using the statement of full table create for example CREATE TABLE NAME (COLUMN1 TYPE1, etc...);



But I want to create the table using the clause 'AS' and the definition of a query.



Is there a specific privilege that I have to be able to do this? It seems simple enough.



Thank you!



-Joe

No, you need (again) CREATE TABLE privilege. CREATE ANY TABLE is to create arrays in other patterns.

Tags: Database

Similar Questions

  • How to create tables for use in php/SQL Web site

    Sorry to ask the fundamental question because I am known.

    I built a site dw to registration of several products. I was following DW, the Missing Manual book tutorials. The tutorial provides data downloadable tabels in a folder with the extension .sql. I can't find anywhere a statement that the way in which the .sql file is created.

    Second question: if it can be created in Access 2007, please tell me how.

    Thank you very much.

    Try reading the following article for some tips. http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html. Life becomes much easier when you understand the basic principles of standardization.

  • SQL-Lite create Table?

    I am wanting to save a string of text in a sql database - lite which is called "message1."  I press save button to call this code in my interlocutor.

    URI myURI = URI.create("file:///SDCard/flash.db");
    DatabaseFactory.open(myURI);
    Statement st = d.createStatement( "CREATE TABLE Restaurant (Experience TEXT)" );
    Dialog.alert("Here1!");
    st.prepare();
    st.execute();
    st.close();  
    
    Statement st1 = d.createStatement("INSERT INTO Restaurant(Experience) VALUES ('message1')");
    st1.prepare();
    st1.execute();
    st1.close();
    d.close();
    Dialog.alert("Your info was saved!");
    

    I can't even my Dialog statement to appear?  I do something wrong in the line where I create the table?

    Statement st = d.createStatement ('CREATE TABLE Restaurant (experience TEXT)');

    Because when I move the dialog statement before this line... I can see the dialog box

    Database db;
    URI myURI = URI.create("file:///SDCard/flash.db");
    db = DatabaseFactory.open(myURI);
    
    Statement st= db.createStatement("CREATE TABLE 'Restaurant' ( "
                        + "'Experience' TEXT)");
                st.prepare();
                st.execute();
                st.close();
    
                Statement st1 = db.createStatement("INSERT INTO Restaurant(Experience) VALUES ('Message1')");
                st1.prepare();
                st1.execute();
    
    db.close();
    

    I checked the code and its working very well.

    ----------------------------------------------------------
    feel free to press the congratulations on the left side to thank the user who has helped you.
    Please mark as resolved messages if you found a solution.

  • Create table form another table in different schema throwing error when dynamic sql

    Hello

    With the help of 11.2.0.3 and was following the issue.

    To create a table in a schema (b) using data from another schema (b)

    If independent run in sqlplus create works OK but same sql in dynamic sql block saying the table or view does not exist.

    SQL even in dynamic sql

    {code}

    v_sql: =' create table new_table in select * from schemab.table_name where...';

    run immediately (v_sql);

    [code}

    Other tables work fine.

    Any ideas - don't want to grant all the schemaa.table schema b if can avoid.

    Thank you

    You run the immediate execution in an anonymous block or a stored procedure?  If it is a stored procedure, then as others have said, the owner of the procedure must have select privileges on granted directly schemab.table_name.

    Another possibility, which would be the case for a stored procedure, or an anonymous block is that your code is something like:

    v_sql: =' create table new_table in select * from schemab.table_name where...';

    immediately run v_sql;

    Select count (*) in the l_count new_table;

    who will fail at compile time because new_table does not exist.

    When you create objects using dynamic sqly you dynamic sql user to reference them in the block of code.

    John

  • table/view not found when creating a package, but can execute sql...

    I'm trying to create a package I'm ora-00942 table or view does not exsit, but when I run with the same user tries to create the package in the sql statement that gives NO error through fine.

    Any idea what can cause that?

    -drop table demo_hdr_trgt

    -drop table demo_hdr_stg

    -It's the tabe belong to the other user not my own schema

    connect tstdata/tstdata

    create the table demo_hdr_stg as floor (dbms_random.value (1,101)) select id, floor (dbms_random.value (1001,100001)) double amt connect by level < = 100

    /

    -It's my diagram

    connect me3/me3

    create the table demo_hdr_trgt in select * from hdr_stg where 1 = 0

    /

    Select * from tstdata.demo_hdr_stg by id

    /

    Select * from demo_hdr_trgt by id

    /

    -business for this temporary table to demo rule

    ALTER TABLE demo_hdr_trgt add PRIMARY KEY (id)

    /

    -table to the control of the error for the DML

    Start

    DBMS_ERRLOG. CREATE_ERROR_LOG('tstdata.) DEMO_HDR_STG');

    end

    /

    -Follow-up of the load table if he succeeds

    CREATE TABLE demo_RESULT_TAB

    (VARCHAR2 (100) 'RUN_NAME',)

    VARCHAR2 (100) "V_MODULE."

    VARCHAR2 (100) "V_ACTION."

    NUMBER OF "ROWCOUNT".

    )

    /

    -Follow-up of the other error table

    CREATE TABLE demo_ERROR_TAB

    (VARCHAR2 (100) 'RUN_NAME',)

    VARCHAR2 (100) "V_MODULE."

    VARCHAR2 (100) "V_ACTION."

    NUMBER OF "SQLCODE"

    "SQLERRM' VARCHAR2 (4000).

    "CALL_STACK' CLOB

    )

    /

    -package charge demo

    create or replace package demo_hdr_pkg as

    procedure hdr_ldr (run_name varchar2);

    end demo_hdr_pkg

    /

    create or replace package body demo_hdr_pkg as

    procedure hdr_ldr (run_name varchar2) is

    number of v_sqlcode;

    v_sqlerrm varchar2 (1000);

    v_module varchar2 (100): = "demo_hdr_pkg.hdr_ldr";

    v_action varchar2 (100): = "insert into hdr_trgt";

    number of v_rowcount;

    Start

    DBMS_APPLICATION_INFO.set_module (module_name = > v_module,)

    action_name = > v_action);

    -the sql code that gives ora-00942 errors that I can review independent

    -INSERT / * + append PARALLEL * /.

    INSERT / * + PARALLEL * /.

    IN demo_hdr_trgt, SELECT id, tstdata.demo_hdr_stg amt

    LOG ERRORS IN tstdata. ERR$ (run_name) _demo_HDR_STG

    REJECT LIMIT UNLIMITED;

    v_rowcount: = number of lines sql %;

    INSERT into demo_result_tab (run_name, v_module, v_action, rowcount) values (run_name, v_module, v_action, v_rowcount);

    commit;

    exception when others then

    dbms_output.put_line(SQLCODE||) e '|| SQLERRM);

    v_sqlcode: = sqlcode;

    v_sqlerrm: = sqlerrm;

    insert into demo_error_tab (run_name, v_module, v_action, sqlcode, sqlerrm, call_stack) values (run_name, v_module, v_action, v_sqlcode, v_sqlerrm, dbms_utility.format_call_stack);

    commit;

    -dbms_scheduler to analyze the error table and send e-mail

    end;

    end demo_hdr_pkg

    /

    -test

    declare

    v_runname varchar2 (100): = to_char (sysdate, 'YYYY_MM_DD_HH24_MI_SS');

    Start

    demo_hdr_pkg.hdr_ldr (v_runname);

    end

    /

    Select * from demo_hdr_stg by id

    /

    Select * from demo_hdr_trgt by id

    /

    Select * from demo_error_tab

    /

    Select * from demo_result_tab

    /

    This question is asked almost every day...

    http://martincarstenbach.WordPress.com/2010/05/27/the-difference-between-a-direct-grant-and-a-role-in-PLSQL/

    Summary, you need a DIRECT grant (not through a role), or you could modify the procedure to use the rights of the appellant (the default is rights define).

    See you soon,.

  • SQL authentication provider - create table script

    Hi all!
    I would use the SQL provider for my Web application authentication. I can't find the script to create tables of users/roles used by the provider.
    Can you suggest me a link where I can download?
    Thank you
    Frank

    Hi Frank,.

    Configure the SQL authenticator:

    Start Oracle XE DB and open propmt SQL to run commands below:

    CREATE TABLE USERS)
    U_NAME VARCHAR (200) NOT NULL,
    U_PASSWORD VARCHAR (50) NOT NULL,
    U_DESCRIPTION VARCHAR (1000))
    ;
    ALTER TABLE USERS
    ADD CONSTRAINT PK_USERS
    PRIMARY KEY (U_NAME)
    ;
    CREATE TABLE GROUPS)
    G_NAME VARCHAR (200) NOT NULL,
    G_DESCRIPTION VARCHAR (1000) NULL)
    ;
    ALTER TABLE GROUPS
    ADD CONSTRAINT PK_GROUPS
    PRIMARY KEY (G_NAME)
    ;
    CREATE TABLE GROUPMEMBERS)
    G_NAME VARCHAR (200) NOT NULL,
    G_MEMBER VARCHAR (200) NOT NULL)
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT PK_GROUPMEMS
    (PRIMARY KEY)
    G_NAME,
    G_MEMBER
    )
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT FK1_GROUPMEMBERS
    FOREIGN KEY (G_NAME)
    REFERENCE (G_NAME) GROUPS
    ON DELETE CASCADE

    Generally, customers can add users directly in DB with help commands below:

    insert into USERS (U_NAME, U_PASSWORD, U_DESCRIPTION) values ('system', 'weblogic', 'user admin');
    insert into GROUPS (G_NAME, G_DESCRIPTION) values ('Administrators', 'Administrators');
    insert into values('Administrators','system') GROUPMEMBERS (G_NAME, G_MEMBER);

    But in this case is not encrypted password then, either you can add users via the console or WLST script to be stored in encrypted form.

    We had performed above commands just to check that the user that is stored directly in the DB gets properly authenticated or not configured SQL authenticator as below

    Now start weblogic admin server and console access to create the data source by the navigation Services-> JDBC-> data sources

    Create the data source named SqlDS

    JNDI: SqlDS

    Type of DB: Oracle

    : DB driver Oracle Thin XA

    Name of the data base: XE

    DB host:

    Port: 1521

    DB user:

    DB password:

    Even the rest of the configuration and click test Configuration. If its success click on next and it targets to "AdminServer.

    Click Finish and activate chnages

    Now navigate to the areas of security-> myrealm-> suppliers

    Click new and supply the names of SqlAuthenticator and select Type of SQLAuthenticator

    Now click on newly created provider and make the indicator of control as "sufficient".

    Go to the specific page of provider:

    1. check on cleartext passwords enabled.

    2. provide a data name source: SqlDS

    Keep the rest of the parameters it is and save this configuration. It will ask you to restart the management server.

    Now, again navigate areas of security-myrealm-> users & groups >

    User created directly in the DB control is listed in the table with SqlAuthenticator, once its list, go ahead and add users as below

    B. Cretae users using the administration console:

    Sign in to the administration console

    Access areas of security-myrealm-> users & groups >

    Click the users tab and try to create the new user

    User name:

    Select authentication provider: SqlAuthenticator

    User password:

    Once the table DB check creating user, this user added with password encypted musted

    C. create multiple users using WLST script:

    File Navigave of $DOMAIN_HOME/bin and run the file setDomainEnv as below:

    UNIX:. ./setDomainEnv.sh (don't forget to put two points before /)

    Windows: setDomainEnv.cmd

    Now, change script depending on your environment below and run as suggested in step 3:

    Connect('weblogic','weblogic123','t3://localhost:7001')
    Edit()
    startEdit(-1,-1,'false')
    serverConfig()
    CD('/SecurityConfiguration/base_domain/Realms/MYREALM/AuthenticationProviders')
    ls()
    CD ('SqlAuthenticator')
    cmo.createUser ('vaishali', 'weblogic123', 'SQLuser')

    cmo.createUser ('pavashe', 'weblogic123', 'SQLuser')
    Edit()
    stopEdit('y')

    NOTE: Change username, password, and ADMIN_URL in 1st line.

    Replace the domain name "base_domain" by your domain online no.: 5

    Authenticator name change SQL online no: 6 by your authenticator name

    Next lines create users. You need to add however to users, you need to create programmatically.

    Syntax: cmo.createUser ('user_name', 'user_password', 'user_description')

    Now, to save these commands in a file with the extension .py and run as below:

    # java weblogic. WLST create_user.py

    If your script does not have to try running each command separately. For this session WLST beginning as below:

    # java weblogic. WLST

    Now run above commands in the script. You will be able to debug if something went wrong during execution of script.

    Kind regards
    Kal

  • DB tools create Table

    Hello.. I got this error when trying to create a database

    Conn Execute.vi-> DB tools create Table.vi--> CreateDatabase.viException occurred in the Microsoft Office Access database engine: syntax error in the statement CREATE TABLE in Conn Execute.vi-> DB tools create Table.vi-> CreateDatabase.vi

    I can't open your vi, but in many cases, the syntax error is caused by the invalid table or field names (reserved words, spaces or invalid characters). In this case, you can change the names; Alternatively, you can frame them square brackets: [my_column_name].

    If you open the DB create Table.vi-> Conn Execute.vi block diagram, you can enter the full text of the SQL query and post, so we can take a look.

  • FREELISTS and FREELIST GROUPS of CREATE TABLE

    My oracle 10g, create table statement is below:

    CREATE TABLE S005. Test

    (

    AAA char (1)

    )

    PCTFREE 0

    STORAGE)

    FREELISTS 10

    FREELIST GROUPS 20

    )

    LOGGING

    NOCACHE

    NOPARALLEL

    NOMONITORING;

    After performing this sql, I have a query table USER_TABLES but FREELISTS and FREELIST_GROUPS fields show nothing.

    In my view, FREELISTS value must be 10, and FREELIST_GROUPS should be 20. How to retrieve these values?

    Thank you very much

    SAMS - Oracle FAQ

  • Create table ORA-01031: insufficient privileges

    SQL > indicate user USER is 'TEST_RPT.

    SQL > CREATE TABLE mytest (id NUMBER); - it does not work

    CREATE TABLE mytest (id NUMBER)

    * ERROR at line 1: ORA-01031: insufficient privileges

    SQL > CREATE TABLE TEST_RPT.mytest (id NUMBER).

    Table created. SQL >


    SQL > select * from session_privs;

    PRIVILEGE

    ----------------------------------------

    ANY PROCEDURE DEBUG

    DEBUGGING SESSION CONNECT

    CREATE INDEXTYPE

    OPERATOR TO CREATE

    CREATE THE TYPE

    CREATE THE TRIGGER

    CREATE PROCEDURE

    CREATE SEQUENCES

    CREATE VIEW

    CREATE SYNONYM

    CREATE THE CLUSTER

    CREATE TABLE

    UNLIMITED TABLESPACE

    ALTER SESSION STATEMENT

    CREATE SESSION

    Try this:

    SELECT USER, SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL;

    The two identical values? CURRENT_SCHEMA is what will determine the owner of the table you create, if you do not specify an owner.

    This can be changed by

    ALTER SESSION SET CURRENT_SCHEMA = whatever_you_want_it_to_be;

  • epengs.dB (ENG) + error CREATE TABLE PS_1099C_CUST_DATA


    PT 8.54.10

    FSCM 9.2 (picture 13)

    SQL Server 2008 (64-bit)

    We get below error when we are in the stages of the creation of the DB via DM scripts.

    Started the: Tue Nov 17 02:10:54 2015
    Release of Data Mover: 8.54.10
    Database: FSDMO92 (ENG)
    Input file: E:\FSDMO92\data\epengs.db (ENG)
    Import 1099C_CUST_DATA
    Create Table 1099C_CUST_DATA
    -SQL error. Position of the error: 0 return: 8601 -.


    [Microsoft] [SQL Server Native Client 10.0] [SQL Server] Column, parameter, or variable #4: could not find the PSDATE data type.
    [Microsoft] [SQL Server Native Client 10.0] [SQL Server] Instructions could not be prepared. (SQLSTATE 37000) 8180

    CREATE TABLE PS_1099C_CUST_DATA (CUST_ID varchar (15) NOT NULL, TIN varchar (20) NOT NULL, TAXPAYER_ID varchar (14) is NOT NULL, ASOF_DATE PSDATE NULL, decimal ENTRY_AMT (26, 3) NOT NULL, decimal INTEREST_EXPENSE (26, 3) NOT NULL, Name1 varchar (40) NOT NULL, NAME2 varchar (40) NOT NULL, NOT NULL of the varchar (55), of ADDR_LN1 ADDR_LN2 varchar (55) NOT NULL) , ADDR_LN3 varchar (55) NOT NULL, ADDR_LN4 varchar (55) NOT NULL, CITY varchar (30) NOT NULL, NOT NULL of the varchar (6) State, POSTAL varchar (12) NOT NULL, TEL varchar (24) is NOT NULL, NAME varchar (50) NOT NULL, Name3 varchar (40) NOT NULL, name4 varchar (40) NOT NULL, CITY3 varchar (30) NOT NULL, Address1 varchar (55) NOT NULL , State3 varchar (6) NOT NULL, POSTAL...
    Error: Unable to process create statement for 1099C_CUST_DATA
    Ending: Tue Nov 17 02:10:56 2015
    Unsuccessful end

    Cannot find the data type PSDATE comes here.  Looks like one of the required scripts has not been executed.  It has been long since I am on a site of SQL Server, but I understand the substance of this issue.  PeopleSoft creates a customized in SQL Server PSDATE data type which is an extension of the date format.

    Rather than to point you to the script, I suggest you go back and find where this prerequisite is necessary and make sure that you are not lacking in any other required component.

  • Need help - multilevel nested table - create table problem

    Hello

    My version of oracle db: 11g

    I just created a table that contains a nested multi-level table.

    Here is the code:

    create or replace type sdef_t_nt_empNames21 is table of the varchar2 (50);

    create or replace type sdef_ot_SCmarks21 as an object (number of physics, chemistry number, number of Biology);

    create or replace type sdef_t_nt_SCmarks21 is table of the sdef_ot_SCmarks21;

    create or replace type sdef_ot_allsubmarks21 as an object (eid, eng, math, sc sdef_t_nt_SCmarks21 number number);

    create or replace type sdef_t_nt_dep_m_info21 is table of the sdef_ot_allsubmarks21;

    create the table nt_dep21

    (number of fact

    , dname varchar2 (50)

    c_sdef_t_nt_empNames21 sdef_t_nt_empNames21

    c_sdef_t_nt_dep_m_info21 sdef_t_nt_dep_m_info21)

    nested as NT_c_sdef_t_nt_empNames21 table c_sdef_t_nt_empNames21 store

    store table nested like NT_c_sdef_t_nt_dep_m_info21; c_sdef_t_nt_dep_m_info21  <-I know that the problem is here.

    TRACE OF THE ERROR:

    Error at startup on line: 13 in the command.

    create the table nt_dep21

    (number of fact

    , dname varchar2 (50)

    c_sdef_t_nt_empNames21 sdef_t_nt_empNames21

    c_sdef_t_nt_dep_m_info21 sdef_t_nt_dep_m_info21)

    nested as NT_c_sdef_t_nt_empNames21 table c_sdef_t_nt_empNames21 store

    Nested table c_sdef_t_nt_dep_m_info21 (sdef_t_nt_SCmarks21) store as NT_c_sdef_t_nt_dep_m_info21

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    PS: I'm just solve a problem given to me by some1, is not a practical implementation, I'm just trying to get through

    I'm sure that some1 could help me with this, I have searched a lot of this problem but could not find my answer, please help me.

    Concerning

    Rahul

    SQL > create table (nt_dep21)
    Did number 2,
    3 dname varchar2 (50).
    4 c_sdef_t_nt_empNames21 sdef_t_nt_empNames21,
    c_sdef_t_nt_dep_m_info21 5 sdef_t_nt_dep_m_info21
    6                       )
    store c_sdef_t_nt_empNames21 7 nested as NT_c_sdef_t_nt_empNames21 table
    store c_sdef_t_nt_dep_m_info21 8 table nested as NT_c_sdef_t_nt_dep_m_info21)
    9 table nested as NT_sc sc store
    10                                                                               )
    11.

    Table created.

    SQL >

    SY.

  • COPY OF DB1 to DB2 CREATE TABLE...

    If I run script (3) in the database of and remove (-), it will run.  But when I turn into a COPY OF DB1 to DB2 (my example uses DB1 to DB1 for you) and try and run - it returns immediately and does not create the table in the database TO.  And I do not get an error.

    I'm looking for 40 + combos 3 different characters but the characters are not separated in the table, it's just all crushed together.  I try so to analyze the data, and then look 3 character codes.  (I know it's a ugly script).

    Are there limits using a script to COPY OF DB1 to DB2?  For me, it was mentioned that there are too many characters in my select statement.  If this is the case, anyone have any suggestions?


    Thank you in advance... Shelli

    --(1) CREATE TABLE RPO_EX

    create table rpo_ex)

    EMP varchar2 (25).

    option_group varchar2 (100));

    --(2) INSERT SOME SAMPLE DATA INTO THE RPO_EX TABLE

    insert into rpo_ex values ("Gary", "AL0AQ9ATHAT8AXJAYGCF5CJ2DCPDR5EF7FE2FE9FHOF46GGCGW6G7Q");

    insert into rpo_ex values ("Gary", "H2GIO3I15J55KA1KR1LALLTGMAHMYANP5NT7Q5URA6R6WR9NSLMTUJ");

    insert into rpo_ex values ("Gary", "UDDUE1UPFUQAU2KU80VH9VK3VRGVRHVRJVRKVRLVRMVRNVRRVT7V8D");

    insert into rpo_ex values ("Gary", "WMFXFE1SD1SZ4AA5A76SU7SU8GR9GR9L3");

    insert into rpo_ex values ('Craig', 'AL0AQ9ATHAT8AXJAYGCJ2DCPDR5EF7FE2FE9FHOGANGGCGM3HHMIO3');

    insert into rpo_ex values ('Craig', 'I15J55KR1LALLCVMAHMYANP5NT7Q5URA6R6WR9NSLMS08TUJUDDUE1');

    insert into rpo_ex values ('Craig', 'UPFUQAU2KU80VH9VRGVRHVRJVRKVRLVRMVRNVRRVT7V8DWMFYM81SA');

    insert into rpo_ex values ('Craig', '1SZ4C15A76SA7SA8GM9GM9L3');

    insert into rpo_ex values ('Fred', '1SZ4AA5A76SA7SA8GM9GM9L3');

    insert into rpo_ex values ('Fred', 'AL0AQ9ATHAT8AXJAYGCJ2DCPDR5EF7FE2FE9FHOGBAGGCGM3H2GIO3');

    insert into rpo_ex values ('Fred', 'I15JE5KR1KTILALLCVMAHMYANP5NT7Q5WRA3R6WR9NSLMTUJUDDUE1');

    insert into rpo_ex values ('Fred', 'UPFUQAU2KU80VH9VK3VRGVRHVRJVRKVRLVRMVRNVRRVT7V8DWMF1SA');

    insert into rpo_ex values ('Frank', 'AL0AQ9ATHAT8AXJAYGCF5CJ2DCPDR5EF7FE2FHOGGCGW6G1MH2GIO3');

    insert into rpo_ex values ('Frank', 'I15J55KR1LALLTGMAHMYANC7NP5NU5RA6R1UR6WR9NSLMTUJUDDUE1');

    insert into rpo_ex values ('Frank', 'UPFUQAU2KU80VH9VK3VRGVRHVRJVRKVRLVRMVRNVRRVT7V8DWMFXFE');

    insert into rpo_ex values ('Frank', 'YF51SC1SZ4AA5A76SA7SA8GM9GM9L3');

    insert into rpo_ex values ("Jim", "4C15A76SA7SA8GM9GM9L3");

    insert into rpo_ex values ("Jim", "AL0AQ9ATHAT8AXJAYGCJ2DCPDR5EF7FE2FE9FHOGGCGM3GTRHHMIO3");

    insert into rpo_ex values ("Jim", "I15JE5KR1KTILALLCVMAHMYANP5NT7Q5WRA3R6WR9NSLMTUJUDDUE1");

    insert into rpo_ex values ("Jim", "UPFUQAU2KU80VH9VRGVRHVRJVRKVRLVRMVRNVRRVT7V8DWMF1SA1SZ");

    sqlplus usr/pw@db1 @ 'copy_rpo_ex.sql' usr/pw@db1 usr/pw@db1


    --(3) COPY OF THE TABLE CREATION SCRIPT

    whenever sqlerror exit rollback sql.sqlcode

    SET ARRAYSIZE 5000

    SET COPYCOMMIT 20

    set linesize 4000

    TERMOUT OFF SET

    COPY OF usr/pw@db1 to usr_pw_db1-

    CREATE using rpo_ex2-

    SELECT * FROM (-)

    WITH v1 as (-)

    Select emp, option_group, | " -

    substr (option_group, 1, 3)-

    ||','|| substr (option_group, 4, 3)-

    ||','|| substr (option_group, 7, 3)-

    ||','|| substr (option_group, 10, 3)-

    ||','|| substr (option_group, 13, 3)-

    ||','|| substr (option_group, 16, 3)-

    ||','|| substr (option_group, 19, 3)-

    ||','|| substr (option_group, 22, 3)-

    ||','|| substr (option_group, 25, 3)-

    ||','|| substr (option_group, 28, 3)-

    ||','|| substr (option_group, 31, 3)-

    ||','|| substr (option_group, 34, 3)-

    ||','|| substr (option_group, 37, 3)-

    ||','|| substr (option_group, 40: 3)-

    ||','|| substr (option_group, 43, 3)-

    ||','|| substr (option_group, 46, 3)-

    ||','|| substr (option_group, 49: 3)-

    ||','|| substr (option_group, 52, 3) | ',' RPO-

    of rpo_ex).

    Select emp, case.

    When (rpo like ('% UFF %') and rpo like ('% UP9% ')) then 'UFF + UP9 -.

    When the rpo like ('% ADG %') then 'ADG ' -.

    When rpo love ("IO3%") then "IO3 -.

    When the rpo as ("IO4%") then "IO4 -.

    When the rpo as ('IO5% ") then 'IO5 -.

    When the rpo as ("IO6% %") then "IO6" -.

    When rpo like ('% ROMANO %') then 'ROMAN '.

    When the rpo like ('% U0F %') then 'U0F '.

    When the rpo like ('% U0H %') then 'U0H '.

    When the rpo like ('% U1C %') then 'U1C;

    When the rpo as ('UCH %") then"UCH -.

    When the rpo as ('UCM % %') then 'UCM -.

    When the rpo like ('% UF7% ') then 'UF7;

    When the rpo as ("UFF %") then "UFF;

    When the rpo like ('% UFU %') then 'UFU -.

    When the rpo like ('% UG4% ') then 'UG4;

    When the rpo like ('% UGU %') then 'UGU;

    When the rpo like ('% UGX %') then 'UGX;

    When the rpo like ('% YFU %') then 'YFU;

    When the rpo like ('% UH7% ') then 'UH7;

    When the rpo like ('% UHQ %') then 'UHQ -.

    When the rpo as ("UHU %") then 'UHU '.

    When the rpo like ('% UHV %') then 'UHV;

    When the rpo like ('% UHW %') then 'UHW -.

    When rpo love ('UI2% ") then"UI2. "

    When rpo like ('% UI4% ') then 'UI4;

    When the rpo like ('% UI6% ') then 'UI6 '.

    When the rpo as ("UI7%") then "UI7;

    When the rpo as ("UI8%") then "UI8;

    When the rpo like ('% UL5% ') then 'UL5;

    When the rpo like ('% UM7% ') then 'UM7;

    When the rpo as ("UMT %") then "UMT" -.

    When the rpo as ("UNM %") then "UNM;

    When the rpo like ('% UPX %") then"UPX"

    When the rpo like ('% US8% ') then 'US8 -.

    When the rpo like ('% Mikiduta %') then 'KARIM ' -.

    When the rpo like ('% UUJ %') then 'UUJ;

    When the rpo as ('UUN %") then"UUN -.

    When the rpo like ('% % PERFORMED') then 'PERFORMED '.

    When the rpo like ('% UYE %') then 'UYE.

    When the rpo as ("UYS %") then "UYS' end - RPO

    v1 -.

    where the rpo like ('%, ADG, %').

    or the rpo like ('%, IO3, %')-

    or the rpo like ('%, IO4, %')-

    or the rpo like ('%, IO5, %')-

    or the rpo like ('%, IO6, %')-

    or the rpo like ('%, ROE, %')-

    or rpo like ('% U0F %')-

    or rpo like ('% U0H %')-

    or the rpo like ('%, U1C, %')-

    or the rpo like ('%, UCH, %')-

    or the rpo like ('%, UCM, %')-

    or the rpo like ('%, UF7, %')-

    or the rpo like ('%, UFF, %')-

    or the rpo like ('%, UFU, %')-

    or the rpo like ('%, UG4, %')-

    or the rpo like ('%, UGU, %')-

    or the rpo like ('%, UGX, %')-

    or the rpo like ('%, YFU, %')-

    or rpo like ('% UH7, %')-

    or the rpo like ('%, UHQ, %')-

    or the rpo like ('%, UHU, %')-

    or the rpo like ('%, UHV, %')-

    or the rpo like ('%, UHW, %')-

    or the rpo like ('%, UI2, %')-

    or the rpo like ('%, UI4, %')-

    or the rpo like ('% UI6% ')-

    or the rpo like ('%, UI7, %')-

    or the rpo like ('%, UI8, %')-

    or the rpo like ('%, UL5, %')-

    or the rpo like ('%, UM7, %')-

    or the rpo like ('%, UMT, %')-

    or the rpo like ('%, UNM, %')-

    or the rpo like ('%, UPX, %')-

    or the rpo like ('%, US8, %')-

    or the rpo like ('%, KARIM, %')-

    or the rpo like ('%, UUJ, %')-

    or the rpo like ('%, UUN, %')-

    or rpo like ('% PERFORMED, %')-

    or the rpo like ('%, UYE, %')-

    or the rpo like ('%, UYS, %')-

    or the rpo like ('%, ROE, %'))

    /

    output

    If you google you will see many examples, here is one:

    Double on the database table. Laurent Schneider

  • How to get data in the procedure after CREATE TABLE table1 AS SELECT * from table2

    Hello

    can any body tell me how to get the data in the new table created in the procedure. because it gives following error.

    • Error (47,21): PL/SQL: ORA-00942: table or view does not exist

    tableName: = "BCKUP_" | TO_CHAR (sysdate, 'ddmmrrrr');

    tableDDL: = 'CREATE TABLE' | tableName. "AS SELECT * FROM Table1 where to_char(MSG_IN_TIME,''dd-mon-rrrr'') < sysdate - ' | daysNumber;

    EXECUTE IMMEDIATE backUpDDL;

    COMMIT;

    DELETE FROM Table1;

    How to select the data in the newly created table. as...

    Select * from ". tableName;

    Do not choose anything to get the number...

    Just after backupDDL EXECUTE IMMEDIATE, simply refers to SQL % ROWCOUNT - who will be the number of lines.

    Oh and DDL engages automatically, your commitment is redundant.

  • Create table for users

    Hi all

    11.2.0.3.10

    AIX6

    I created a user SCOTT in our database.

    I have grant connect, resource to scott; because it is easier to do it this way.

    DBA, I wish that I'm the only one to create all the tables of scott, and he cannot create for himself.

    What is the effective way to do this? Is this order enough? > REVOKE CREATE a TABLE FROM SCOTT;

    Thank you

    MK

    RP gave you the right answer if you want to restrict users to create table, do not give them privilege resource.  See this demo:

    Connected to:

    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

    With partitioning, OLAP, Data Mining and Real Application Testing options

    SQL > create user test identified by the test.

    Created by the user.

    SQL > grant connect to test;

    Grant succeeded.

    SQL > connect test/test;

    Connected.

    SQL > create table tab1 (a number);

    create table tab1 (a number)

    *

    ERROR on line 1:

    ORA-01031: insufficient privileges

    SQL > connect sys/pw as sysdba

    Connected.

    SQL > grant create table to test;

    Grant succeeded.

    SQL > connect test/test;

    Connected.

    SQL > create table tab1 (a number);

    Table created.

    SQL > connect sys/pw as sysdba

    Connected.

    SQL > revoke create table test;

    Revoke succeeded.

    SQL > connect test/test;

    Connected.

    SQL > create table tab2 (a number);

    create the table tab2 (a number)

    *

    ERROR on line 1:

    ORA-01031: insufficient privileges

    SQL >

    Concerning

    Girish Sharma

  • using datediff, creating table

    Hi all

    I'm trying to calculate the number of years of a product when a new record is inserted.

    That's what I tried

    CREATE TABLE WaterMeter)

    meterID VARCHAR (25) NOT NULL,

    readingID VARCHAR (25) NOT NULL,

    meterSerialNum VARCHAR (25) NOT NULL,

    installationDate DATE NOT NULL,

    noOfYears AS (DATEDIFF (YEAR, sysdate, installationDate));

    CONSTRAINT watermeter_Pkey PRIMARY KEY (meterID).

    Watermeter_Altkey of UNIQUE CONSTRAINT (meterSerialNum)

    );

    and the following error appeared.

    Error in the command line column: 6:27

    Error report:

    SQL error: ORA-00904: "YEAR": invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    so, how can I go around to solve this issue?

    Virtual column is... virtual. It is not stored in the table. Oracle calculates the value of virtual column every time that reference you it. This is why you cannot use functions such as SYSDATE in a virtual column expression. I understand the logic underlying your table, but this is done using views. Simply create the table without column of noOfYears, then

    create or replace view WaterMeter_VW as select t.*, MONTHS_BETWEEN (sysdate, installationDate) / 12 WaterMeter noOfYears t;

    SY.

Maybe you are looking for

  • AVG antivirus is no longer working with mozilla was last updated. That free antivius works with this now.

    At AVG free antivirus that could detect viruses, etc.. Has been sent just a update in the last day or two I have installed, but it says that AVG detects viruses, etc.. What best free antivirus works to detect everything that should be with this last

  • Satellite Pro C660 - 16 X - Internet Exlporer has stopped working

    Hello Can someone help me here please? I have a Toshiba laptop Satellite Pro C660 - 16 X, and about 5 days of internet explore has stopped working completely. I am connected to a wireless system that works well since I am on now computer it works fin

  • Connection to routers RVS4000

    I have 2 routers of RVS4000 that connects to its own cable modem.  I can independently had each network (router) on the other and successfully connect to the internet.  I need to have each router (networks) communicate with each other via ethernet on

  • is there a way I can put a password on specific folders?

    Like most I love watching naked people, but I don't like others to know what to do. So, is there a way I can put a password on my folder "naked people"?INB4 either _

  • Error when using native dynamic SQL

    Please can someone help me understand what's wrong with my code.Code:create or replace procedure p1 (name varchar2)asStartrun immediately "select * from ' |" name;end;/Goal: Just to test the native dynamic SQL code using a placeholder.COmpliation:SQL