VB Script - Obtain Record ID after insert transaction

Hi,
New to transactions etc and trying to figure out how to get an insert transaction to redirect to the record edit page and pass the id of the new record through.
Probably really simple but I cannot make it work.
I know exactly how to do this with standard insert behaviour and ASP code!!
Any help appreciated.
Thanks
Nathan

Hi Nathan,
wow, now i´m additionally going to the VB Script forums, though I honestly don´t have *any* clue of that weird stuff, lol :-)
so here´s how I´m doing the same in PHP all the time -- on the update page using an SQL like: "SELECT * FROM your_table ORDER BY id DESC LIMIT 1".
Now I can´t help assuming that ASP´s SQL syntax might be somewhat different from MySQL, so here´s just the idea behind that:
- ORDER BY id :: order by, well, your table´s unique, auto-increment, whatever primary key
- DESC :: order that descending
- LIMIT 1 :: and only show the very last record -- which has to be the newly added one
makes sense ?
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver

Similar Messages

  • Custom Trigger After Insert

    After a insert into table 1, i want to take a value from that transaction and use it in a custom trigger to instert into another datbase the 2 values. One is the primary key value of the transaction of table 1 and the other is a session variable of the logged in user. I can get the value of the session user, but i cant get the value of the transaction field.
    $updateRequestDate = "INSERT INTO request_notify (id_request, username) Values({rsrequest.id_request}, '" . $_SESSION['kt_login_user'] . "')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;
    I have the custom trigger set to go after insert transaction.
    How do you get the value of a transaction field for a custom trigger?

    Gunter,
    You rock. Working example, using your knowledge.
    $updateRequestDate = "INSERT INTO test2 (idtest_note, username_note) VALUES ('". $tNG->getColumnValue("id_test") ."', '". $_SESSION['kt_login_user']."')";
    $update_result = $tNG->connection->execute($updateRequestDate);
    if(!$update_result) {
    $updateError = new tNG_error("Error setting the logged in status to N", array(), array());
    return $updateError;
    } else {
    return NULL;

  • Need session variable after inserting a record.

    I have a page where I am setting up a new user.  After they enter their username, password, address etc. I am inserting the record when they press the commit button, then moving on to the next page.
    I have a session variable setup called user_name, which is also the name of the field in my table.
    My problem is that the value in my session variable goes away after inserting the record.  How do I retrieve the value of user_name?
    At the top of my 2nd page I have:
    <?php
         session_start();
         $_SESSION['user_name'] = $_POST['user_name'];
    ?>
    This gives me an index error.
    I also have session_start(); at the top of my first page.
    What am I doing wrong?
    Thanks.

    I figured it out by moving the variable assignment right before the redirect to the next page.

  • Analyze table after insert a large number of records?

    For performance purpose, is it a good practice to execute an 'analyze table' command after inserting a large number of a records into a table in Oracle 10g, if there is a complex query following the insert?
    For example:
    Insert into foo ...... //Insert one million records to table foo.
    analyze table foo COMPUTE STATISTICS; //analyze table foo
    select * from foo, bar, car...... //Execute a complex query whithout hints
    //after 1 million records inserted into foo
    Does this strategy help to improve the overall performance?
    Thanks.

    Different execution plans will most frequently occur when the ratio of the number of records in various tables involved in the select has changed tremendously. This happens above all if 'fact' tables are growing and 'lookup' tables stayed constant.
    This is why you shouldn't test an application with a small number of 'fact' records.
    This can happen both with analyze table and dbms_stats.
    The advantage of dbms_stats is, it will export the current statistics to a stats to table, so you can always revert to them using dbms_stats.import_stats.
    You can even overrule individual table and column statistics by artificial values.
    Hth
    Sybrand Bakker
    Senior Oracle DBA

  • SQL Server slow on some records after insert

    Have an application that uses Web Service which picks packages with 250 records on the server. Each item is validated and inserted into the database. The problem is that with an empty table, the process inserts 20 records per second, although I still find
    it slow, but as the amount of record will be inserted into the table, the perfomece falls gradually. For example, with 10000 record in the table, can only process 12 record per second, and it will fall until it reaches a minimum of 6 records per second. 
    The database has only primary key, and took longer triggers and indexes. 
    I use SQL Server 2012.
    I researched and saw that I can use XML to do the insert. What is the best way to do this? And because both perfomece falls.
    Marlon Tiedt
    www.sesmt.com.br

    Added the DDL below the 3 main tables involved. The machine I'm doing the tests is an i7 with 8 GB of RAM. Yesterday processing, MS SQL Server came to stay with 3GB of RAM allocated. 
    Another test I did was when I was with 15000 records I deleted the PRODUTO and PRODUTO2 tables, and the process was once again fast, with 20-25 record per second and then fell again to 16 and gradually becoming slower. 
    Another test, I removed everything, PK, FK, constraint and indexes and yet was not fast. I am also thinking that is not index. 
    One thing I noticed, as have several tables involved, opens a transaction on the database, which creates the transaction in my database and then creates the tempdb, is this normal? 
    What additional information I could pass along to you help?
    CREATE TABLE [dbo].[PRODUTO](
    [PR_CODIGO] [int] NOT NULL,
    [PR_ABREVIATURA] [char](20) NOT NULL,
    [PR_DESCRICAO] [char](80) NOT NULL,
    [PR_DESCNOCUPOM] [char](1) NULL,
    [PR_LOTE] [char](1) NULL,
    [PR_COMPOSICAO] [char](1) NULL,
    [PR_PESAVEL] [char](1) NULL,
    [PR_PRECO] [numeric](15, 4) NULL,
    [PR_CUSTO] [numeric](15, 4) NULL,
    [PR_IMCODIGO] [int] NULL,
    [PR_STCODIGO] [int] NOT NULL,
    [PR_UMSIGLA] [varchar](3) NOT NULL,
    [PR_PSMCODIGO] [int] NULL,
    [PR_MLCODIGO] [int] NULL,
    [PR_REGSUM] [int] NULL,
    [PR_CODIGOPR] [int] NULL,
    [PR_MINIIMG] [int] NULL
    ) ON [PRIMARY]
    SET ANSI_PADDING OFF
    ALTER TABLE [dbo].[PRODUTO] ADD [PR_VARIAVEL1] [varchar](250) NULL
    ALTER TABLE [dbo].[PRODUTO] ADD [PR_EXPORTADO] [char](1) NULL
    ALTER TABLE [dbo].[PRODUTO] ADD [PR_RLCODIGO] [varchar](40) NULL
    CONSTRAINT [PRODUTO_PK] PRIMARY KEY CLUSTERED
    [PR_CODIGO] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    CREATE TABLE [dbo].[PRODUTO2](
    [PR_PRCODIGO] [int] NOT NULL,
    [PR_OBSERVACAO] [text] NULL,
    [PR_ATIVO] [char](1) NULL,
    [PR_TIPODISPO] [char](1) NULL,
    [PR_STPORESTADO] [char](1) NULL,
    [PR_NOVOPRECO] [numeric](15, 4) NULL,
    [PR_ORIGEM] [char](1) NULL,
    [PR_FUCODIGO] [int] NULL,
    [PR_CFCODIGO] [char](10) NULL,
    [PR_FOCODIGO] [int] NULL,
    [PR_UMCOMPRA] [varchar](3) NULL,
    [PR_DTREGISTRO] [datetime] NULL,
    [PR_DTULTALT] [datetime] NULL,
    [PR_VARIAVEL5] [char](20) NULL,
    [PR_VARIAVEL6] [char](20) NULL,
    [PR_PECOMISSAO] [numeric](15, 4) NULL,
    [PR_VARIAVEL7] [char](20) NULL,
    [PR_VARIAVEL8] [char](20) NULL,
    [PR_VALIDADE] [int] NULL,
    [PR_PESO] [numeric](15, 4) NULL,
    [PR_MOSIGLA] [varchar](3) NULL,
    [PR_DTALTPRECO] [datetime] NULL,
    [PR_PRECOANT] [numeric](15, 4) NULL,
    [PR_PECOMISSAOPRAZO] [numeric](15, 4) NULL,
    [PR_ALFA1] [varchar](40) NULL,
    [PR_ALFA2] [varchar](40) NULL,
    [PR_NUM1] [numeric](15, 4) NULL,
    [PR_NUM2] [numeric](15, 4) NULL,
    [PR_PRECOFUTURO] [numeric](15, 4) NULL
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    SET ANSI_PADDING OFF
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_EXIBETOUCH] [char](1) NULL
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_VARIAVEL2] [varchar](250) NULL
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_VARIAVEL3] [varchar](250) NULL
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_VARIAVEL4] [varchar](250) NULL
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_PESOBRUTO] [numeric](14, 2) NULL
    ALTER TABLE [dbo].[PRODUTO2] ADD [PR_LABORATORIO] [varchar](80) NULL
    CONSTRAINT [PRODUTO2_PK] PRIMARY KEY CLUSTERED
    [PR_PRCODIGO] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ALTER TABLE [dbo].[PRODUTO2] ADD DEFAULT ('N') FOR [PR_ATIVO]
    GO
    CREATE TABLE [dbo].[BARRAS](
    [BR_BARRAS] [char](20) NOT NULL,
    [BR_PRCODIGO] [int] NOT NULL,
    [BR_LOTE] [int] NULL,
    [BR_UMSIGLA] [varchar](3) NULL,
    [BR_REGSUM] [int] NULL
    ) ON [PRIMARY]
    SET ANSI_PADDING OFF
    ALTER TABLE [dbo].[BARRAS] ADD [BR_CODIGOFISCAL] [char](1) NULL
    CONSTRAINT [BARRAS_PK] PRIMARY KEY CLUSTERED
    [BR_BARRAS] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    Marlon Tiedt
    www.sesmt.com.br

  • Update the record after insert

    Hi All,
    We have a requirement in Oracle Forms where the user should be able to insert the data into the custom table through the form. Once the user enters the data and does ‘Ctrl+S’, the record is saved in the database. After this if he has changed any of the details entered in record that is inserted(without refreshing the form) and does ‘Ctrl+S’, then a message is shown as per the standard form that the record is applied and saved. But the changes are not saved in the database.
    If anyone has worked on the similar requirement then please let us know how to implement this in Oracle Forms.
    Immediate help will be highly appreciated.
    Thanks and Regards,
    Aniruddha

    Hello:
    Change the target of the branch defined in the page that has your form to point to itself.
    Delete the 'reset page' page process defined on the form page.
    varad

  • The row was not found at the Subscriber error keeps popup and stopped synchronization even after inserting missing record at subscriber - transcational replication.

    The row was not found at the Subscriber error keeps popup and stopped synchronization even after inserting missing record at subscriber - transcational replication.
    first error throws: Grab exact sequence number, find row and inserted at subscriber...
    Start synchronizing, ran fine for a while, stopped again with error with different exact sequence number, repeat again same as step 1.......
    how can we stop this and make it run without this error?
    Please advise!!!

    Hi,
    This means that your database is out of sync. You can use the continue on data consistency error profile to skip errors. However, Microsoft recommends that you use -SkipErrors parameter cautiously and only when you have a good understanding of the following:
    What the error indicates.
    Why the error occurs.
    Why it is better to skip the error instead of solving it.
    If you do not know the answers to these items, inappropriate use of the
    -SkipErrors parameter may cause data inconsistency between the Publisher and Subscriber. This article describes some problems that can occur when you incorrectly use the
    -SkipErrors parameter.
    Use the "-SkipErrors" parameter in Distribution Agent cautiously
    http://support.microsoft.com/kb/327817/en-us
    Here are two similar threads you may refer to:
    http://social.technet.microsoft.com/Forums/en-US/af531f69-6caf-4dd7-af74-fd6ebe7418da/sqlserver-replication-error-the-row-was-not-found-at-the-subscriber-when-applying-the-replicated
    http://social.technet.microsoft.com/Forums/en-US/f48c2592-bad7-44ea-bc6d-7eb99b2348a1/the-row-was-not-found-at-the-subscriber-when-applying-the-replicated-command
    Thanks.
    Tracy Cai
    TechNet Community Support

  • CCX 8.0.2 Script prompt recording stopped working. Recording command stop after beep, "Error Unmarshaling return" Has anyone experience this error?

    Our Script prompt recording stopped working. After user authentication, the Recording command plays the prompt asking to record after the beep, but after the beep the application ends with error exception on screenshot below.
    Have anyone experience this error?
    Any thoughts will be appreciated
    Cisco Unified CCX Administration
    System version: 8.0.2.11004-12

    Hello Everyone,
    Just in case that someone experience this problem, this problem points to a permission issue with the owner of one of the directories via root. TAC needs to be involved in order to modify the following settings.
    Note:
    If you have two servers, you need to do it on both.
    I've seeing sometimes that it takes a couple of minutes to take action.
    Record prompt script failing with error message    "CMTRecordingDialogImpl"
    UCCX versions:   Linux versions and especially after upgrades to the system.
    Solution:   Problem is due to permissions,
    [root@DISDUCCXPUB ~]# cd /opt/cisco/uccx/
    [root@DISDUCCXPUB uccx]# ls -l | grep temp
    drwxr-xr-x   2 root       root         4096 Oct  6  2011 temp
    [root@DISDUCCXPUB uccx]# chown uccxuser:uccxservice temp
    [root@DISDUCCXPUB uccx]# chmod 775 temp
    [root@DISDUCCXPUB uccx]# ls -l | grep
    temp  drwxrwxr-x   2 uccxuser   uccxservice  4096 Oct  6  2011 temp
    [root@DISDUCCXPUB uccx]#   drwxrwxr-x   2 uccxuser   uccxservice  4096 Jan 17 15:07 temp
    This should take care of the problem. Again, Cisco TAC needs to be engage because of the root access.
    Regards,
    Daniel Amador
    Cisco TAC Support Engineer, IPCC Express Team

  • After Insert Trigger Not Working

    Hi All,
    I am not a guru in writing triggers.
    I am inserting new records in a Table FA_BOOKS by application and this inserts records in FA_ADDITIONS_B. This is a vanilla process.
    i have written a trigger on FA_ADDITIONS_B, and i want to update the cost from the fa_books to fa_additions_b column attribute21
    The trigger i have written is After insert on FA_ADDITIONS_B and i try to select cost from the fa_books for the :new.asset_id.
    SELECT COST
    INTO v_cost
    FROM FA_BOOKS
    WHERE ASSET_ID = :NEW.ASSET_ID;
    this is always returning no_data_found exception and i do not understand how to update the attribute21 in FA_ADDITIONS_B
    Here is a sample of my trigger.
    CREATE OR REPLACE TRIGGER update_attribute21_new_asset_1
    after INSERT ON fa_ADDITIONS_B
    FOR EACH ROW
    DECLARE
    V_COST NUMBER;
    BEGIN
    SELECT COST
    INTO v_cost
    FROM FA_BOOKS
    WHERE ASSET_ID = :NEW.ASSET_ID;
    update fa_ADDITIONS_B
    set attribute21 = v_cost
    where ASSET_ID = :NEW.ASSET_ID;
    END;
    Any help on this will be appreciated.
    TX in advance.
    Regards,

    I still haven't understood the reason why you can't transfer the COST information from FA_BOOKS to FA_ADDITIONS_B in the initial trigger on FA_BOOKS that populates FA_ADDITIONS_B. Or how is the population of FA_ADDITIONS_B accomplished? Is it part of the application code?
    Regarding the NO_DATA_FOUND issue:
    Is it ensured that populating the FA_ADDITIONS_B table is done in the same transaction as the FA_BOOKS inserts or that the FA_BOOKS transaction is committed?
    Why do you need that additional trigger?
    My assumption is that you're in a trigger "chain" - if I get your approach correctly - you're basically attempting to query FA_BOOKS in a trigger on FA_ADDITIONS_B that in turn has been triggered by a trigger on FA_BOOKS which gets us back to the "mutating" trigger issue. You can't read a table that is currently in the process of being modified.
    Or even worse: The (potential) trigger on FA_BOOKS that populates FA_ADDITIONS_B uses "autonomous transaction" and therefore the trigger on FA_ADDITIONS_B can't see the changes of the original transaction.
    As already mentioned: Be very careful with "autonomous transactions" in general. There are only a few cases where these are actually useful (e.g. logging purposes), but Tom Kyte has written numerous articles why triggers and in particular autonomous transactions are mostly evil.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • JClient: after INSERT and COMMIT does not show the primary textfield value

    1. In my JClient master-detail form: When I insert a new record, enter data, and commit the changes... the master-panel's primarykey textfield is BLANK, when it should show the new auto-incremented number from the MySQL database. I have to close and open the form again to refresh that field again.
    2. In order to properly save new records in the detail-panel, I have to insert and save the above master-panel first. Is this the way JCLient handle master-detail forms?
    Thanks.

    Hi. Thanks for sharing your advice.
    Re my problem,
    if we have to refresh data by requery,i suggest you should use the way below:
    private JUNavigationBar navBar = new JUNavigationBar(true,false,true,false,true);
    navBar.setModel(JUNavigationBar.createPanelBinding(panelBinding, navBar));
    // after insert ,call this method
    navBar.doAction(navBar.BUTTON_EXECUTE);Tried this out but my textfield still won't get refreshed. Here is the code I came up with:
        private JUNavigationBar navBar = new JUNavigationBar() {
                public void doAction(int button) {
                    if (button == JUNavigationBar.BUTTON_INSERT) {
                        super.doAction(button);
                        navBar.doAction(navBar.BUTTON_EXECUTE);
                        return;
                    super.doAction(button);
            };Re your problem,
    I am developing application with JDev + MySQL,encounted another problem,
    how can i get the primary key supported by auto_increment column after insert?
    i constructed a vo whose sql statement is
    select last_insert_id() as last_id to get the value of auto_increment column.
    i found it can't get the right value unless commit the transaction.
    Would u please tell me your way?Based on what I experienced, we dont have to do the SELECT statement above. MySQL does auto-increment the primarykey but the JClient form just cant show it immediately, unless we close and re-open the form.
    What did I do to refresh the primarykey during insert? Please note that I got this solution accidentally coz I'm still a newbie in Java.
    A user want to add a record:
    1. He presses the Insert button.
    2. He enters data into a component (ex. textfield)
    3. The component's action-performed event is fired, and the following code is run:
            DCJboDataControl dc = (DCJboDataControl)panelBinding.getDataControl();
            ApplicationModule am = dc.getApplicationModule();
            Transaction tr = am.getTransaction();
            dc.commitTransaction();
            ViewObject vo = am.findViewObject("TblaccountsView1");
            vo.executeQuery();
            vo.last();It simply commits the transaction, goes to last (new) transaction, and lets the user continue his data encoding.
    Hope it helps and I hope theres an even better way to do this.

  • After insert trigger problem

    I am trying to write a trigger which will update a date col after every insert////
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    AFTER INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    declare PRAGMA AUTONOMOUS_TRANSACTION;
    BEGIN
    update ps1.COMMNPLANBUDGET set CREATION_DATE=sysdate where PROJECTID = :new.PROJECTID;
    commit;
    END XX_CDATE;
    For the same i have written the above code, it created successfully but when i am inserting a record the date col is not getting updated. Please let me know where i have done wrong. Thanks in advance

    Hello
    You should not use autonomous transactions in a trigger. Do not do it, and if anyone tells you to use autonomous transactions in a trigger to avoid mutating table exceptiosn, you should instruct them to put their hands in a toaster, switch it on maximum and insist they keep them there until the timer reaches zero.
    Anyway, if the primary key on this table is project ID, you don't need to go to these lengths. You can simply
    CREATE OR REPLACE TRIGGER PS1.XX_CDATE
    BEFORE INSERT ON ps1.COMMNPLANBUDGET
    REFERENCING OLD AS old NEW AS new
    FOR EACH ROW
    BEGIN
        :NEW.creation_date := sysdate;
    END XX_CDATE;If project_id is not the primary key, why would you update the creation date for all rows attached to the project id?
    David
    Edited by: Bravid on Sep 22, 2011 9:29 AM
    Oops, after reading Karthik's post, I realised I left the AFTER insert in the trigger spec. Updated it to BEFORE.

  • After insert trigger

    Dears,
    In after insert trigger implementation if the base table failed due to some errors.
    Is it possible to still have records inserted in the log table inside the trigger
    Thanks
    Janani.C

    What you want is to write log records to a table, regardless of whether the transaction they're logging fails. This would make sense for inevstigating errors,e tc. This is the only time when it is acceptable to use autonomous transactions.
    Encapsulate your logguing code in a separate procedure which has the {font:courier new}PRAGMA autonomous_transaction{font} in its declaration, and include a commit. Such a procedure works in its own separate tranasction - a separate session in fact - and write the log record without affecting the broader transaction. [url http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1515]Find out more.
    Cheers, APC
    P.S. I agree with Hoek that you should investigate teh LOG ERRORS INTO functionality, as it can be very useful, especially with bulk processes. However, it can only store information directly relating to the rejected records, which might not be sufficient for your purposes.

  • Refresh LOV after inserting data in correspondent table

    Hi all,
    I am using Jdeveloper 11.1.1.2 and ADFBC.
    I have a page with a table (tableA) with some fields. One of them has a LOV associated to another table(tableB). I have a button (button1) that shows a popup(popup1) and opens a new task flow with a fragment to insert data in the tableB.
    After inserting/modifying rows in tableB and after pressing commit (property: end-transaction) or rollback buttons (property: end-transaction and restore save point), LOV does not refresh.
    I have tried to set the property partial triggers of the LOV to button1 or popup1 and it does not work.
    How can I solve it?
    Thank you.
    Andrea

    How about VO for table B ? Did you refresh that ? I didn't use the same VO for table & LOV.
    so in "List data Source" -- VO -- I am using "SQL statement" and statement includes fields from Table B and Table A.
    VO for LDS using "Rows populated by a SQL query with read-only access". I didn't use "Updateable Access through Entity Objects".
    Sample of VO of LDS:
    select A.model_number modelNumber, a.part_number partNumber, b.MODEM_TYPE ModemType
    from table A a,Table B b
    where a.PART_NUMBER_ID = b.PART_NUMBER_ID
    and a.part_number_id =:partID
    Edited by: albertpi on Mar 16, 2010 7:26 AM

  • Using Database Change Notification instead of After Insert Trigger

    Hello guys! I have an after insert trigger that calls a procedure, which in turn is doing an update or insert on another table. Due to mutating table errors I declared the trigger and procedure as autonomously transactional. The problem is, that old values of my main tables are inserted into the subtable since the after insert/update trigger is fired before the commit.
    My question is how can I solve that and how could I use the change notification package to call my procedure? I now that this notification is only started after a DML/DDL action has been commited on a table.
    If you could show me how to carry out the following code with a Database Change Notification I'd be delighted. Furthermore I need to know if it suffices to set up this notification only once or for each client seperately?
    Many thanks for your help and expertise!
    Regards,
    Sebastian
    declare
    cnumber number (6);
    begin
    select count(*) into cnumber from (
    select case when (select date_datum
        from
          (select f.date_datum,
            row_number() over (order by f.objectid desc) rn
          from borki.fangzahlen f
          where lng_falle      = :new.lng_falle
          and int_fallennummer = :new.int_fallennummer
          and lng_schaedling   = :new.lng_schaedling
          and date_datum       > '31.03.2010'
        where rn=1) < (select date_datum
        from
          (select f.date_datum,
            row_number() over (order by f.objectid desc) rn
          from borki.fangzahlen f
          where lng_falle      = :new.lng_falle
          and int_fallennummer = :new.int_fallennummer
          and lng_schaedling   = :new.lng_schaedling
          and date_datum       > '31.03.2010'
        where rn=2) then 1 end as action from borki.fangzahlen
            where lng_falle      = :new.lng_falle
            and int_fallennummer = :new.int_fallennummer
            and lng_schaedling   = :new.lng_schaedling
            and date_datum       > '31.03.2010') where action = 1;
    if cnumber != 0 then
    delete from borki.tbl_test where lng_falle = :new.lng_falle
    and int_fallennummer = :new.int_fallennummer
    and lng_schaedling   = :new.lng_schaedling
    and date_datum       > '31.03.2010';
    commit;     
    pr_fangzahlen_tw_sync_sk(:new.lng_falle, :new.int_fallennummer, :new.lng_schaedling);

    It looks like you have an error in line 37 of your code. Once you fix that the problem should be resolved.

  • How to Display a message after inserting row in table............

    Hi
    I want to display a message after inserting rows in table like *'you have inserted a new row successfully*'.
    i am using the createinsert ADF Button to insert the rows in table.after that i am comitting it.
    after commiting i want to display message for the user.for this what i need to do.
    Please help me.
    Sailaja.

    user10860137
    Can you please explain me the each line in the code briefly.
    +public String saveButton_action(){+
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("Commit");
    Object result = operationBinding.execute();
    +// note "!" operator has been removed from the default code.+
    +if(operationBinding.getErrors().isEmpty()){+
    FacesContext ctx = FacesContext.getCurrentInstance();
    FacesMessage saveMsg = new FacesMessage("Record Saved Successfully");
    ctx.addMessage(null,saveMsg);
    +}+
    return null;
    +}+
    And i have requirement to show the message on favcet "status bar".not in a popup window.(from the above code the message is showing in popup window. )the Layout i am using is PanelCollection.
    can you tell me what i need to do.
    Thanks
    Sailaja.
    Edited by: sj0609 on Mar 19, 2009 8:03 AM

Maybe you are looking for