Select * into Table1 from Table not working

Hi,
How to copy data from one table to other new table using select * into statement.
I am getting missing keyword error when I use the statement
select * into Table1 from Table
Thanks a lot in advance.
Regards,
Praveen

the syntax is
INSERT INTO table1 SELECT * FROM table2;

Similar Messages

  • Help: Error on SELECT INTO TABLE2 FROM TABLE AS E1 JOIN...

    Can anyone help? I am getting an error in my sql statement below:
    SELECT E1.COL1, E1.COL2, E2.COL3, E1.COL4
    INTO TABLE2
    FROM TABLE AS E1
    JOIN TABLE AS E2 ON
    (E1.COL1 = '10000' AND E2.COL1 = '20000') OR
    (E1.COL1 = '20000' AND E2.COL1 = '10000')
    WHERE
    E1.COL3 = E2.COL3 AND E1.COL4 = '11000' AND E1.COL3 < '2011/04/01'
    The script works fine on SQL Server (2008) but I am unable to run it in Oracle.
    I am using Oracle SQL Developer v1.5.4 Build MAIN-5940.
    Thanks in advance for anyone who can help.

    Tubby wrote:
    850777 wrote:
    Thanks for the immediate reply Tubby. I will try removing the AS for aliasing.
    I still have one more problem though (about removing the line INTO TABLE2) because
    I am actually using it to store the SELECTed data into the new TABLE2. Is there a workaround for this? ThanksWhat are you trying to do here? View the data produced by the query, or create a pl/sql routine?
    What's the point behind creating a table to store the results in?
    Tubby wrote:850777 wrote:
    Thanks for the immediate reply Tubby. I will try removing the AS for aliasing.
    I still have one more problem though (about removing the line INTO TABLE2) because
    I am actually using it to store the SELECTed data into the new TABLE2. Is there a workaround for this? ThanksWhat are you trying to do here? View the data produced by the query, or create a pl/sql routine?
    What's the point behind creating a table to store the results in?What I am trying to do is copy the data in TABLE to TABLE2 but with the data in E1.COL3 swapped with the one in E2.COL3 based on certain conditions.
    Basically I am just trying to swap the values of a column (COL3) and store it in my new table (TABLE2) together with all the (unswapped) values from all the other columns.
    Ex.
    TABLE
    COL1 COL2 COL3 COL4
    1 1 1 1
    2 2 3 2
    3 3 2 2
    4 4 4 1
    Target result:
    TABLE2
    COL1 COL2 COL3 COL4
    1 1 1 1
    2 2 2 2 <-swapped values
    3 3 3 2 <-in COL3
    4 4 4 1

  • Select * from table not working with Oracle OBDC driver

    Hello,
    In our web development we have been using the MS ODBC for Oracle
    driver to connect to our Oracle db. We decided to try the
    Oracle ODBC driver because it supports the commandTimeout
    property in ASP which the MS driver does not. The problem I'm
    running into now is that all of our select * from table
    statements appear not to be working. The Oracle ODBC driver
    version we are using is ver 8.00.05.00. Is there something that
    I'm not doing properly? If I take the same select * from table
    statement and name the columns, I dont get any error. Otherwise
    I'm getting a Subscript out of range error. It seems strange to
    me that this driver would not support a select * from table
    statement (which I''m told is the case by another developer
    here).
    Is there something I'm missing?
    Thanks,
    Pete

    I'm positive I have a connection. Otherwise I wouldn't get a
    response when I name the columns instead of using *.
    There must be something else that I'm missing or doing wrong.
    I've actually been looking into alternative ODBC drivers to see
    if I have the same problems but none that I have found support
    commandTimeout.
    Any other ideas?

  • Transaction SE16: Field selection (User-Specific Settings) is NOT working for ALL tables

    Hi Guru’s,
    I have an issue in Transaction SE16, Field selection (User-Specific Settings) is NOT working in Tables (ALL tables).
    Following is the screenshot attached for your kind reference,
    That is in the initial screen of transaction SE16 if I choose Filed Name or Filed Label only the technical details (Field Names) are appearing and not the descriptions like Client, Purchasing Doc, and Company Code Doc. Category Document Type etc…
    Right now I am using ECC6 and EHP7 SAP system.
    Please help me to resolve this issue by implementing any OSS note or User Role creations or any technical changes required in system.
    Hope the requirement is clear and in case need any clarification please revert back.
    NOTE: Right now in Development System we don’t have any successful user to compare the settings.
    Regards,
    Kumar.S

    Thanks Patra.
    Even I searched in SAP portal and couldn't able to find the relevant OSS note.
    Following is my BASIS team response,
    "Only you can view Table Field values from higher release"
    Can you suggest / guide on this comment as well.
    Looking forward to your speedy response.
    Regards,
    Kumar.S

  • Importing element definition from an  EDD into a template - does not work

    FM 10.0.1 German on Windows XP SP3.
    When importing the element definitions from an existing EDD into an existing template, FrameMaker converts the template into a  new EDD.
    So the element definitions which are correctly defined do not appear in the template.
    The highest level element is than ElementCatalog in the template and not the higherst lvel element defined in the EDD.
    In FM9 this was no issue.
    Any help is appreciated, I have a deadline and must do some changes in the EDD.
    Best Regards
    Thomas

    Lynne,
    EDD is english (Version FM7.0), Interface language is German.
    Maybe it´s a localization issue.
    I have attached a captivate demo pdf so you can see what happens and the
    defective EDD.
    Mit freundlichen Grüßen
    Best Regards
    Thomas Zeisig
    From:   Lynne Price <[email protected]>
    To:     "Th. Zeisig" <[email protected]>
    Date:   13.10.2011 14:12
    Subject:        Importing element definition from
    an  EDD into a template - does not work
    Re: Importing element definition from an EDD into a template - does not
    work
    created by Lynne Price in FrameMaker Structured - View the full discussion
    Thomas,
      No question the behavior you describe is a bug. However, I am unable to
    duplicate it. I created an EDD with two element definitions:
    Element (Container): doc
      Valid as the highest-level element.
      General rule:  (
      When I imported element definitions from this EDD into a new portrait
    document, FM reports that element a is referenced but not defined and that
    b is defined but not referenced. However, with all elements listed, the
    element catalog shows a, b, and doc. The metatemplate elements are not
    available.
      I wonder if this is a language-dependent problem. Is your EDD German or
    English? What about your user interface?
      Can you send me a short EDD that fails as you've described?
      Thanks,
          --Lynne
    Replies to this message go to everyone subscribed to this thread, not
    directly to the person who posted the message. To post a reply, either
    reply to this email or visit the message page: [
    http://forums.adobe.com/message/3969067#3969067]
    To unsubscribe from this thread, please visit the message page at [
    http://forums.adobe.com/message/3969067#3969067]. In the Actions box on
    the right, click the Stop Email Notifications link.
    Start a new discussion in FrameMaker Structured by email or at Adobe
    Forums
    For more information about maintaining your forum email notifications
    please go to http://forums.adobe.com/message/2936746#2936746.

  • Updating database table - not working

    Hi ,
              My database table 1 is having multiple data for a primary key
    example :
    table 1:
    GLOBMATNR  -> Primary key
    WERKS  --> non primary key -- multiple for globmatnr
    MBLNR --> non primary key -- multiple for globmatnr
    MBLPO--> non primary key --
    BUKRS --> non primary key -- multiple for globmatnr
    i m using below statement to make entry into the table.. but this insert is not working.. I stead of putting 30 entries its just inserting 1 entry..
    Can any one help me in this..?
    INSERT table1 FROM TABLE internal_table ACCEPTING DUPLICATE KEYS.
    Edited by: neha gupta on Oct 29, 2010 1:25 PM

    Hi,
    Hit F1 on ACCEPTING DUPLICATE KEYS. You will identify why it is inserting 1 line only. I hope the table is a custom table. For fields which can have multiple values, make it primary key.
    In your example table, GLOBMATNR, WERKS, MBLNR could be primary keys if WERKS is in one company code only. If not add BUKRS also
    Hope it helps
    Sujay

  • Can I select element number from table collection expression?

    Hi, I know I can use COLUMN_VALUE to select column values from table collection expression. Is there any way to select the number of the element as well? (with Oracle 11.2.0.1.0)
    CREATE OR REPLACE TYPE plch_numbers_nt IS TABLE OF NUMBER;
    DECLARE
       l_numbers   plch_numbers_nt
                      := plch_numbers_nt (10,
                                          20,
                                          30,
                                          40,
                                          50);
    BEGIN
       -- This would be nice...
       FOR rec IN (SELECT COLUMN_VALUE, VALUE_INDEX FROM TABLE (l_numbers))
       LOOP
          DBMS_OUTPUT.put_line (rec.COLUMN_VALUE, rec.VALUE_INDEX);
       END LOOP;
    END;
    /

    First of all, I would like to thank you all for your replies. I really appreciate your help.
    The problem I'm trying to solve is more complicated than what I have shown so far. Right now I'm trying to decompose the problem into smaller problems. Maybe I should show you the full problem and hope that I still get a reply.
    I have a spatial column with collections of geometries (SDO_GTYPE 2004) and I have a VARRAY column of objects. For each row, each geometry in the geometry collection has some information in one element in the VARRAY. So I have this table
    -- +----+------------------+-----------------------------------------------------------------------------------+
    -- | ID | GEOM_COLL        | GEO_INFO                                                                          |
    -- +----+------------------+-----------------------------------------------------------------------------------+
    -- | 98 | sdo_geom(2004)_1 | ((geo_info_1_1_1; geo_info_2_1_1; ...);(geo_info_1_1_2; geo_info_2_1_2; ...) ...) |
    -- +----+------------------+-----------------------------------------------------------------------------------+
    -- | 99 | sdo_geom(2004)_2 | ((geo_info_1_2_1; geo_info_2_2_1; ...);(geo_info_1_2_2; geo_info_2_2_2; ...) ...) |
    -- +----+------------------+-----------------------------------------------------------------------------------+
    --  ...and I need this
    -- +----+--------------------+----------------+----------------+-----+
    -- | ID | SDO_GEOM           | GEO_INFO_1     | GEO_INFO_2     | ... |
    -- +----+--------------------+----------------+----------------+-----+
    -- | 98 | sdo_geom(2001)_1_1 | geo_info_1_1_1 | geo_info_2_1_1 | ... |
    -- +----+--------------------+----------------+----------------+-----+
    -- | 98 | sdo_geom(2002)_1_2 | geo_info_1_1_2 | geo_info_2_1_2 | ... |
    -- +----+--------------------+----------------+----------------+-----+
    -- +----+--------------------+----------------+----------------+-----+
    -- | 99 | sdo_geom(2002)_2_1 | geo_info_1_2_1 | geo_info_2_2_1 | ... |
    -- +----+--------------------+----------------+----------------+-----+
    -- | 99 | sdo_geom(2001)_2_2 | geo_info_1_2_2 | geo_info_2_2_2 | ... |
    -- +----+--------------------+----------------+----------------+-----+
    -- ...I need a flat version of the original table, if you will. My original plan was to convert the VARRAY values to rows and extract the geometries into rows. Then join both using their ROWNUMs. But this does not work as i need numbers that start at 1 for each ID and I'm not sure if ROWNUM will give me the right order. Hence my question for consecutive element numbers. I have no idea how to do it with SQL. I'm working on a PL/SQL solution right now. Sample code follows. Sorry for the length of this post.
    CREATE OR REPLACE TYPE geo_info AS OBJECT (
      just INTEGER,
      txt  VARCHAR2 (255)
    CREATE OR REPLACE TYPE geo_info_array AS VARRAY (10000) OF geo_info;
    CREATE TABLE geometries (
      id NUMBER (38) PRIMARY KEY,
      geom_coll SDO_GEOMETRY,
      geo_info geo_info_array
    INSERT INTO geometries (id, geom_coll, geo_info) VALUES (
      98,
      sdo_geometry (2004, NULL, sdo_point_type (0, 0, 0),
                    sdo_elem_info_array (1, 1, 1, 3, 2, 1, 7, 1, 1, 9, 1, 1),
                    sdo_ordinate_array (5408562.081181, 5696027.239777, 5408563.398, 5696028.369, 5408568.192, 5696028.132, 5408562.643029, 5696038.558968, 5408565.328059, 5696027.0783)),
      geo_info_array (geo_info (7, '10.9'),
                      NULL,
                      geo_info (7, '0.0'),
                      geo_info (7, '-4.8-'))
    INSERT INTO geometries (id, geom_coll, geo_info) VALUES (
      99,
      sdo_geometry (2004, NULL, sdo_point_type (0, 0, 0),
                    sdo_elem_info_array (1, 2, 1, 5, 1, 1, 7, 2, 1, 11, 1, 1, 13, 1, 1),
                    sdo_ordinate_array (5408575.262, 5696017.841, 5408575.255, 5696017.341, 5408573.318578, 5696016.67559, 5408575.255, 5696017.341, 5408574.155, 5696017.357, 5408573.359578, 5696017.97359, 5408572.012251, 5696017.299678)),
      geo_info_array (NULL,
                      geo_info (7, '0.5'),
                      NULL,
                      geo_info (7, '0.0'),
                      geo_info (7, '-1.1-'))
    /

  • Can you SELECT INTO a temporary table?

    I was wondering if you can do this and what the syntax would be. I tried to SELECT INTO GLOBAL TEMPORARY TABLE and it didn't work.

    If you are looking to Create a GTT, load data into it and then be able to select from the GTT after createion, you'll need to remember to preserve the rows after a commit e.g.:
    create global temporary table gtemp on commit preserve rows as select * from tab;
    However, your question is a bit on the vague side as to EXACTLY what you are wanting to do.
    As an addendum
    It didn't work is a completely useless statement without telling us how you know it didn't work
    Message was edited by:
    JS1

  • Why while in Bridge Load Files into photoshop Layers does not work?

    In Bridge, Tools>Photoshop>Load Files into Photoshop Layers does not work.  I have two images selected and when I execute that comman in Bridge nothing happens.  I exited and restarted both PS and Bridge and still nothing.  I am working in Windows 7 and Photoshop cs6.

    No I tried File/scripts/load file into stack and still did not work.
    There was an update to bridge and now it works.  Thanks so much.

  • Convert select traditional or simplified chinese not working

    After upgraded mountian lion,
    convert select traditional or simplified chinese not working,
    it works fine in lion.
    Please help!
    Thanks

    Please use the search function about this. This has been discussed many times.

  • Select in FROM clause not working

    Hello,
    I have three tables with one table containing the name of the other two tables and i want to select dynamically the two selects based on their ID that matches in the first table.
    CREATE TABLE_NAMES (ID NUMBER, TableName VARCHAR(2) )
    CREATE TRADE (activites VARCHAR(2), TRADE_ID )
    CREATE CONTRACT(activites VARCHAR(2), TRADE_ID )
    INSERT INTO TABLE_NAMES ( 101, 'TRADE' );
    INSERT INTO TABLE_NAMES ( 202, 'CONTRACT' );
    INSERT INTO TRADE ('TRADE 1' , 101 )
    INSERT INTO CONTRACT ('CONTRACT 1' , 202 )
    What I wanted to do is select the table name dynamically based up on the id in TABLE_NAMES
    and I failed when doing this
    SELECT SELECTED_TABLE.activites FROM ( SELECT TABLE_NAME FROM TABLE_NAMES WHERE ID = 101 ) SELECTED_TABLE
    OR a more generic form with JOIN statement also did not work
    SELECT SELECTED_TABLE.activities FROM TABLE_NAMES SELECTION JOIN ( SELECT TABLE_NAME FROM TABLE_NAMES) SELECTED_TABLE
    ON SELECTION.ID = SELECTED_TABLE.TRADE_ID
    Thanks in advance

    What you are trying to do will not work. To accomplish your requirement you would have to use dynamic SQL.
    However, I want to stress that this is probably not a good design decision because:
    1. Maintainability of the code may be jeopardized
    2. Dynamic SQL could be laden with SQL injection vulnerabilities
    3. Dynamic SQL generally does not perform as well as static SQL.
    HTH!

  • I am attempting to upload multiple photos on a macpro from a cd.  I am used to a pc.  I tried using the command button to select multiples but it does not work.  Please advise

    I am attempting to upload multiple photos on a mac pro from a cd.  I have tried holding the "command"button down to select multiple photos but it does not work.  Please advise.  Thanks,John

    why not sort by (name, date, etc) and Click on 1st and Shift-Click on last.
    Might work better to copy or import to a project folder.
    https://discussions.apple.com/community/ilife/iphoto
    http://www.apple.com/support/iphoto

  • Select data from table not in another table

    Hi,
    I want to select data from table A which is not in table B.
    Currently I am doing:
    select
    snoA,
    nameA,
    dobA
    from A
    where snoA not in
    (select snoB from A, B
    where snoA = snoB
    and nameA = nameB)
    But above is very slow.
    Can I do something like:
    select
    snoA,
    nameA,
    dobA
    from A, B
    where
    EXCLUDE ( snoA = snoB and nameA = nameB)
    Please note that I need the where condition on both the columns.
    any help will be appreciated.
    -- Harvey

    What are the approximate data volumes in A and B?
    What is "very slow"?
    What version of Oracle?
    What is the query plan?
    Without knowing anything about your system, my first thought would be to see if a NOT EXISTS happened to be faster for your data
    SELECT snoA,
           nameA,
           dobA
      FROM a
    WHERE NOT EXISTS (
        SELECT 1
          FROM b
         WHERE a.snoA = b.snoB
           AND a.nameA = b.nameB )Of course, I'm not sure why you are joining A & B in your NOT IN subquery. It would seem like you would just need a correlated subquery, i.e.
    SELECT snoA,
           nameA,
           dobA
      FROM a
    WHERE snoA NOT IN (
        SELECT snoB
          FROM b
         WHERE a.snoA = b.snoB
           AND a.nameA = b.nameB )That should be more efficient than the original query. The NOT EXISTS version may or may not be more efficient than the NOT IN depending on data volumes.
    Justin

  • Submit report using selection table not working in OO CL_SALV classes

    I have used CL_SALV classes in my report. now the problem is submit report is not working. any suggestions.
    It works in REUSE_ALV  FM

    Still i m facing the same problem

  • Query remote table not working in PL/SQL

    I have a problem that is killing me to figure out. Basically we trying to query a remote table through PL/SQL and it comes back with invalid column name for the table. But the table exists in the remote database and has the column. The query works fine from the same database outside of PL/SQL, just not in PL/SQL. I'll setup a test case below.
    We have local database called DB1 and remote database called DB2. The table we are querying is called EMP.
    First we create database link:
    create database link DB2.WORLD connect to...
    Test the link:
    select ENAME from [email protected];
    ENAME
    SHAWN
    Works fine.
    Now we put this query inside a PL/SQL block:
    declare
    l_ename varchar2(20);
    begin
    select ename into l_ename from [email protected];
    end;
    This fails with the following error:
    select ename
    ERROR at line 274:
    ORA-06550: line 274, column 7:
    PL/SQL: ORA-00904: invalid column name
    ORA-06550: line 271, column 3:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 279, column 9:
    PL/SQL: ORA-00904: invalid column name
    ORA-06550: line 277, column 3:
    PL/SQL: SQL Statement ignored
    Now, I've tried changing how we select from the remote table, I've put the select statement in a cursor, tried creating a synonym which points to the remote table and selecting using the synonym in PL/SQL, it always returns the same error. But always works outside of PL/SQL.
    Now the user we are connecting to the remote database as, has select on the EMP table, through a role, along with 30 other tables, all the other tables are able to be selected through the database link, in PL/SQL, it's just this one table.
    Additionally I can go to another database, and create the same database link, and the query in PL/SQL works fine to the remote table. It's just this one table, from this one database, that doesn't work just in PL/SQL. Any ideas would be appreciated, I've exhausted everything.
    Also, creating a copy of the table using "create table as select * from..." we can select from the copy of the table using PL/SQL through the database link. The problem is this is a central warehouse table, and is used my multiple applications and updated constantly, so dropping a recreating this table is a last resort.
    Yes, this process did work, for over a year, then suddenly it stopped. Of course, no one made any changes to either database, that's always the case. I know the code didn't change though, it was still timestamped from a year ago.
    Thanks in advance.

    Could this be a variant on an old favourite, viz privileges being granted through roles. We cannot use objects in PL/SQL if our privileges are assigned through a role.
    Maybe what has changed is that instead of being granted privileges on EMP@DB2 directly the privileges have been re-organised so that your user has them granted through a role.
    Cheers, APC

Maybe you are looking for