Results 1 to 2 of 2
  1. #1
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default inserting multiple rows from one table into another

    I have a basic understanding of all the sql commands to accomplish this but whenever I try to do anything with the slightest bit of complication I run into issues.

    I have 2 tables, partdescriptions and myprojects
    Java Code:
    DESC defaultengineer.partdescription
    
    Name                    Null     Type           
    ----------------- -------- -----------------
    PID                    NOT NULL VARCHAR2(15 CHAR)
    CATEGORY          NOT NULL VARCHAR2(25 CHAR)
    WEIGHTTONS      NOT NULL NUMBER(4)        
    WEIGHTLBS         NOT NULL NUMBER(4)        
    WEIGHTOUNCES   NOT NULL NUMBER(4)        
    WEIGHTGRAMS     NOT NULL NUMBER(4)        
    CHECKEDOUT       CHAR(1)
    Java Code:
    DESC defaultengineer.myprojects
    
    Name           Null         Type              
    ------------ -------- ------------------
    PID             NOT NULL  VARCHAR2(15 CHAR) 
    ITEMDESC    NOT NULL  VARCHAR2(30 CHAR) 
    DUE_DATE    DATE                       
    RETURNTO    NOT NULL VARCHAR2(20 CHAR) 
    COMPLETED                 CHAR(1)                    
    PARTCAT                     VARCHAR2(25 CHAR)
    I want to run this query to choose which things to add to my projects
    Java Code:
    SELECT * FROM defaultengineer.partdescriptions
      WHERE weighttons < 50
        AND category IN ('Custom','T-Joint')
        AND checkedout = 'N'
    --this return 7 unique parts
    however when I try to run
    Java Code:
    SELECT pid,category
    INTO defaultengineer.myprojects
    FROM defaultengineer.partdescriptions
      WHERE weighttons < 50
        AND category IN ('Custom','T-Joint')
        AND checkedout = 'N'
    it gives me a missing keyword error. Is it possible to insert multiple rows from one table into another one under these constraints?
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  2. #2
    markw8500's Avatar
    markw8500 is offline Senior Member
    Join Date
    Jul 2008
    Location
    Pennsylvania, USA
    Posts
    136
    Rep Power
    0

    Default

    I am not sure about oracle, but I use postgres and select into is like create table... So if I try to use select into with a table that already exists, I get an error well... That the table already exists...

    So try to create a new table and see if it works...
    Who Cares... As Long As It Works...

Similar Threads

  1. Updating Displayed Table Rows
    By raycini in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 04-20-2009, 08:24 AM
  2. Inserting a Table in a TextFile?
    By Keerti in forum Advanced Java
    Replies: 5
    Last Post: 11-19-2008, 04:31 PM
  3. Color cells and rows in SWT table
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04:31 PM
  4. Inserting into a table (Example)
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 09:25 AM
  5. menu inserting table in the document
    By daredavil82 in forum New To Java
    Replies: 0
    Last Post: 12-05-2007, 05:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •