Sample of create trigger

Hi all

Can you give me the will of fire CREATE TRIGGER sample once and not "for each line.

I find this example in the docs:
CREATE OR REPLACE TRIGGER Emp_count
AFTER DELETE ON Emp_tab
FOR EACH ROW
DECLARE
    n INTEGER;
BEGIN
    SELECT COUNT(*) INTO n FROM Emp_tab;
    DBMS_OUTPUT.PUT_LINE(' There are now ' || n ||
        ' employees.');
END;
It is still ok if I remove the clause "for each line?
as in:
CREATE OR REPLACE TRIGGER Emp_count
AFTER DELETE ON Emp_tab
DECLARE
    n INTEGER;
BEGIN
    SELECT COUNT(*) INTO n FROM Emp_tab;
    DBMS_OUTPUT.PUT_LINE(' There are now ' || n ||
        ' employees.');
END;
Thank you very much
Kinz

You missed to add the statement FOR EACH ROW.
What happens if you write:

create or replace trigger backup_config_trg01
before UPDATE  ON backup_config
FOR EACH ROW
  begin
  if :OLD.BACKUP_USER_ID        != :NEW.BACKUP_USER_ID        or
     :OLD.BACKUP_USER_PASSWD    != :NEW.BACKUP_USER_PASSWD    or
     :OLD.DB_SYSTEM_PASSWD      != :NEW.DB_SYSTEM_PASSWD      or
     :OLD.MAIL_SERVER_ADDR      != :NEW.MAIL_SERVER_ADDR      or
     :OLD.BACKUP_SIZE_WARNING   != :NEW.BACKUP_SIZE_WARNING   or
     :OLD.VALID_DAYS            != :NEW.VALID_DAYS            or
     :OLD.REPORT_DAY            != :NEW.REPORT_DAY            or
     :OLD.REPORT_TIME           != :NEW.REPORT_TIME           or
     :OLD.WEEKLY_EMAIL_ACCOUNTS != :NEW.WEEKLY_EMAIL_ACCOUNTS or
     :OLD.DAILY_EMAIL_ACCOUNTS  != :NEW.DAILY_EMAIL_ACCOUNTS  or
     :OLD.DAILY_REPORT_TIME     != :NEW.DAILY_REPORT_TIME     THEN
   IF :NEW.CHANGE_FLAG = 0 THEN
            select '1' into :NEW.CHANGE_FLAG from dual;
        END IF;
  END IF;
  end;
/

It is working for you? Or, if possible, let us know your table structure, so that we can try to help you.

Concerning
Girish Sharma

Published by: Girish Sharma on Sep 4, 2012 16:11

Published by: Girish Sharma on Sep 4, 2012 16:16

Tags: Database

