Oracle 11G copy a table to help to run immediately

I want to copy the contents of a table in another aid to run immediately.

It keeps fails with the following error

ORA-00903: invalid table name
ORA-06512: at "TABLE_COPY", line 6
ORA-06512: at line 8 level



create or replace
procedure TABLE_COPY)
Table1 varchar2,
Varchar2 TABLE2)
is
Start
run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
end;

Published by: user9213000 on January 24, 2013 07:38

user9213000 wrote:
I want to copy the contents of a table in another aid to run immediately.

It keeps fails with the following error

ORA-00903: invalid table name
ORA-06512: at "TABLE_COPY", line 6
ORA-06512: at line 8 level

create or replace
procedure TABLE_COPY)
Table1 varchar2,
Varchar2 TABLE2)
is
Start
run immediately 'insert'. TABLE2. "(select * from ' |) TABLE1 |') ' ;
end;

Published by: user9213000 on January 24, 2013 07:38

Standard when boards (ab) use of EXECUTE IMMEDIATE is to compose the SQL statement in a single VARCHAR2 variable
Then print the variable before passing to EXECUTE IMMEDIATE.
COPY the statement & PASTE in sqlplus to validate its correctness.

Tags: Database

Similar Questions

  • How to pass a sequence of 'help' to run immediately

    How can I place a sequence.nxlval as a parameter using, here is my code looks like

    sql_string is-> insert into some_tab (col1, col2,...) (select col1: passed_seq,...) where the... (I want to insert values in sequence for col2)


    and I call it like


    passed_seq: = "seq_". some_dynamic_num |'. nextval' (in my PB will be sequences with the string formed as seq_10.nextval)

    EXECUTE IMMEDIATE sql_string using passes_seq;

    If I do like this I get

    Error: - 1722:ORA - 01722: invalid number seq_10.nextval

    Published by: DIVI on 8 January 2013 07:40

    >
    So is there another way to solve my problem, where queries are already formed and stored in a table in the form of data in the column, and I need to run those from different sequences in different scenarios.
    >
    Yes - you change applications to use a placeholder for the sequence you need (e.g. [SEQ_GOES_HERE]) when you need to run it you create a PL/SQL block into a VARCHAR2 variable, then use run immediately on the variable.

    If your stored query would look like this

    sql_string is -> insert into some_tab (col1,col2, ....) (select col1,[SEQ_GOES_HERE],......) where .... 
    

    Load the good seq.nextval in a variable, and then replace "[SEQ_GOES_HERE]" in the query with this value.

  • ORA-02289 delete and create sequences to help to run immediately

    Hi all

    I copied a schema of one database to another.
    In the former base my package works very well and the procedure inside the PKG_REFRESH package below works like a charm.

    PROCEDURE FILL_TABLE(P_PROC_ID INTEGER) AS
    BEGIN
    EXECUTE IMMEDIATE (' drop sequence sq1' ");
    EXECUTE IMMEDIATE (' create the sequence sq1 with cache of 1 500 ft);
    v_kenmerk: = 'dim_1 ';
    INSERT INTO dim_1)
    Field1
    Field2
    ... < snip >
    END;

    Now that I have imported the package in a different database, and while footage used by inside the packaging procedures exist, it gives the errors below:

    Start
    *
    LAUGHING at regel 1:
    . ORA-02289: sequence does not exist
    ORA-06512: at "OWNER. PKG_REFRESH", line 117
    ORA-06512: at "OWNER. PKG_REFRESH', line 80
    ORA-01031: insufficient privileges
    ORA-06512: at "OWNER. PKG_REFRESH', line 20
    ORA-06512: at line 3 level

    I checked and the sequence is abandoned, but has not been recreated. However, it only gives me an error message when you try to create the sequence.
    I'm puzzled... search this forum, google and metalink did not help me either.

    Does anyone have an idea why this is happening? Strange is that it does not work on the old database.

    Robin

    Published by: RobbieNerve on June 30, 2011 10:27 I forgot to say that the procedure is inside the package

    Try to give an explicit subsidy to the user:

    GRANT CREATE SEQUENCE TO OWNER;
    

    Max

  • REF cursor in sql dynamic help to run immediately

    Hello

    How can we get the Ref cursor out a dynamic sql statement by executing immediate proceedings
    for example, immediately run ' open CROR for select * from dynamicTable'

    in this area, CROR is a dynamic cursor and table name is dynamic (known at run time), and we can't write static sql statement.

    Thank you

    I don't know what exactly you are after but here is a sample of what can be done.

    SQL> VAR r REFCURSOR;
    SQL> BEGIN
      2          OPEN :r FOR 'SELECT * FROM DUAL';
      3  END;
      4  /
    
    PL/SQL procedure successfully completed.
    
    SQL> PRINT r
    
    D
    -
    X
    

    You can use the OPEN... FOR education with a dynamic string.

  • Change the default value of some columns in an oracle 11g table

    I have a table called cust_file, its table consists of a large number of columns (one of these columns called cus_tax) and have a lot of data.

    I use oracle 11g, I want to change the default value of the column cus_tax is equal 1.

    I wrote

    ALTER TABLE cust_file MODIFY (1 by DEFAULT cus_tax).


    Table changed


    but after I inserted new data to test the operation, I found that the new record has a value = null for the column cus_tax


    then I tested it using the following query


    Select data_default in the all_tab_columns where table_name = 'CUST_FILE' and column_name = 'CUS_TAX ';

    no selected line


    so please help me to change the default value of the cus_tax column.



    Thanks for any help.



    > but after I inserted new data to test the operation, I found that the new record has a value = null for the column cus_tax

    If the INSERT included a NULL value for the column, the GET of a NULL inserted by default substitution.

    SQL > create table hkc_test_10 (id_column number, data_col_1 varchar2 (5), data_col_2 varchar (5));

    Table created.

    SQL > insert into hkc_test_10 values (1, 'First', 'F');

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F

    1 selected line.

    SQL > alter table hkc_test_10 change (data_col_2 default 'TRUE');

    Modified table.

    SQL > insert into hkc_test_10 values (2, 'Second', NULL);

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F
    2 second

    2 selected lines.

    SQL > insert into hkc_test_10 (id_column, data_col_1) values (3, 'Third');

    1 line of creation.

    SQL > select * from hkc_test_10 by 1.

    ID_COLUMN DATA_ DATA_
    ---------- ----- -----
    1 first F
    2 second
    3 third TRUE

    3 selected lines.

    SQL >

    Hemant K Collette

  • Copy a table with its index of Oracle 12 to another instance oracle 12

    Hello

    I m using 64 bit Win8

    I have a huge table T1 (about 200 million) on user storage space and its index is on different tablespaces on DB1

    I built an other empty DB2 with the same names of storage spaces. I d like copy the table T1 of DB1 with all its indexes in DB2 so that the table will in User tablespace and the index go to their corresponding storage spaces.

    Is it possible to do?

    Currently I T1 to export into a CSV file and re - import to DB2 and build all indexes manually.

    Concerning

    Hussien Sharaf

    1. What is the exact syntax to export and import a table with its index?

    You will need to use the "Table". An export of table mode is specified by the parameter TABLES. Mode table, only a specified set of tables, partitions, and their dependent objects are unloaded. See: https://docs.oracle.com/cloud/latest/db121/SUTIL/dp_export.htm#i1007514

    2 How can I import the indexes in one tablespace other than the table itself?

    You can only export the table first without the index by specifying the EXCLUSION clause in order to exclude from the index (see: https://docs.oracle.com/cloud/latest/db121/SUTIL/dp_export.htm#i1007829) and then manually create the index and specify the different tablespace when you create.

  • How to capture value of table column-level changes using oracle 11g steamed

    How to capture the value of the column of table changes using oracle 11g steamed. (similar to the audit).
    Oracle made the steam would be the best way to do the same.
    Please notify. Please give me a code example.

    user4485803 wrote:
    How to capture the value of the column of table changes using oracle 11g steamed. (similar to the audit).
    Oracle made the steam would be the best way to do the same.
    Please notify. Please give me a code example.

    Look at the change data Capture

  • Help me! Impossible to install oracle 11g on ubuntu

    Hello I am a student, I am a student of oracle database 11g, but I encountered a bug like
    http://Nguy-Hiem.co.cc/12.PNG

    I try to fix it and I start fixup.sh, but

    root@hieukenpro-virtual-machine:/tmp/CVU_11.2.0.1.0_oracle#./runfixup.sh
    Answer file used is:./fixup.response
    Activate used file is:./fixup.enable
    Location of the log file:./orarun.log
    *. ' / fixup.response: line 11: Unexpected EOF while looking for matching ' ' ' *.
    *. / fixup.response: line 12: syntax error: unexpected end of file *.
    *. / fixup.response: line 12: warning: syntax errors in. or eval will cause future versions of the shell to abandon as Posix requires *.
    Definition of parameters of the kernel... *.
    * uid = 1001 (Oracle) gid = 1001 (oinstall) groups = 1001 (oinstall), 1002 (dba) *.
    * oracle hard nproc 16383 *.
    * Couldn't find /etc/security/limits.conf or answer fichier.* MAX_PROCESSES_HARDLIMIT
    * oracle hard nofile 65535 *.
    * Couldn't find /etc/security/limits.conf or answer fichier.* FILE_OPEN_MAX_HARDLIMIT
    * oracle soft nofile 1023 *.
    * Couldn't find /etc/security/limits.conf or answer fichier.* FILE_OPEN_MAX_SOFTLIMIT

    so, what should I do?
    Thank you!

    Published by: 837251 at 16/02/2011 05:14

    Published by: 837251 at 05:17 16/02/2011

    Oracle 11g does not support Ubuntu. It can be installed, but it requires around Word:

    Re: Installing Oracle 11g R2 on Howto Ubuntu 10

  • How to create the new database in oracle 11g

    Hello
    I m new in oracle 11g, I downloaded oracle 11g and with the help of the guide of the developer-2 days, I learned all the SQL queries, but I worked with human resources database.
    Now, I want to create my own database with the required tables. Can anyone help me how I can make my own database in oracle 11g.

    Thank you
    Manna

    870692 wrote:
    Hello
    I m new in oracle 11g, I downloaded oracle 11g and with the help of the guide of the developer-2 days, I learned all the SQL queries, but I worked with human resources database.
    Now, I want to create my own database with the required tables. Can anyone help me how I can make my own database in oracle 11g.

    Thank you
    Manna

    Be sure to distinguish between the terms and the database schema. Other products, make them bad. It would be a HR diagram (or a user, which is the same in Oracle). If you do not need to use the database Wizard, unless you are working with a new host with no database.

    A simple way would be to get the DDL to create the HR schema and modify it for your own. It can be extracted from your database in several ways, or you can copy the hr_cre.sql to your own script and change. The two ways are educational, and you can google for instructions.

  • Is it possible to get the data in the dump views in oracle 11g file?

    Hi all

    I am using oracle 11G with developer PLSQL .is there a way to get the dump file views data. I saw there is an option in the tool to export the table data in the dumpster, but here, I'm not able to see the view names get extracted. If anyone can help me with that?

    Best regards

    GK

    View has no data. View is just a stored SELECT statement.

  • Import of XML in the oracle 11g database

    I have some difficulty parsing of an XML file in the oracle 11g database.

    Currently using Oracle 11 g Express Edition (XE)

    Here's how my XML file looks like this:


    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >
    -< AccountMap xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" >
    -< account >
    -< AccountMapping >
    < AccountID > 0000000000000 - 000 < / AccountID >
    < AccountName > XLS < / AccountName >
    Excel < AccountType > < / AccountType >
    < AccountOwner > system < / AccountOwner >
    < / AccountMapping >
    -< AccountMapping >
    < AccountID > 0000000000000 - 001 < / AccountID >
    < AccountName > XLSS < / AccountName >
    Excel2 < AccountType > < / AccountType >
    System2 < AccountOwner > < / AccountOwner >
    < / AccountMapping >
    -< AccountMapping >

    and so now the file continues... I have the xml file that is saved on my hard drive

    I created a package in SQL Developer

    create or replace
    PACKAGE XML_FILEHANDLER AS

    type TRecord is (record
    Account_ID varchar2 (100)
    , Varchar2 (100) AccountName
    , Varchar2 (30) AccountType
    , AccountOwner varchar2 (100)
    );

    type TRecordTable is table of the TRecord;

    getRows function (p_directory in varchar2, p_filename in varchar2) return TRecordTable pipeline;

    END XML_FILEHANDLER;

    -BODY

    create or replace
    PACKAGE BODY XML_FILEHANDLER AS

    getRows function (p_directory in varchar2, p_filename in varchar2) return TRecordTable AS pipeline

    nb_rec NUMBER: = 1;
    tmp_xml CLOB.
    tmp_file CLOB.
    REC TRecord;

    BEGIN

    DBMS_LOB.CREATETEMPORARY (tmp_file, true);
    tmp_file: = dbms_xslprocessor.read2clob (p_directory, p_filename);

    recomm. Account_ID: = regexp_replace (tmp_file, '. * <>(. *) Account_ID < / Account_ID >. *', '\1', 1, 1, 'n');
    recomm. AccountName: = regexp_replace (tmp_file, '. * < AccountName >(.*) < / AccountName >. *', '\1', 1, 1, 'n');
    recomm. AccountType: = regexp_replace (tmp_file, '. * < AccountType >(.*) < / AccountType >. *', '\1', 1, 1, 'n');
    recomm. AccountOwner: = regexp_replace (tmp_file, '. * < AccountOwner >(.*) < / AccountOwner >. *', '\1', 1, 1, 'n');

    loop

    -This regexp is instance (s) of this model: "<? XML...? ' > < root_tag >... < / root_tag >.
    tmp_xml: = regexp_substr ([tmp_file, ' < \?xml[^?] +------? > \s+ < ([^ >] +) >. *? < / \1 > ', 1, nb_rec, 'n');
    When the output length (tmp_xml) = 0;
    -dbms_output.put_line (tmp_rec);
    nb_rec: = nb_rec + 1;

    SELECT Account_ID AccountName, AccountType, AccountOwner
    in rec. Account_ID, rec. AccountName, AccountType rec. rec. AccountOwner
    from xmltable)
    "Accounts/AccountMapping" in the way of xmltype (tmp_xml) columns
    Path of varchar2 (100) Account_ID 'Account_ID '.
    , Path of varchar2 (100) AccountName "AccountName".
    , AccountType varchar2 (30) path 'AccountType '.
    , Path of varchar2 (100) AccountOwner "AccountOwner.
    );

    line (CRE);

    end loop;

    DBMS_LOB.freeTemporary (tmp_file);

    GetRows END;

    END XML_FILEHANDLER;

    -I call my function using the following sql query

    Select * from table (XML_FileHandler.getRows ("XML", "test.xml"));

    Here is the error I get

    ORA-29283: invalid file operation
    ORA-06512: at "SYS." UTL_FILE", line 536
    ORA-29283: invalid file operation
    ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 265
    ORA-06512: at "user. XML_FILEHANDLER', line 13
    29283 00000 - "invalid file operation.
    * Cause: An attempt was made to read from a file or a directory which is
    not exist, or the file or directory access was denied by the
    Operating system.
    * Action: Check access privileges to the file and directory on the file system
    and if reading, check that the file exists.

    I did the following

    -Provided appropriate access to the user (read, write), including directory access rights
    -ensure that the directory exists
    -to ensure the existence of the file

    I have searched all over google and metalink but am unable to get this to run... Help, please!

    >
    SELECT Account_ID AccountName, AccountType, AccountOwner
    in rec. Account_ID, rec. AccountName, AccountType rec. rec. AccountOwner
    from xmltable)
    "Accounts/AccountMapping" in the way of xmltype (tmp_xml) columns
    Path of varchar2 (100) Account_ID 'Account_ID '.
    , Path of varchar2 (100) AccountName "AccountName".
    , AccountType varchar2 (30) path 'AccountType '.
    , Path of varchar2 (100) AccountOwner "AccountOwner.
    );
    >
    implement

    SELECT Account_ID, AccountName, AccountType, AccountOwner
    into rec.Account_ID, rec.AccountName, rec.AccountType, rec.AccountOwner
    from xmltable(
    'AccountMap/Accounts/AccountMapping' passing xmltype(tmp_xml) columns
    Account_ID varchar2(100) path 'Account_ID'
    , AccountName varchar2(100) path 'AccountName'
    , AccountType varchar2(30) path 'AccountType'
    , AccountOwner varchar2(100) path 'AccountOwner'
    );
    
    SQL> SELECT Account_ID, AccountName, AccountType, AccountOwner
      2  --into rec.Account_ID, rec.AccountName, rec.AccountType, rec.AccountOwner
      3  from xmltable(
      4  'AccountMap/Accounts/AccountMapping' passing
      5  xmltype('
      6  
      7  
      8  
      9  0000000000000-000
     10  XLS
     11  Excel
     12  System
     13  
     14  
     15  0000000000000-001
     16  XLSS
     17  Excel2
     18  System2
     19  
     20  
     21  ')
     22  columns
     23  Account_ID varchar2(100) path 'Account_ID'
     24  , AccountName varchar2(100) path 'AccountName'
     25  , AccountType varchar2(30) path 'AccountType'
     26  , AccountOwner varchar2(100) path 'AccountOwner'
     27  );
    
    ACCOUNT_ID                                                                       ACCOUNTNAME                                                                      ACCOUNTTYPE                    ACCOUNTOWNER
    -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ --------------------------------------------------------------------------------
                                                                                     XLS                                                                              Excel                          System
                                                                                     XLSS                                                                             Excel2                         System2
    
    SQL> 
    

    AccountID use AccountID not Account_ID

    Account_ID varchar2(100) path 'AccountID'
    

    Published by: Alexandr on August 9, 2012 12:35 AM

  • use of temporary space in oracle 11g rac

    Hello

    Oracle version: oracle 11g r2

    OS: linux

    storage: asm on exadata

    Please help us understand the use of the temp

    {code}

    SQL > set linesize 1000
    SQL > set pagesize 1000
    SQL > col USERNAME format a20
    SQL > col SPID format a10
    SQL > col MODULE format a30
    SQL > col PROGRAM format a30
    SQL > SELECT s.sid, s.serial #, s.username
    2, p.spid, s.module, p.program
    3, SUM (su.blocks) * tbsp.block_size/1024/1024 mb_used
    4, su.tablespace
    5. FROM v$ sort_usage su
    6, v$ session s
    dba_tablespaces tbsp
    7, $v 8 p process
    9 WHERE su.session_addr = s.saddr
    10 AND su.tablespace = tbsp.tablespace_name
    11 AND s.paddr = p.addr
    GROUP 12 OF
    13 s.sid, s.serial #, s.username, s.osuser, p.spid, s.module,.
    14 p.program, tbsp.block_size, su.tablespace
    15 ORDER BY s.sid;

    USERNAME SID SERIAL # SPID MODULE PROGRAM MB_USED TABLESPACE
    ---------- ---------- -------------------- ---------- ------------------------------ ------------------------------ ---------- -------------------------------
    11 2092 DBSNMP 2861 emagent_SQL_oracle_database Oracle @ [email protected] 8 TMP4

    SQL > select * from v$ temp_space_header;

    FILE_ID BYTES_USED, BYTES_FREE BLOCKS_FREE RELATIVE_FNO BLOCKS_USED NOM_TABLESPACE
    ------------------------------ ---------- ---------- ----------- ---------- ----------- ------------
    TMP1 2 + 12 222274816 33554432 2048 1024 3.6418E
    TMP3 4 + 11 19283968 75497472 4608 1024 3.1595E
    TMP4 5 + 11 19687936 0 0 1024 3.2257E
    TMP5 6 + 13 688638464 0 0 1024 1.1283E

    {code}

    Why isn't bytes_used reclaim as only 8 MB is currently using

    Thank you

    PMP

    I wanted to tell temp is never off allocated. So, if a 'bad' query explodes temp. the only thing you can do is to create a new and drop the old one.

    11 GB temp is clearly ridiculous. Usually, this is caused by the merge join Cartesian paths in your instructions.

    -----------

    Sybrand Bakker

    Senior Oracle DBA

  • How interrogate a user affected temp and tableapce default tablespace in oracle 11g?

    I have this SUNNY user on my DB. Now, I want to know how to query an affected user temp and tableapce default tablespace in oracle 11g?

    I tried Google, but no luck. can anyone help?

    Select the name of user, USER_USERS, temporary_tablespace from dba_users where username = "SUNNY";

    or

    Select the name of user, USER_USERS, temporary_tablespace from user_users where username = "SUNNY";

  • Parametric roles in Oracle 11g BPM

    Hi all!

    To us all who asked how the parametric roles in Oracle 11g BPM, here´s how do, hope this helps.

    Kind regards!

    Z3uV4k

    https://docs.Google.com/file/d/0B7YrnfO7h717M2U1MTlmMmEtZjI3Mi00ZTNhLWFhNTQtYzkyZjc5OGI5Y2I4/edit?PLI=1

    Can also focus on a blog post that I wrote based on an idea with arun Pareek came.  (click here)

    The differences are (1) that allows you to assign parametric groups roles or application rather than individual users roles, which makes them easier to maintain and IMO (2) it is much easier to do it using this technique.

    Dan

  • Installing oracle 11g (RAC) on RHEL 6

    Dear all,


    Me and my team will install oracle 11g (RAC) on RHEL 6.
    About mention above I have little doubt it please help me out in this matter.

    In the network section.

    Requirement of intellectual property:

    1 public IP address
    2 private IP
    3. virtual IP address

    Suppose we have two interfaces in each server, eth0 and eth1.

    I put the public IP address in eth0 192.9.25.100 and private 10.79.1.100 eth1 IP address
    Now where put the virtual IP address and what is the procedure.

    Please help me to set the virtual IP address


    Thanks and greetings
    Yvon Das
    S/n, Guwahati

    Published by: Yvon on 23 May 2013 23:44

    Hello

    See the message below:

    http://www.Oracle-base.com/articles/11g/Oracle-DB-11gr2-RAC-installation-on-Oracle-Linux-6-using-VirtualBox.php

    If you need clarification update here.

    Thank you
    A H E E R X

Maybe you are looking for

  • connection Wi - Fi 10 hidden iOS problem

    Hello In our company, we manage different iPhone models (5-7) and iPad (iPad mini via iPad Pro). After that iOS 10 upgraded, particularly iPhone 5 s devices have begun to forget the hidden SSID networks. Devices not reconnect to the hidden network un

  • HP ENVY 4500 series [D37511]

    I'm on a MAC on HP ENVY 4500 series [D37511] print. How to print grayscale? Adjustment instructions of the printer in the user's manual do not operate on MAC, nor do they work in the control panel of the printer, there is no Advanced menu the printer

  • Windows 7 hard drive failure

    Sign of pop up: the following hard disks are fault name ST3500413AS Volume C:\;D\ disk status I have no idea what that means or what I need to do.  I did a virus scan and a recovery.  The recovery was supposed to be unsuccessful; However, the sign ce

  • which library is pushed to the foreground memory?

    Hello I ask this has in mind a risk of sounding noobish My library has a lot of resources in it (say 2 MB total) My application (which uses the library), an instance of a class inside the library. (1) what are the 2 MB allocated in memory? (2) how to

  • BlackBerry® Smartphones default e-mail doesn't work does not correctly - I think

    Hello I want everyone who receives an email from me since my Blackberry to see just my company email acocunt. So I created this address as the default Service (EMMIC). Three elements/questions: New email: if I create a new email option works very wel