Can not insert

Hi, all
I tried to transfer data from one table SAMPLE2951 to another table SAMPLE. SAMPLE2951 had 2951 records while SMAPLE was an empty one. I need the SAMPLE's PK be an automatic number.
My script was like:
CREATE TABLE "FLOWLIMS"."SAMPLE" (
"SAMPLEID" INTEGER NOT NULL,
"ID" INTEGER NOT NULL,
"CLASSIFICATION" VARCHAR2(50),
"DATEPROCESSED" DATE,
"DATEFAILURE" DATE,
"DATEFROZEN" DATE,
"DAYSOFTRAN" INTEGER,
"TUBEID" VARCHAR2(100),
"STUDYYEAR" INTEGER,
"VISITTIME" INTEGER,
"FORWHOM" VARCHAR2(100),
"CELLSPERML" VARCHAR2(100),
"VIALSFROZEN" INTEGER,
"NOTES" VARCHAR2(1000),
"TUBENUMBER" INTEGER,
"SAMPLETYPE" VARCHAR2(50),
PRIMARY KEY("SAMPLEID") VALIDATE,
FOREIGN KEY("ID") REFERENCES "FLOWLIMS"."LABDRAWN" ("ID") VALIDATE
CREATE SEQUENCE SAMPLE_SAMPLEID_SEQ;
CREATE OR REPLACE TRIGGER SAMPLE_TRG
BEFORE INSERT ON SAMPLE
FOR EACH ROW
BEGIN
SELECT SAMPLE_SAMPLEID_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
This part ran very well.
And then I tried to transfer data:
INSERT INTO SAMPLE (ID, CLASSIFICATION, DATEPROCESSED, DATEFROZEN, TUBEID, STUDYYEAR, VISITTIME, FORWHOM, NOTES) SELECT "ID", "CLASSIFICATION", "DATEPROCESSED", "DATEFROZEN", "TUBEID", "STUDYYEAR", "VISITTIME", "FORWHOM", "NOTES" FROM SAMPLE2951;
I used to transfer data like this, but this time the system reported an error:
ERROR at line 1:
ORA-01400: cannot insert NULL into ("FLOWLIMS"."SAMPLE"."SAMPLEID")
My SAMPLEID is supposed to generate automatically.
Is anything wrong?
Any advice is highly appreciated!
Qian

Perhaps you intended your trigger to select into :new.SampleID rather than :new.ID, which you're passing in as part of your INSERT statement...
Justin

Similar Messages

  • Can not insert/update data from table which is created from view

    Hi all
    I'm using Oracle database 11g
    I've created table from view as the following command:
    Create table table_new as select * from View_Old
    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
    Anybody tell me, what's happend? cause?
    Thankyou
    thiensu
    Edited by: user8248216 on May 5, 2011 8:54 PM
    Edited by: user8248216 on May 5, 2011 8:55 PM

    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK?

  • Can not insert null into foreign key issue

    Hi ,
    I am having parent-child relationship table.
    In the child table when I am adding a new record , data is getting inserted with foreign key.
    After insert if I immediately update the same record. Its giving error that can not insert null into foreign key.
    If i click on rollback button I am able to update that record properly.

    Hi ,
    I am having parent-child relationship table.
    In the child table when I am adding a new record , data is getting inserted with foreign key.
    After insert if I immediately update the same record. Its giving error that can not insert null into foreign key.
    If i click on rollback button I am able to update that record properly.

  • Help!!urgent!!can not insert/update clob:the row containing the lob is not locked

    Hi,
    could you do me help?
    i can not insert a string into a oracle clob field, it echo as:
    ORA22920 row containing the lob value is not locked. ORA 06512 at "SYS.DBMS_LOB" line 708
    ORA 06512 at line 1;
    what its means? please.
    my table defined as : create table clob1(id number(5),mclob clob default empty_clob()); the id is create by a sequece of test_sequence automaticly.
    my code as belows:
    import java.io.*;
    import java.sql.*;
    //import oracle.sql.*;
    public class test4 {
    public static void main(String args[]) {
    String url_String
    = "jdbc:oracle:thin:test/test@myhost:1521:myorcl";
    try {
    Class.forName
    ("oracle.jdbc.driver.OracleDriver");
    java.sql.Connection con =
    java.sql.DriverManager.getConnection(url_String);
    con.setAutoCommit(true);
    Statement stmt
    =con.createStatement();
    String sqlStr ="insert into
    clob1 (mclob) " + "values(empty_clob())";
    stmt.executeUpdate(sqlStr);
    String query = "select
    test_seq.CURRVAL from dual";
    ResultSet rs =stmt.executeQuery
    (query);
    rs.next();
    int currval =rs.getInt(1);
    query = "select * from clob1 where
    id="+currval;
    String str
    ="abcedefhijklmnopqrstuvwxyz";
    rs =stmt.executeQuery(query);
    rs.next();
    java.sql.Clob clob1
    =rs.getClob(2);
    oracle.sql.CLOB clob=
    (oracle.sql.CLOB)clob1;
    System.out.print(clob);
    java.io.Writer
    wr=clob.getCharacterOutputStream();
    wr.write(str);
    wr.flush();
    wr.close();
    stmt.close();
    con.close();
    } catch(Exception ex) {
    System.err.println("SQLException: "
    + ex.getMessage());
    null

    Hi,
    To avoid ORA-22920 error while selecting lob column, use the 'for update' clause in the select statement like :
    query = "select * from clob1 where id="+currval+" FOR UPDATE" ;
    This should solve the problem. However, after fixing this, you might get the error :
    java.sql.SQLException: ORA-1002: fetch out of sequence
    I got this error when testing your code. To avoid this error, before executing 'select ... for update' statement Set AutoCommit to OFF, like :
    query = "select * from clob1 where id="+currval+" FOR UPDATE" ;
    con.setAutoCommit(false);
    rs =stmt.executeQuery(query);
    Hope that Helps,
    Srinivas

  • I installed a version of Firefox 6.0. in the Russian program, the social network for sending a short message, I can not insert a file in the message field.

    I installed a version of 6.0. In the Russian program of social network My World by sending a short message, I can not insert a file in the message or photo. How do I solve this key problems?

    I need to access Network Solutions website builder too. It isn't compatible with Internet Explorer v9, Chrome v13, or Firefox v5! I believe Firefox v6 is out now. This is a Network Solution's problem. What's involved in rolling back? Can you still get add-ons, plugins, and extensions for such an older version? You can't save your personal preferences can you?

  • My DVD drive is blocked. I can not insert a CD / DVD. Does anyone know a solution?

    My DVD drive is blocked. I can not insert a CD / DVD. Does anyone know a solution?

    DDWooldridge wrote:
    Yeah, I was afraid that taking it in for repair might be my only option at this point.  It's my primary computer for work, so almost impossible to be without it for any length of time.  sigh...  Thanks!
    You can request a replacement while your computer is being repaired if you are still under warranty or have Apple Care.  You have to call Apple Care to request a replacement.

  • Can not Insert data to Microsoft Access successfully

    I am using Microsoft Access database, and trying to insert some data into a table with a "while" loop, but every time, the last row can not be inserted although the return value of the "executeUpdate()" is 1, can anyone tell what's wrong with that? thank you very much

    http://forums.java.sun.com/thread.jsp?forum=48&thread=147704
    Sounds like it may be the same "glitch"
    Jamie

  • Can not insert through dblink in procedure

    I have created one procedure which is selecting,inserting and updating data to another database on same server using dblink. it select and update data successfully but when it is going to insert using dblink it gives following error.
    ORA-02019: connection description FOR remote DATABASE NOT FOUND
    ORA-02063: preceding line FROM PAS
    But when i executed same insert statement on sql prompt it is exeuted successfully.
    insert into tab1@dblink values('blah','blah','blah');
    I have dropped all my dblink and recreate it again i have given priveleges externally means insert any table,select any table,update any table to username.
    but still i have recieved same error. Please guide me.
    Global name of database is same as dblink name.
    Thanks in advance
    dhaval

    1. select * from global_name
    PAS and RATEPAS
    I have created two database on same server.
    named pas and ratepas.
    I can not send procedure's code. but actual logic of procedure is selecting a record from temporary table and check whether it is a valid record on the basis of time_stamp and it is inserting a record to base table and update time_stamp to other two tables. and it is giving error only when
    SELECT * FROM dba_db_links;
    OWNER
    DB_LINK
    USERNAME
    HOST
    CREATED
    PUBLIC
    PAS
    PASUSER
    OWNER
    DB_LINK
    USERNAME
    HOST
    CREATED
    pas125
    13-OCT-05

  • Can not insert Data

    Hi all ;
    when tryiing to call a stored procedure from java session bean ,i am getting this error message:
    [BEA][Oracle JDBC Driver][Oracle]ORA-20000: Records are not inserted into the stagging table
    ORA-06512: at "APPS3_MTNAOL.MTN_INV_MANAGER", line 2529
    ORA-06512: at line 1
    but when i am calling the same stored procedure from sql developper for test ,with the same input data, it is working fine. what can be the issue?

    ORA-20000 is a user-defined Error in the database. Please check with whoever developed the code within your organization on what that means.
    but when i am calling the same stored procedure from sql developper for test ,with the same input data, it is working fine. what can be the issue?Obviously, you are not able to recreate the error from 'sql developer'.
    Edited by: RPuttagunta on Dec 7, 2010 3:06 PM

  • Why I can not insert into a table?

    Hi, all,
    I have a table "personstudy" with records already. Its primary key is "subjectid". and I have added a new column named "personstatus" varchar2(20) to it. After that, I want to insert into the field with "enrolled" for all records there. My script is like this:
    insert into personstudy (personstatus) values ('enrolled');
    the system reports:
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("FLOWLIMS"."PERSONSTUDY"."SUBJECTID")
    I just can not understand it. Is there any wrong with my script?
    Thank you!
    Qian

    maybe want you need is not insert a new rows but to update the existing records to have the 'enrolled' value put into the column personstatus.
      update personstudy
         set personstatus = 'enrolled';

  • Xs:int , the schema register generate a NUMBER(10), but can not insert xml

    hi guys:
    I found a problem in the Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production:
    in the schema regist, Oracle help me create a table, with 2 Number(10) segments
    validFrom NUMBER(10)
    validTo NUMBER(10)
    then, I upload the xml file via the ftp, an error report:
    ftp: 19120 bytes received in 0.03Seconds 637.33Kbytes/sec.
    ftp> pwd
    257 "/home/tonyfolder/data" is current directory.
    ftp> put test.xml
    200 PORT Command successful
    150 ASCII Data Connection
    550- Error Response
    ORA-31038: Invalid integer value: "3371475600"
    550 End Error Response
    ftp: 623 bytes sent in 0.00Seconds 623000.00Kbytes/sec.
    3371475600 is really 10 number, the Oracle do not work ?

    hi mdrake, i try this :
    create table XML_DOCUMENT_TABLE
    FILENAME VARCHAR2(64),
    XML_DOCUMENT SYSTEM.XMLTYPE,
    NUMBERTEST NUMBER(10)
    SQL> insert into xml_document_table values ( '' , '' , '3371475600' );
    1 row inserted
    SQL>
    ??? we can insert the '3371475600' into number(10) directly, but we can not input this num via the oracle auto upload
    otherwiseo, your mean is, when the oracle upload xml, oracle checks the number, '3371475600', this value large than int, so ... i can can not input,
    by the way, the num 337147560 ( 9 bit) , xmldb upload success, why ?
    thanks and happy new year

  • I can not insert a field in ANY report . . .

    Post Author: Chass
    CA Forum: General
    I've searched around a bit about this. I can't find anything about anyone who had the same problem.
    I was reporting along and suddenly CR v8.5 wouldn't let me insert a field anymore. I can't insert a field on a new or old report from the field exporer. I drag the field to the area of the report that I want to drop it and it stays a black circle with a line through it. It won't allow me to insert any field in any report.
    I tested this on my coworkers computer and his is working fine. Same version, same report, same field.
    What would cause my install of CR to stop allowing insertion of fields?
    Thanks in advance . . .
    Chass
    ct

    Post Author: Chass
    CA Forum: General
    For anyone else that runs into this issue. I searched heavily and came up with nothing.
    I decided to uninstall and then reinstall the application and that fixed the problem.
    I still don't know the original cause . . .
    Chass
    ct

  • Can not insert or update [TABLE] from internal table in method

    I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
    "An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
    After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
    This is error code.
      METHOD set_data_to_table.
        REFRESH gi_data.
        CLEAR gi_data.
        IF gi_file[] IS NOT INITIAL.
    * Set data for modify table
          LOOP AT gi_file INTO gw_file.
            MOVE-CORRESPONDING gw_file TO gw_data.
            me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                                  CHANGING  ch_vendor = gw_data-vendor ).
            APPEND gw_data TO gi_data.
          ENDLOOP.
          INSERT [TABLE] FROM TABLE gi_data.
    *      LOOP AT gi_data INTO gw_data.
    *        INSERT INTO  [TABLE] VALUES gw_data.
    *        IF sy-subrc = 0.
    *          COMMIT WORK.
    *        ELSE.
    *          ROLLBACK WORK.
    *        ENDIF.
    *      ENDLOOP.
        ELSE.
          MESSAGE 'No data found' TYPE 'I'.
        ENDIF.
      ENDMETHOD.                    "set_data_to_table

    Hi Matthew,
    I think there is no difference in database insert between OO and non-OO.
    The correct syntax according to ECC600 online documentation is
    [Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
    To insert several lines into a database table, use the following:
    INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
    This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
    Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
    I think the syntax
    INSERT my_dbtable FROM TABLE gi_data.
    should work, your suggestion may lead to syntax error.
    Regards,
    Clemens

  • Can not insert a row to a table from Oracle DBA Studio

    Hi,
    I try to use the Oracle DBA Studio to create a table and put some test data in it. Here is what I found:
    I start Oracle DBA Studio on the client machine by connecting to an Oracle server 8i (8.1.7). I create a simple table called Test with two columns: one is USER, VARCHAR2, 10; and the other is USER2, CHAR, 2. After that, I right click on the table name and select "Table Data Editor" from the popup menu. The table editor window shows up. I type in the value 'AA' and 'BB' in the grid of two columns. Then I click the Apply button. An error message box popped up:
    ORA-00928 missing SELECT keyword.
    I click Show SQL button. The SQL statement is as following:
    INSERT INTO "TASYS"."TEST" (USER ,USER2 ) VALUES ('AA' ,'BB').
    I copy the statement to SQL Plus and run it. The same error is generated. But if I remove (USER, USER2) from the statement, it inserts a row without complaint. In other word, the database will not allow to insert if individual columns are list. I realize something must wrong with the new server and client installed and could not figure out what happening. Hope someone can help.
    Thanks.
    null

    I am not sure, but could it be that USER is a keyword or predefine word. Check Oracle'slist of predefine/keyword

  • After installing Cap 5 patch 5.0.2.630 can not insert a text animation

    I installed the 5.0 patch yesterday and today I cannot insert a text animation in my project. I have tried both Insert > Text Animation and Shift+Ctrl+X and nothing happens in either case. I seem to be able to insert everything else (at least the appropriate dialog boxes display). I was apprehensive about an upgrade during a project but did it because I hoped it would resolve some of the audio issues I am seeing.
    I do have a couple of text animations that were working fine since I started the project several months ago, now they work but in a halting sort of way. I thought maybe they had become corrupted and was going to delete and re-insert them but Captivate won't let me now that I have patched it.
    I have seen a number of people indicate that they gave up on text animations because they are pretty unpredictable for the end user of the published project - anyone feel otherwise?

    Following up regarding my bug report, in case this info is useful to others..
    Adobe contacted me via phone and, after we spent a considerable amount of time troubleshooting, the rep determined that my project was corrupted. Since the problems began after the patch was applied, it seemed reasonable to think that it somehow precipitated the issues, but the rep did not feel that was an accurate conclusion. I was concerned that I had now lost a lot of work because, even when I opened older backed up versions of the project, I encountered the same issues. The rep explained that there would not be a lot of rework because I could, in small batches, copy slides from the corrupted project to a new project (except for the Quiz review slide, which I needed to allow Captivate to create automatically in the new project). I was glad to hear this but unfortunately discovered (and the rep did not seem to expect) that not all of the project features copied. Most significantly, Master pages,  Advanced Actions, and object names did not copy over. Those all had to be recreated and reconfigured on the appropriate slides. So there was quite a lot of rework after all.
    Once the substantial rework was completed, I was still having numerous problems working in and running the published project (65 slides total, 3 FLVs). After digging through the forums some more, I decided to break up the project and try the Aggregator, which was a failure. The project would not run. Then I turned to the post about daisy-chaining (#3445696) and I have been able to get things working. I definitely wished I had tried the multi-project route much sooner, but hadn't seen any indication that 65 slides with 3 FLVs was too big of a project.
    Regarding the daisy-chaining: I was unable to get the projects to work by following the instructions to (1) use separate published project folders (2) use relative links to call the next project (3) ensure the folder was a trusted location in my Flash settings. Following these guidelines, the project did work when running on my C drive, but when I copied it to our network, it always threw up an error that it couldn't find the daisy-chained projects. I got it to work by scrapping the use of daisy chaining through the Publish End setting, putting all files in one folder, using a button on the last slide of each project to call the next project, and for the button action, using only the file name (not the relative path) of the project to launch.
    I hope some of this info can help someone else avoid frustration.

Maybe you are looking for