Similar Questions

  • A tutorial / sample to create a single PDF of several source files using assembler PDF in a process of control folder.

    A tutorial / sample to create a single PDF of several source files using assembler PDF in a process of control folder. I have a client application that will prepare the number of source files and metadata information (in. (XML) that will be used in the header/footer. Is it possible to set a run time generated shows the DDX file in the folder and use it in the process. If possible how can I pass the file names in the DDX. Any sample process will be very useful.

    If possible, make use of the API of the assembler in your client application instead of doing this using watched folder. Here are examples of the assembler: LiveCycle ES2.5 * programming with LiveCycle ES2.5

    The record can accept zip files (example: configuration of a control folder to manage several input files and write the results to a single folder |) Adobe LiveCycle Blog ). You can also use run the script to create the DDX when executing: LiveCycle ES2 * Application Development using LiveCycle Workbench ES2

    Thank you

    Wasil

  • HAVE high sampling frequency of trigger

    Dear community

    I am using a microscope to tunnel effect from here feeding two voltage signals on my map of acquisition of data USB-6212 (Labview 2013 SP1). A voltage signal is the voltage applied to a piezo in the microscope (AI0). This signal drifting slowly over time and it is noisy. The other voltage signal is a tunnel current is converted into a voltage (AI2) signal (see attached photo):

    Ideally, I would like to record the two signals between the lines dotted in a .txt file whenever the event of tip in the top image rises. This should be about every second during a day.

    So far, I've written a VI that calculates the moving average of the piezo signal and if the piezo voltage exceeds a certain percentage of the average running it fires a command 'Save as file'. The VI works well for a frequency of 100 Hz, but when I go to 20 kHz, the trigger does not work properly. I am also only watching a lot of a number (in this case, 1000) and if there is a trigger signal in these samples of 1000. So if there's a signal around 0 or 1000 I cut and split into two files that I want to avoid.

    I don't have much experience with Labview and probably broke every rule of design in the book.

    My question is if there is a smarter way to automatically back up the signal between the same dotted lines at high frequencies of sampling?

    I thank very you much in advance!

    Hi Mario,.

    I rewrote the portions of your VI to improve performance (we hope). No need to three queues.  No inquiry unless there is a trigger occurs.

    I'm confused by the outbreak that seems to detect the edges of the piezo signal high side, even if the tip is in the negative sense.  I modified this logic (eventually) get a threshold top-side of the signal of tunneling.

    It is unclear what might happen to 20 kHz.  The example shows a constant 1 kHz sampling rate and 1 K samples treated by loop.  If the sampling rate is changed to 20 kHz, then the loop will have to run to 20 Hz in order to keep up with the acquired data (@1 K samples per read).

    I hope that the joint allows VI (not tested).

  • Any sample of "creating a GroupDataModel as QML and C++.

    Hello

    Of this sample:

    https://developer.BlackBerry.com/Cascades/documentation/UI/lists/groupdatamodel.html

    // This is the C++ code that populates the data model. You could include this code
    // in the constructor for your app, in an initialization function, or another
    // location in your app.
    
    // Create the GroupDataModel by locating the corresponding QML component
    GroupDataModel *pModel = root->findChild("groupDataModel");
    
    // Insert the data as instances of the Employee class
    pModel->insert(new Employee("Barichak", "Westlee", 12596375));
    pModel->insert(new Employee("Lambier", "Jamie", 53621479));
    pModel->insert(new Employee("Chepesky", "Mike", 65523696));
    pModel->insert(new Employee("Marshall", "Denise", 77553269));
    pModel->insert(new Employee("Taylor", "Matthew", 51236712));
    pModel->insert(new Employee("Tiegs", "Mark", 13112965));
    pModel->insert(new Employee("Tetzel", "Karla", 99214732));
    pModel->insert(new Employee("Dundas", "Ian", 64329841));
    pModel->insert(new Employee("Cacciacarro", "Marco", 54575213));
    

    How can I get Employee of row object in my slot triggered?

    void onTriggered(QVariantList indexPath)
    {
        GroupDataModel *pModel = root->findChild("groupDataModel");
        pModel->data(indexPath);    //......?????????
    
        Employee e
    }
    

    Nicolas

    I found the solution... it's quiet easy.

    void onTriggered(QVariantList indexPath)
    {
        GroupDataModel *pModel = root->findChild("groupDataModel");
    
        QVariant item = pModel->data(indexPath);
    
        Employee *e = (Employee *) item.value();
    }
    

    Nicolas

  • ERRO creating trigger

    Hello, I have this trigger. Have a look at it and see what could possibly go wrong...
    SQL> create or replace trigger Teacher_trigger 
      2  Before insert or update or delete ON teacher 
      3  begin
      4       if (trunc(sysdate)+15/24 >2) then
      5          raise_application_error(-20001,'no work');
      6      end if;
      7  end;
      8  /
    
    Warning: Trigger created with compilation errors.
    
    SQL> show errors
    Errors for TRIGGER TEACHER_TRIGGER:
    
    LINE/COL
    --------------------------------------------------------------------------------
    ERROR
    --------------------------------------------------------------------------------
    2/1
    PL/SQL: Statement ignored
    
    2/26
    PLS-00306: wrong number or types of arguments in call to '>'
    What to do?

    It is because of the wrong relational expression

    (trunc(sysdate)+15/24 >2)
    

    You compare the date against a number value. Both sides of an operator of the relationship must have as a data type of values. So change according to the changes in the code and compile the trigger.

  • How can we use, "Create trigger and replace" using the oracle form

    Hi all
    How can we use the following creation or replacing the trigger in the form of oracle?
    Please help me.

    CREATE OR REPLACE TRIGGER app_user.after_logon_trg
    AFTER LOGON WE app_user. SCHEMA
    BEGIN
    DBMS_APPLICATION_INFO.set_module (USER, "Initialized");
    EXECUTE IMMEDIATE 'ALTER SESSION SET current_schema = SCHEMA_OWNER';
    END;

    Sarah

    user434854:

    Your information is good enough about the use of roles. This is the model of security that our customers use. Only assign us a password for roles and issues of connection of users shape the grant sql role using the password is used since in the form.

    However, I agree with Andreas on the hard coding schema owner. We have several clients, and each of them has a different name for the owner of the schema. By creating a public synonym for access to our forms tables, our forms work well at all sites.

    And after 325 posts, why don't give you yourself a real name on the forum?

  • Create trigger permissions.

    Hello world
    I have a few questions about the permissions associated with the creation of the trigger.

    If I want to create a new trigger in owner1 ' schema user that points to a table in another schema...

    Authorities who should I give you that the schema user that belongs to the trigger?

    REFERENCES was not enough
    CREATE OR REPLACE TRIGGER "OWNER1". "' trigger_name ' FRONT
    INSERT
    OR UPDATE
    OR DELETE ON
    "OWNER2. "" Table_name "FOR EACH LINE
    BEGIN
    IF THE INSERTION
    ...
    END IF;
    IF THE UPDATE CAN
    ...
    END IF;
    IF REMOVE THEN
    ...
    END IF;
    END;
    /

    You must, at a minimum, CREATE ANY TRIGGER.

    SY.

  • Finite sampling on each trigger

    Hello? I have a problem of error about DAQmxSetReadOffset().

    Whenever I put this code,

    short* DataBuffer = new short[_countof(dbuffer)];
    ...
    DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",fRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,_countof(dbuffer) ));
    ...
    

    I get this error:

    _countof (dbuffer) is a data buffer size. I wish to acquire _countof (dbuffer) sample size.

    I tried this, but no use.

    DAQmxErrChk (DAQmxGetReadAvailSampPerChan(taskHandle,&reading)); 
    
    if(reading>_countof(dbuffer))
    {
    DAQmxErrChk(DAQmxSetReadRelativeTo(taskHandle,  DAQmx_Val_MostRecentSamp ));
    DAQmxErrChk(DAQmxSetReadOffset(taskHandle, -(_countof(dbuffer)) ));
    }
    

    Ah, I solved the problem. He used a while() condition, but it causes this error.

    Continuous sampling must while() but in this case, it didn't need it.

  • How can I create a single delayed output (analog voltage) of a Trigger (analog voltage) input reference pulse?

    I am working with a combustion chamber and using a system of data acquisition (with the hardware OR SCB - 68) to read the pressure in the cylinder (such as analog voltage). I'm trying a pulse delayed, 1 millisecond to 5 volts of output once the pressure in the cylinder is high above 5 bar (which corresponds to an analogue voltage of 0.25 V). I would also like to record 30 ms samples before the trigger and 220 ms samples after the outbreak. The following image shows visually what I'm talking about.

    I created a LabVIEW VI (which is attached), but I keep running into 2 issues:

    1. When I run with samples finished after a period of time, I get error-200281which I don't quite understand.

    2. Using the Express VI 'Out of time' to keep time for the pulse I can not get a resolution of 1 millisecond, the pulse is not generated when I put the window between 0.003 and 0.004 seconds for high pulse (i.e. the resolution of 'Elapsed Time' seems to be too coarse).

    I'm a beginner to LabVIEW sorry if my questions are trivial or my VI makes no sense, but I was stuck on this during more than a week. Any help would be greatly appreciated!

    Thank you

    Morgen

    This isn't a good way to trigger a pulse.
    Use a trigger DAQmx to send the pulse when your acquired signal exceeds 250 mV you specified.

    See this for DAQmx trigger:

    http://www.NI.com/white-paper/2835/en/#toc4

  • Create materialized view at the trigger.

    Hello

    I use version below:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    I created a materialized view query below:

    CREATE THE FSG1_FUND000 MATERIALIZED VIEW

    PCTUSED, PCTFREE 5 70

    Users TABLESPACE

    STORAGE (INITIAL 500K NEXT 500K)

    Refresh a start fast with (sysdate) next (sysdate + (1 / 1440))

    WITH rowid

    AS

    SELECT * FROM ABNDEV_T24. FSG1_FUND000@abndev;

    This Mview if any insert or update only (WITHOUT DELETING) are coming which should be copy to another table. But in mView trigger does not work.

    So pls advice me no alternative.

    Querys trigger:

    create or replace trigger trg_dummy

    after insert or update on FSG1_FUND000

    for each line

    Start

    If the insertion

    insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);

    elsif update then

    insert into FSG1_FUND001 (RECID, XMLRECORD) values (: new.) RECID,: new. XMLRECORD);

    end if;

    end;

    /

    Kind regards

    Villa

    Hello

    I learned and referred website as much as we can not able to create a trigger in MView (sorry we create trigger but none use of creation because in view no insert and update happened). So I drop completely the materialized view concepts and relaxation.

    Instead of, I have using the procedure to insert records in a table and then I created one by dbms_scheduler job.

    This discussion will be useful for any future reference.

    -procedure-

    create or replace procedure p2

    as

    Start

    INSERT / * + APPEND * / INTO FSG1_FUND000 SELECT * FROM FSG1_FUND000@remote;

    End; BluShadow

    /

    -----------------job--------------------

    Begin

    DBMS_SCHEDULER. () CREATE_JOB

    job_name-online "JOB4."

    job_type-online "PLSQL_BLOCK."

    JOB_ACTION => ' BEGIN p2; END;',

    start_date => SYSDATE,

    repeat_interval => ' FREQ = MINUTELY; INTERVAL = 5;',

    End_date => NULL,

    -Online TRUE, enabled

    comments => "Inserting a record in a table");

    end;

    /

  • Use of "DBA_OBJECTS" in 'CREATE AFTER' Trigger

    Hello

    We want to store additional information about our items, we have in the database. Do we tought of the idea of creating a "documentation" table containing an object_id that references to the object_id of the dba_views view.

    Now we want to create a new record automatically in our table documenting when a new object is created, as a first step it should contain only the object_id
    To do this, we use a "AFTER CREATING" trigger, but when this trigger is enabled and if the code finds the new object_id in dba_objects, he returned no records and generates an error. Probably because when the trigger is run, the display is not yet updated?

    create or replace
    TRG_TEST RELAXATION
    AFTER CREATE ON SCOTT. SCHEMA
    DECLARE
    tmp VARCHAR2 (50);
    BEGIN
    dbms_output.put_line (ora_dict_obj_name);

    Select object_id
    in tmp
    from dba_objects
    where object_name = ora_dict_obj_name;

    dbms_output.put_line (tmp);
    END;

    Error report:
    ORA-04088: doing bij uitvoering van trigger ' SCOTT. TRG_TEST'.
    ORA-01403: Geen gegevens anyway.
    ORA-06512: in regel 6
    04088 00000 - "error during execution of trigger '% s.%s '.
    * Cause: An error occurred during the execution of a trigger.
    * Action: Check the triggers that participated in the operation.

    It's in Dutch, so I'll have a go at translating:

    Error report:
    ORA-04088: Exception when executing trigger ' SCOTT. TRG_TEST'.
    ORA-01403: no data found
    ORA-06512: in rule 6
    04088 00000 - "error during execution of trigger '% s.%s '.
    * Cause: An error occurred during the execution of a trigger.
    * Action: Check the triggers that participated in the operation.

    Does anyone have an idea how I can accomplish what I am trying to do here... Or maybe something I am doing wrong?

    Thanks in advance!
    Davy

    Hello

    Instead of select it in your trigger, you may submit a job, what does it for you. This work would not go until your table is created.

    Concerning
    Peter

  • Help me in creating a trigger Insert and Update Options

    Hello

    Please help me in creating a trigger.

    My requirement is that, after insert or update on a Table, I want to launch an event.

    I have started this way, but does not know how to fully implement it.

    I have a dept table


    CREATE TRIGGER DepartmentTrigger
    INSERT AFTER on Dept
    BEGIN
    INSERT INTO mytable VALUES("123","Kiran");
    END DepartmentTrigger;


    Please tell me how I can put the update option also.

    Thanks in advance.

    Please tell me how I can put the update option also.

    Add "or update". ;-)

    Here are a few suggestions, but you definitely need to refer to the manual page that suggested the previous poster.

    CREATE OR REPLACE the TRIGGER DepartmentTrigger
    AFTER INSERT or Update ON Dept
    BEGIN
    INSERT INTO mytable VALUES(:new.) Dept 'DEPT ADDED OR CHANGED');
    END DepartmentTrigger;

    The "or replace" means that you can replace the shutter button as you develop without having to type in a drop statement each time. Just change and reissue your script over and over again until you get it right.

    The addition of "update or" or "Or remove" fact the trigger too much fire for these events. Note, you peut want separate triggers in different scripts and with different names for each event. You must decide whether your design is really the same thing either an insert or an update.

    : new. Dept, this is how you should refer to the vale has changed the Dept column (: old.) Dept is the previous value). I changed the double quotes in the string in the clause VALUES of apostrophes.

    Andy

  • You want to capture update dates, with trigger on a view to refresh quickly materialized. But trigger on MV consider inserting and updates are inserts only.

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    PL/SQL Release 11.2.0.4.0 - Production

    CORE Production 11.2.0.4.0

    AMT for Linux: Version 11.2.0.4.0 - Production

    NLSRTL Version 11.2.0.4.0 - Production

    I create the structure of the table like that.

    create table test1 (a primary key, b (2) char number, date c, d varchar2 (10), date of e);

    create table test2 (number of ab, cd (2) tank, date of the ef, gh varchar2 (10), date of the ij, kl varchar2 (100));

    Create materialized view log on test1;

    create materialized view fast refresh test1_v on commit in select * from test1;

    I have create a trigger of the sample

    CREATE OR REPLACE TRIGGER test1_trig

    AFTER INSERT OR UPDATE OR DELETE

    ON test1_v

    FOR EACH LINE

    DECLARE

    lr_test2 test2% ROWTYPE;

    lv_error VARCHAR2 (4000);

    BEGIN

    lr_test2. AB: =: NEW.a;

    lr_test2. CD: =: NEW.b;

    lr_test2. GH: =: NEW.d;

    IF THE INSERTION

    THEN

    lr_test2. EF: = SYSDATE;

    lr_test2.IJ: = SYSDATE;

    lr_test2.KL: = 'INSERT ';

    INSERT INTO test2

    VALUES lr_test2;

    ELSIF UPDATE

    THEN

    lr_test2.IJ: = SYSDATE;

    lr_test2.KL: = 'UPDATE ';

    UPDATE test2 = lr_test2 ab WHERE = LINE: OLD.a;

    ELSIF REMOVAL

    THEN

    DELETE FROM test2

    AB = WHERE: old.a;

    END IF;

    EXCEPTION

    WHILE OTHERS

    THEN

    lv_error: = SQLERRM;

    INSERT INTO XXDOMINO_FG_DATA_LOAD_ERROR

    VALUES ('test1_trig',

    : OLD.a,.

    "test1_trig,"

    LV_ERROR,

    SYSDATE);

    COMMIT;

    END test1_trig;

    /

    So, if check you my code,.

    When I insert EF = SYSDATE, IJ = SYSDATE.

    Update EF is not changed, IJ = SYSDATE.

    So I like to capture their insertion and update dates.

    But if updates or insert arrives on the materialized table. The trigger themselves as an INSERT only.

    So how do you capture the updates?

    I use the statemnet with out merger with performance and also able to capture the update dates.

    CREATE OR REPLACE TRIGGER test1_trig_merge

    AFTER INSERT OR UPDATE OR DELETE

    ON test1_v

    FOR EACH LINE

    DECLARE

    lr_test2 test2% ROWTYPE;

    lv_error VARCHAR2 (4000);

    BEGIN

    IF THE REMOVAL

    THEN

    DELETE FROM test2

        AB = WHERE: old.a;

    ELSIF INSERTION

    THEN

    MERGE INTO test2 one

    B using (SELECT 1 FROM DUAL)

    WE (ab =: new.a)

    WHEN MATCHED

    THEN

    UPDATE the VALUE ab =: NEW.a.

    CD =: NEW.b,

    GH =: NEW.c

    IJ = SYSDATE,

    KL = "Update"

    AB WHERE =: old.a

    WHEN NOT MATCHED

    THEN

    INSERTING VALUES (: NEW.a,)

    : NEW.b,.

    : NEW.c.

    : NEW.d,.

    : NEW.e,.

    "INSERT");

    END IF;

    EXCEPTION

    WHILE OTHERS

    THEN

    lv_error: = SQLERRM;

    INSERT INTO XXDOMINO_FG_DATA_LOAD_ERROR

    VALUES ('test1_trig',

    : OLD.a,.

    "test1_trig,"

    LV_ERROR,

    SYSDATE);

    END test1_trig_merge;

    /

    DISPLAY ERRORS;

  • Essbase Studio impossible to 'Examining the sample data' in the Oracle DB Data Source

    E.M.P. version 11.1.2.3.500

    Oracle DB 11.2.0.4

    on Windows 2008R2

    I created a user DB ESSTBC with the following user privileges

    CREATE SESSION, CREATE TABLE, CREATE TRIGGER, CREATE TYPE, CREATE VIEW

    This is my first attempt on the Essbase Studio, so I executed the following scripts as the user ESSTBC to create the TBC tables and load the data

    tbc_create_oracle. SQL

    tbc_sampledata. SQL

    I am able to connect with ESSTBC and select the tables all loaded and made sure the data is loaded correctly

    Then in the Studio of Essbase, I created a data source, which I can list all the tables in the schema ESSTBC in 'Data Source Navigator'. I also managed to create a Minischema by joining the tables SALES, SCENARIO, and MEASURES.

    However, in "Data Source Navigator" when I select "SCENARIO", right click and select "View Sample Data", I am able to pull data from the table. that is the table with all the names of columns grid but no data. No error messages were shown in "Messages to the Console.

    Back to Developer SQL and connect the same DB as ESSTBC, I have no problem do a "SELECT * SCRIPT;" and recover all the data of the table without a problem.

    I proceed creating dimensions elements then a hierarchy of "SCENARIO". But again when I try to get a glimpse of the hierarchy has got an empty tree. Apparently, there's something wrong,

    No matter what mark on what I missed?

    Thank you very much.

    Problem solved. The cause being my stupidity ruin a access DB. I can see examples of data without changing anything in Essbase Studio after you change the DB user rights.

  • Trigger errors

    Hi guys,.

    Im very new to sql and oracle. and im trying to create a trigger - but unfortunately its not okay! Here is my code


    CREATE OR REPLACE TRIGGER "SHOP_ERRORS".
    Before you INSERT or update on the SHOP current_status
    BEGIN
    Select current_status in the STORE
    of the new. SHOP_id SHOP_id =

    IF (shop_status = ("CLOSED")) THEN
    RAISE_APPLICATION_ERROR)
    NUM = >-20000,
    Msg = > "Cannot reopen a trade union monopoly");


    END IF;
    END;

    IM basically trying to check when a user adds a new log entry for the shop that they do not try to reopen a store that is closed. and im getting the following errors

    5 7 PL/SQL: ORA-00933: SQL not correctly completed command
    2 1 PL/SQL: statement ignored
    11 11 PLS-00103: encountered the symbol "IF" when expecting one of the following numbers: ///this is followed by a random string of operators


    any help would be appricaited, I know this may be totally wrong - but I read and research on the triggers in the extent possible and im still stuck!

    Thanks in advance

    Well, if you do not want to change the structure of the DB and want to handle this programmatically, then you will need to reproduce the functionality of trigger manually:

    A sample:

    create or replace Function MANUAL_TRIGGER(p_shop_id IN varchar2) return number is
    
    v_shop_id shop.shop_id%type;
    v_status shop_log.current_status%type;
    
    Begin
    
    select shop_id into v_shop_id from SHOP where shop_id = p_shop_id FOR UPDATE WAIT 1;
    
    select current_status into v_status from SHOP_LOG where shop_id = p_shop_id and date_time =
        (select max(date_time) from SHOP_LOG where shop_id = p_shop_id);
    
    if upper(v_status) = 'CLOSED' then
        rollback;
        return 0;
    else
        insert into shop_log (log_id,......) values (.........);
        commit;
        return 1;
    end if;
    
    EXCEPTION
        when others then
             rollback;
             return 0;
    End MANUAL_TRIGGER;
    

    Explanation:
    Assuming SHOP_ID's PK in the table in the SHOP, the function creates a lock of line over the COUNTER for the SHOP_ID for which he's updated status.
    -Lock line
    -Check the latest status
    -If the status is closed, then rollback to release the lock and return with the error (0 return)
    -If the State is not closed, then insert the record in SHOP_LOG and agree to release the lock and return with success (1 return)

    In the calling function, use the values returned by the function above to check the conditions of success and mistakes and act accordingly.

    It is just a code example and not fully tested ready to the use of code, so please edit according to your needs.

    I hope this helps.

    Kind regards
    Roufy Sharma :)

    Published by: Stanley Sharma on December 6, 2009 23:23

