I can't insert row because of sequence trigger

I use JDeveloper 3.1.
In table "Category", column "CAT_Id"(PK) has trigger:
BEGIN
select cat_seq.nextval into :new.cat_id from dual ;
END;
I created an entity object based on this table and set the attribute "CatId":Refresh after Insert.
Then I created some view objects,view links,and application module.
Based on this Application Module,I created a JSP Application. But when I try insert a record to the table through the view object.
It always report the error message:
Exception:
java.lang.RuntimeException: JBO-27120: SQL error during query execution. Statement: select cat_id.nextval from dual
void CMSBeanPackage.View1AddEdit.render()
void cmsjsp1_html.CMS_AddEdit_Top._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.jsp.app.JspApplication.dispatchRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void oracle.jsp.JspServlet.doDispatch(oracle.jsp.app.JspRequestContext)
void oracle.jsp.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.lite.web.JupServlet.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.MimeServletHandler.handle(oracle.lite.web.JupApplication, java.lang.String, int, oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupApplication.service(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.JupAppHandler.handle(oracle.lite.web.JupRequest, oracle.lite.web.JupResponse)
void oracle.lite.web.HTTPServer.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
void oracle.lite.web.HTTPServer.forward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
boolean oracle.lite.web.HTTPServer.handleRequest(oracle.lite.web.JupInputStream, java.io.OutputStream)
boolean oracle.lite.web.JupServer.handle(oracle.lite.web.JupInputStream, java.io.OutputStream)
void oracle.lite.web.JupHTTPListener$JupHTTP.run()
It will be appreciated if any suggestion.
Regards
Susan

Have you tried doing a nextval followed by a currval? ( see documentation ).
Also...whenever I have a problem like this I go into SQL*Plus and just try the stuff manually/inserting a row to see what happens. I mention this cuz I'm surprised at the number of folks who don't seem to do this, but struggle via an IDE.
Also, make sure that MANDATORY is not set in your Entity Object for the sequence attribute if it is part of the primary key ( since the trigger will take care of it and the BO defaults to mandatory? )
DECLARE
tempval number(10);
BEGIN
select return_activities_seq.NEXTVAL into tempval
from dual;
select return_activities_seq.CURRVAL into tempval
from dual;
:new.Sequence_id := tempval;
END; /* return_activities_insert */

Similar Messages

  • Insert row and delete row in a table control

    Hi Experts,
    I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
    Thanks in Advance....

    Santhosh,
    Iam using this code..
    FORM fcode_delete_row
                  USING    p_tc_name           TYPE dynfnam
                           p_table_name
                           p_mark_name   .
    -BEGIN OF LOCAL DATA----
      DATA l_table_name       LIKE feld-name.
    data: p_mark_name type c.
      FIELD-SYMBOLS <tc>         TYPE cxtab_control.
      FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
      FIELD-SYMBOLS <wa>.
      FIELD-SYMBOLS <mark_field>.
    -END OF LOCAL DATA----
      ASSIGN (p_tc_name) TO <tc>.
    get the table, which belongs to the tc                               *
      CONCATENATE p_table_name '[]' INTO l_table_name. "table body
      ASSIGN (l_table_name) TO <table>.                "not headerline
    delete marked lines                                                  *
      DESCRIBE TABLE <table> LINES <tc>-lines.
      LOOP AT <table> ASSIGNING <wa>.
      access to the component 'FLAG' of the table header                 *
        ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
        PERFORM f_save_confirmation_9101.
        IF gv_answer EQ '1'.
          DELETE <table> INDEX syst-tabix.
          IF sy-subrc = 0.
            <tc>-lines = <tc>-lines - 1.
          ENDIF.
          ELSE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    in this code   ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
    if <MARK_FIELD> = 'X'.
    this code is not working...

  • Trigger problem -- can't insert the same data into audit table

    Sir/Madam,
    I'm trying to use insert trigger with a 'long raw' datatype data for my audit purpose. Each time, the data of original table can be inserted correctly. While the trigger for audit table in which it contains almost the same data as original would failed. The error messages are some thing like following:
    java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
    ORA-06512: at "CORPSEC.TI_ARCHIVE_PDF", line 9
    ORA-04088: error during execution of trigger 'CORPSEC.TI_ARCHIVE_PDF'
    If the column with 'long raw' datatype is taken out, then there is no error at all. I'm using Oracle 8i 8.1.6 for Windows NT and suspect there is bug in PL/SQL execution.
    The following are SQL text for the trigger:
    CREATE OR REPLACE TRIGGER "CORPSEC"."TI_ARCHIVE_PDF" AFTER INSERT ON "ARCHIVE_PDF" FOR EACH ROW DECLARE
    LOG_SEQ_NO NUMBER;
    BEGIN
    SELECT AUDIT_SEQ.NEXTVAL INTO LOG_SEQ_NO FROM DUAL
    insert into ad_archive_pdf (DOC_TITLE,PDF_FILENAME,CONTENT,DOC_DESC,AUDIT_REF_NO,AUDIT_DATE,AUDIT_MODE,AUDIT_BY)
    values (:new.DOC_TITLE,:new.PDF_FILENAME,:new.CONTENT,:new.DOC_DESC,LOG_SEQ_NO,sysdate,'I',:new.created_by);
    END;
    Any help on this. Thank in advance.
    Best regards,
    Ruijie

    See here for a discussion of how to incorporate LONG datatypes into triggers:
    http://asktom.oracle.com/pls/ask/f?p=4950:8:635439::NO::F4950_P8_DISPLAYID

  • 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

  • Can't insert new row in last position in row set

    I am trying to programmatically insert a new row into the last slot of a View Object's default row set.
    I normally can do this:
    Row newRow = vo.createRow();
    // set stuff on the row
    vo.last();
    vo.next();
    vo.insert(newRow);and, voila, the row is in the last position.
    But on this particualr view object, when I do the above, the row is inserted in the first slot.
    There doesn't seem to be anything unusual about the View object. it is a child Vo in the data model, but that shouldn't matter.
    When I debug with vo.getCurrentRowSlot(), even after performing last(); next();, vo.getCurrentRowSlot() returns 0, never 3.
    Has anyone else run into this behavior and if so, any resolution or explanation?
    FYI, I was able to use the following workaround:
    Row lastRow = vo.last();
    if (lastRow != null){
        int indx = vo.getRangeIndexOf(lastRow) + 1;
        vo.insertRowAtRangeIndex(indx, newRow);
    } else {
       vo.insertRow(newRow);
    }   

    would this solve your problem
    http://kohlivikram.blogspot.com/2008/10/add-new-row-in-adf-table-on-button.html

  • When i insert a blank DVD, appear a message "The disc can't be burned, Because the device failed to calibrate the laser power level for this media."

    when i insert a blank DVD, appear a message "The disc can't be burned, Because the device failed to calibrate the laser power level for this media."

    when i insert a blank DVD, appear a message "The disc can't be burned, Because the device failed to calibrate the laser power level for this media."

  • Error while inserting rows in a table

    Hi,
    We have recently migrated from 9i to 10g. We have a scheduled job out our DB which first deletes all the rows from a table and then inserts them back by selecting rows from 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when i try to insert rows into the table after deleting all the rows from it, I am able to insert the data successfully . However, in 10g, when i try doing the same operation, it fails with the ORA error:
    ORA-00001: unique constraint violated
    The same query which works perfectly in 9i fails in 10g
    If anybody has some ideas on how to resolve the same, kindly let me know.
    Thanks in advance.

    Hi,
    I was finally able to resolve the reason behind that error message and found it even more weird. The error was because I was using the substr function for extracting the characters 1-4 from a column which is 5 characters long. When i specify the query as:
    select substr(column1, 1, 4)) from table1;
    only the characters 1-3 are retrieved. Now if i change the query to select substr(column1, 1, 5)) from table1, in that case also only 3 characters are retrieved although i have specified the substr to start from 1 and read till 5 characters. Also, when i run the query:
    select length(substr(column1, 1, 4)) from table1 or select length(substr(column1, 1, 5)) from table1
    I get the answer as 3.
    However, the most amazing part is that the query is working perfectly in 9i and is retrieving the data correctly i.e. from substr 1-4.
    Can anyone suggest what the problem could be?
    Thanks
    Edited by: CrazyAnie on May 13, 2009 1:34 AM

  • How can I insert a table in the header?

    The question is easy: How can I insert a table of one row in the header.
    Thanks in advance.
    Jesús.

    There are multiple versions of Pages in circulation on Mavericks and Yosemite. Telling us which one helps with a more accurate answer.
    If you are referring to Pages v5, then you cannot insert a table into the header or footer, because implicitly, these are table cells too. The discontinued Pages ’09 v4.3 would allow table insertion in the document header/footer fields.

  • Help in inserting rows into a table

    I have a table called acct_fact,
    I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
    While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
    If so please suggest me

    Hi Peter,
    Thankyou for the quick reply:)
    can you suggest me how to implement it here in my script snippet:
    while read var_acct_nbr
    do
    echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
    done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
    the script takes each acct_nbr nbr form a input file and fires an insert statement.
    The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
    Thanks in Advance:)
    Edited by: rkrish on Jun 27, 2012 3:04 AM

  • How to insert a value from sequence in Bussiness Components?

    How to insert a value from sequence in Bussiness Components?
    I would like to do it, but without a triger that would do it before insert.
    I know that there is a type DBSequence in BC where you can insert a sequence name but it does not work when I type there my sequence name.
    Do you now how to fix that problem?
    Bart.

    The newer way to do it is to make the type DBSequence and enter the name of the Sequence object in the sequence field. It must match the same name of the sequence object in the database. Next, you have to create a before insert for each row trigger on the table. Basically, something like this:
    CREATE OR REPLACE TRIGGER TGB_THEME_SEQ
    BEFORE INSERT ON THEME
    FOR EACH ROW
    DECLARE
    BEGIN
    -- Assign the id from the sequence if null
         IF( :new.theme_id IS NULL ) THEN
              SELECT THEME_ID_SEQ.nextval
              INTO :new.theme_id
              FROM dual;
         END IF;
    END;
    In the above example, THEME_ID_SEQ is the seuence object name in the database. If you have the name right but it still fails, then the user you are logging in as probably doesn't have access to the sequence in the database.
    Hope this helps.
    Erik

  • Is it possible to insert row with timestamp field without to TO_TIMESTAMP

    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')

    784633 wrote:
    hello
    is it possible to insert row with timestamp column without using to_timestamp unction
    somthing like insert into app.master values (3,333, 'inser tmstmp', 6.7, '2010-11-10 15:14', 'f','9','2010-12-22')If you don't like the answers in your previous thread (Re: how can i set timestamp format don't expect to get different answers just because you start a new thread.

  • Can Imovie Insert Clips During Import?

    I would like to convert some video from my VHSC Tapes.
    Before you stop reading.... I've done this before using my VCR, Camcorder set to A/D convert and a firewire!
    What I would like to know is:
    When I import the video it is imported as one giant clip unless I stop the import and re-start OR manually insert the clips.
    What would be nice is if imovie would automatically insert a clip every x minutes.
    Is that possible?
    Thanks for your help!
    Steve.

    The footage is imported as "..one giant clip.." because there is no digitally-encoded time-&-date info to go with the clip.
    A digital camcorder (DV or Digital-8) 'time-stamps' each sequence ..as long as the clock in the camcorder has been set! iMovie reads this digital info, and thereby splits the footage into individual clips.
    Footage imported from non-digital tapes, such as VHS-C or Video-8, doesn't have this digitally-encoded time-code, so iMovie can't read it, so it imports everything as one single clip.
    There is no way to tell iMovie, presently, to split the footage at specified intervals (see Matti's reply), like, say, Philips DVD recorders (..or Mini-Disc audio recorders..) can automatically insert a position marker every 5 mins.
    The one long clip cannot be automatically split every x minutes ..unless Karl thinks of a way to do it with AppleScript or Automator!

  • DataGrid high rate insert rows

    Hi everyone,
    I'm working in a project where we have a high rate messages (like 2-3k per second) . We use Java on server side, BlazeDS and Flex.
    We have a problem on flex side, the messages are insert on a DataGrid where we just show the last 1k messages, after the 100k messages passed through to the application, the datagrid start to refresh slower than before.
    Do you know how can i solve this problem?
    I executed the profiler and i saw that we don't have memory leaks
    Thanks in advance.

    sorry if i sound dense but i am picking up on the phrase "but i never tried to increase the rate "
    i don't know anything about your architecture but are you cramming data back in some forced rate ?  are you force streaming ? what exactly are you doing  !!
    that poor flash player sounds overwhelmed.
    Date: Thu, 28 Apr 2011 10:05:12 -0600
    From: [email protected]
    To: [email protected]
    Subject: DataGrid high rate insert rows
    There are 7 columns and the messages are around 200 bytes each, this means that the 200 bytes are split in the 7 columns.
    Those messages are encapsulated in an object Message inside of which there are MessageFields that have two properties, tag and value.
    Initially i sent 2.5k message per second but i never tried to increase the rate while the message were been delivered, when i resolve this issue i am going to try that.
    At the begin (with 2.5k per sec) the refresh rate is quite good (almost realtime), i mean that the datagrid refreshes the sequence number of the messages really fast, each second i saw the sequence number increase in 2.5k.
    After the first minute the datagrid starts to collapse and it refreshes every few seconds, like 5 seconds for example, and once its refreshed the sequence number increases in 5 * 2.5k, so the message are coming at the rate.
    Regarding the use of cpu i underestimated that point, i was focus on the memory usage but i've showed that flash plugin recently it's between the first 3rd process and sometime took the 1st place.
    How i can reduce the use of cpu?
    >

  • Gets a created but not inserted row passivated?

    Hi,
    I'm facing a problem concerning that a VO looses its created but not inserted row after passivateState --> activateState.
    The result is that the VO has another row a current row after activateState.
    Any comments?
    Is there a solution? Implement passivateState() and activateState() for that VO Class?
    Configuation problem?
    Thanks,
    Markus

    Hi Steve,
    sorry, I tried, but I can' t reproduce the problem with a sample application. This means that a created (yes, build-in operation) but not inserted row gets passivated and activated!
    There is something fishy with my application because I can't set the state token validation to false. When it is set to false than the new row don't get passivated and activated. :-(
    Thanks,
    Markus

  • JBO-26020: Attempting to insert row with no matching EO base

    Hi All,
    I have a bit of a problem here. The following is some background information. Please help if possible.
    Aim: I have a custom application whereby I need to add the sequence value (assuming the sequence.nextval is already taken and stored into a variable/original table) to my custom table.
    Procedures taken: I have found the EO which gets the sequence value for the original application and the VO that gets the EO. I have added both EO and VO to my project and tried to add the VO to my custom AM. In my custom AM I have added the following code to initialize the create function of the standard EO:
    **********CODE******************
    OAViewObject vo3 = (OAViewObject)getRegRequestsVO1();
    if (!vo3.isPreparedForExecution())
    vo3.executeQuery();
    Row row = vo.createRow();
    vo3.insertRow(row);
    row3.setNewRowState(Row.STATUS_INITIALIZED);
    Problem: However when I use the code vo3.insertRow(row); it prompts me with the applicaiton error of JBO-26020: Attempting to insert row with no matching EO base. I don't quite understand what I am doing wrong.
    Can anyone please help.
    Cheers

    This i have find out .
    FYI...
    JBO-26020: InvalidOperException
    Cause: The application code tried to take a row from one row set (or view object) and insert it into another row set (view object). In response, the framework will make a "copy" of the row in the new row set. This new row will share references to the underlying entity objects. However, if the source and destination row sets do not share any entity object bases at all, this operation will fail as it does not find any entity rows to share.
    Action: When attempting to take a row from one row set and insert into another, make sure that they share at least one entity object base.
    Thanks

Maybe you are looking for

  • Mac Mini / 23" Display / 10.5 - Screen resolution splits in half

    Hey All, I'm using a Mac Mini with a 23" aluminum display. Recently installed Leopard on it, and now I'm having a really funny issue: When I try and restore a window that has been minimized to the dock, the window does restore as its supposed to, and

  • After having a virus and restart my hard drive i can't download quicktime as usual

    after having a virus or something and restart my hard drive i can't download quicktime player as usual.it appears that my computer or antivirus doesn't recognise the program or something like that.thanks

  • Does anyone have any info on MacKeeper?

    Hi, I was prompted to install MacKeeper prior to shutting down last night, but now I'm questioning if this is actually an "Apple" program or is someone trying to phish my system? Does anyone have any information on this? Thank you!

  • Really confusing

    i recently had my old broken ipod replaced through the apple repair program. i the new one today. i hooked it up to my pc, but itunes nor my pc saw it. my brother's ipod hooks up just to the my pc and we have the same ipod 30gb 5th gen video and we u

  • Sent items not syncing

    Hi, my account recently updated from Yahoo to Btinternet, however now my sent items are not syncing with my iphone and I have lost all historic sent items before update?  Anyone have the same problem? Thanks Tina