Maybe you are looking for

  • Distortions of the screen when using Firefox on Android

    Hi, a recurring problem - when using Firefox on my Android Web site, are often distorted. If I try to zoom before to increase the size of police or image during playback, the screen breaks and distorts, with different sections of text and images disa

  • Qosmio F55 - gel after 20 minutes of idle

    Hi and sorry for my English When I use it, everything is ok, but after 20 minutes of inactivity it is suspended, ctrl, alt del doesn't respond, only is to turn the power button off / stop. I changed driver VGA, disable hard disk turn off, turn off sc

  • How can I lock the desktop icons?

    I can't LOCK the icon on my desktop items. I clicked right on the desktop and via the locking elements checked properties, but they are easily moved and NOT locked. I tried to lock in "Appearances and themes", but they will NOT lock. How can I get th

  • Win XP: What type of VCD, I need to use to create a startup disk?

    Hello My PC could not write the DVD disc, he could only write a VCD disc. When you create a boot disk, can I know what size disk of memory should I use? If I replace my hard drive (drive C) and after format, can I restore just copy all the files from

  • Watch is not the right amount of RAM

    When I look at the system information, it displays the correct amount. When I look at the Task Manager, it shows only 2.3 GB on my 4 GB. And Yes, the information system shows the 4 GB for some reason any. My problem is less than 3/4 GB barrier and mo