Need help on trigger...

i'm the beginner in Oracle, need help on below.
can i use statement like "Select count..." in the before and after update trigger?
i have the "mutating" error when i create the trigger...
pls help

correction - there is no error generated when compile the trigger but errors when the trigger is fired:
/* perform updating on table student*/
update student set company_id = 60 where student_id = 9998;
/* error return by oracle sql plus*/
at line 1:
4091: table SCOTT.STUDENT is mutating, trigger/function may not see it
6512: at "SCOTT.UST_UPDPASSPORTPROGRAM", line 7
6512: at "SCOTT.UST_UPDPASSPORTPROGRAM", line 9
4088: error during execution of trigger 'SCOTT.UST_UPDPASSPORTPROGRAM'
/* trigger script*/
create or replace trigger ust_updPassportProgram
before update
on student
for each row
declare
v_total_Student number;
Dummy number;
/*CURSOR Dummy_cursor (CNo NUMBER) IS*/
/*SELECT company_id FROM company WHERE company_id = CNo;*/
CURSOR Dummy_cursor (CNo NUMBER) IS
SELECT student_id FROM student WHERE student_id = 9998 and company_id = CNo;
begin
OPEN Dummy_cursor (:new.company_id);
FETCH Dummy_cursor INTO Dummy;
IF Dummy_cursor%FOUND THEN
dbms_output.put_line('Dummy found');
end if;
if :new.passport_program = 'Y' then
dbms_output.put_line('The current company_id: ' ||
to_char(:new.company_id) || :new.passport_program);
end if;
end;
/

Similar Messages

  • Need help with trigger for whitespace and caps validation

    I need to create a table trigger that will generate an error whenever a specific column does not contain all caps or has whitespace when records are either inserted or updated. I'm new to writing SQL, so any help is appreciated!

    In 10g
    SQL> create or replace trigger trigg_sample
      2  before update or insert on sample
      3  for each row
      4  declare
      5  lv_pos number;
      6  begin
      7  select regexp_instr(:new.col1,'[a-z|( )]') into lv_pos from dual;
      8  if lv_pos > 0 then
      9  raise_application_error(20000,'The column contains lowercase or white space characters');
    10  end if;
    11  end;
    12  /
    Trigger created.
    SQL> desc sample;
    Name                                      Null?    Type
    COL1                                               VARCHAR2(20)
    SQL> insert into sample values('DFD') ;
    1 row created.
    SQL> insert into sample values('dfdfd') ;
    insert into sample values('dfdfd')
    ERROR at line 1:
    ORA-21000: error number argument to raise_application_error of 20000 is out of
    range
    ORA-06512: at "XLS_ADMIN.TRIGG_SAMPLE", line 6
    ORA-04088: error during execution of trigger 'XLS_ADMIN.TRIGG_SAMPLE'
    SQL> insert into sample values('DFDF ') ;
    insert into sample values('DFDF ')
    ERROR at line 1:
    ORA-21000: error number argument to raise_application_error of 20000 is out of
    range
    ORA-06512: at "XLS_ADMIN.TRIGG_SAMPLE", line 6
    ORA-04088: error during execution of trigger 'XLS_ADMIN.TRIGG_SAMPLE'
    SQL>

  • I need help! TRIGGER PROBLEM.

    I have a case where I am checking for conflict do to date/times in table "MAINT".
    if an ID that is changed or added in table "SCHEDULE", I need to change the corresponding id in table MAINT, if that change make the id go into conflict, meaning that the start_time and the end_time of the NEW record is in the start and end time of the :OLD record, then I set the conlict flag in the MAINT table to "Y". If the change takes an ID out of conflict, then I set the conflict flag in the MAINT table to "N". Basically my algorithm is:
    1. get the OLD.id conflict record
    2. get a cursor of all records except the old id conflict record.
    3. compare the old id conflict recordd start and end times in the cursor, if there is a conflict in times, then update the record in the cursor and the old_id conlict to 'Y'.
    4. get the new_id record (the one that changed).
    5. Get the cursor of the new id records except the one that changed.
    6. compare the new record to the cursor start and end times.
    7. If conflict, update the new record and the one that it has a conflict with.
    8. if not a conflict, update the new record.
    I hope you can figure out what I am trying to say in a a generic sort of way.

    I am sorry...
    The trigger that I tried to come up with is:
    CREATE OR REPLACE TRIGGER trgupdate_resource_id AFTER
    UPDATE OF resource_id ON maintenance_resource_req FOR EACH ROW
    DECLARE pragma autonomous_transaction;
    BEGIN
    UPDATE resource_schedules
    SET resource_schedules.resource_id = :NEW.resource_id
    WHERE resource_schedules.resource_id = :OLD.resource_id
    AND resource_schedules.maintenance_id = :OLD.maintenance_id
    AND resource_schedules.step_number = :OLD.step_number;
    IF :OLD.resource_id = :NEW.resource_id THEN
    IF :OLD.maintenance_id = :NEW.maintenance_id THEN
    IF :OLD.step_number = :NEW.step_number THEN
    IF((:NEW.scd_start BETWEEN :OLD.scd_start
    AND :OLD.scd_end)
    AND(:NEW.scd_end BETWEEN :OLD.scd_start
    AND :OLD.scd_end)) THEN
    :NEW.conflict := 'Y'
    ELSE
    :NEW.conflict := 'N'
    END IF;
    END IF;
    END IF;
    END;
    END;
    the table structures:
    "MAINTENANCE_RESOURCE_REQ"
         "MAINTENANCE_ID" NUMBER NOT NULL ENABLE,
         "STEP_NUMBER" NUMBER NOT NULL ENABLE,
         "RESOURCE_ID" NUMBER,
         "PREVIOUS_RESOURCE_ID" NUMBER,
         "CONFLICT" VARCHAR2(1)
    "RESOURCE_SCHEDULES"
    "RESOURCE_SCHED_ID" NUMBER NOT NULL ENABLE,
    "RESOURCE_ID" NUMBER NOT NULL ENABLE,
    "MAINTENANCE_ID" NUMBER,
    "STEP_NUMBER" NUMBER,
    "SCD_START" DATE,
    "SCD_END" DATE
    Sample data:
    RESOURCE_ID START_TIME END_TIME CONFLICT
    1 08:00 09:00 Y
    2 08:00 09:00 N
    3 10:00 11:00 N
    1 08:45 09:15 Y

  • NEED HELP WITH TRIGGER????

    THIS IS TWO TABLE I NEED
    CREATE TABLE "METHODS_LIVE"
    "ID" INTEGER NOT NULL,
    "OBJECTID" INTEGER NOT NULL,
    "LA_KEY" VARCHAR(255) NULL,
    "PROCEDURENAME" VARCHAR(255) NULL,
    "LA_ORDER" INTEGER NOT NULL,
    "TAG" VARCHAR(255) NULL,
    PRIMARY KEY ("ID")
    CREATE TABLE "METHODS_NAME_LIVE"
    "METHODID" INTEGER NOT NULL,
    "LANGUAGE" INTEGER NOT NULL,
    "NAME" VARCHAR(255) NULL,
    PRIMARY KEY ("METHODID", "LANGUAGE")
    ALTER TABLE "METHODS_NAME_LIVE"
    ADD FOREIGN KEY ("METHODID")
    REFERENCES "METHODS_LIVE" ("ID")
    ON DELETE CASCADE;
    I WANT TO REMOVE THE ON DELETE CASCADE AND REPLACE IT BY THIS TRIGGER
    CREATE OR REPLACE trigger tr_del_meth_live before delete
    on METHODS_LIVE referencing old as DELETEDMETHODS_LIVE
    for each row
    begin
    DELETE from METHODS_NAME_LIVE
    where METHODS_NAME_LIVE.METHODID = ELETEDMETHODS_LIVE.ID;
    end;
    WHY I GOT THIS MESSAGES--->
    ORA-04094: table TESTLA2.METHODS_NAME_LIVE is constraining, trigger may not modify it
    ORA-06512: at "TESTLA2.TR_DEL_METH_LIVE", line 5
    ORA-04088: error during execution of trigger 'TESTLA2.TR_DEL_METH_LIVE
    THANK'S

    Remove the foreign key, but u should implement the constraint by yourself in this case or do cascade delete operations on client side.
    null

  • Need help with trigger/new at pl/sql

    I would appreciate any help as I am new to PL/SQL and have run out of ideas.
    I am trying to write a trigger that when a user inserts a row into a table that records an ID, a clinic, and user initials, a second table is updated with that ID in the next available "slot" for that clinic.
    I wrote a procedure that does execute successfully with ID, user initials, and clinic hardcoded. I cannot create a trigger using the fields from the 1st table instead of the hardcoded values that compiles without errors.
    The tables in question are in another schema, but I have all priviledges on that schema.
    I have tried referencing the fields from table 1 in every way I can think of:
    1) :new.<field from table 1> and got:
    ORA-04082: NEW or OLD references not allowed in table level triggers
    2) :<field from table 1> and got
    PLS-00049: bad bind variable '<field name>'
    3) <field from table 1> , <table>.<field from table 1>, <schema>.<table>.<field from table> and got
    5/38 PL/SQL: ORA-00904: "N106CLINIC": invalid identifier
    14/44 PL/SQL: ORA-00904: "N106CLINIC": invalid identifier
    and
    5/38 PL/SQL: ORA-00904: "N106"."N106CLINIC": invalid identifier
    14/44 PL/SQL: ORA-00904: "N106"."N106CLINIC": invalid identifier
    and
    5/38 PL/SQL: ORA-00904: "CCRN"."N106"."N106CLINIC": invalid identifier
    14/44 PL/SQL: ORA-00904: "CCRN"."N106"."N106CLINIC": invalid identifier
    in addition to "SQL statement ignored".
    It does complain only about n106clinic, even though other fields referenced from the first table are n106id and n106init; n106clinic IS a valid field name in the n106 table...maybe this is just a compiler peculiarity.
    Here is the code for the trigger. N106 is the table where the user inserts a row and RAMBCYL is the table to be updated. CCRN is the schema that owns the two tables.
    create or replace trigger ccrn.aocylrand
    after insert
    on ccrn.n106
    declare l_accno number;
    begin
    select rambcyl.accno into l_accno
    from ccrn.rambcyl rambcyl
    where rambcyl.clinic=n106clinic and
    rambcyl.accno = (select min(r.accno)
    from ccrn.rambcyl r
    where r.id is null
    and r.clinic = n106clinic);
    update ccrn.rambcyl set id =n106id,
    randdt = sysdate,
    staff=n106init
    where ccrn.rambcyl.accno = l_accno and
    ccrn.rambcyl.clinic = n106clinic;
    end aocylrand;
    Thanks, Helen

    You cannot refer to the :old or :new column values in a statement level trigger, only in row-level triggers. I would suggest the following which does the update in a single statement:
    create or replace trigger ccrn.aocylrand
      after insert
      on ccrn.n106
      for each row  -- specifies a row-level trigger
    begin
      update ccrn.rambcyl r1
         set id = :new.n106id,
             randdt = sysdate,
             staff = :new.n106init
       where clinic = :new.n106clinic
         and accno = (select min(r2.accno)
                        from ccrn.rambcyl r2
                       where r2.id is null
                         and r2.clinic = r1.clinic);
    end aocylrand;

  • Need help with trigger comp err

    i'm new to forms and triggers. I am trying to do a simple "select into" from the "previous" record so I can see what was the value of a column was and bump it up by one. The code for a post_text_item trigger is:
    select
    anum
    from
    x
    where
    x.pageid = :pageid;
    the gist of the error is that the compile acts like it never heard of table "x", even though the form is built on table "x"! the err is - PDE-PSD001 - Could not resolve ref to unk program unit while loading block ...
    any thoughts??
    thanks in advance,
    Burt
    null

    Sudha -
    actually -
    if the table I mention in the trigger contains an Ordsys.Ordimage column, the trigger blows. I guess the little procedure builder guy cant deal with the intermedia stuff too well/at all. I created a view from the table with the image, but didn't include the image in the view. I referenced the view in the trigger and everything went just fine.
    thanks for your input
    burt
    null

  • Need help creating trigger with delete capabilities

    I have two tables:
    create table person(userid integer,
    lname varchar(20),
    fname varchar (20),
    phone_number varchar(12),
    email_address varchar(35),
    city varchar(20),
    zip_code varchar(20),
    department varchar(20),
    major_street varchar(20),
    cross_street varchar(20),
    notes varchar(100),
    Primary Key (userid));
    create table vehicle(car_id integer,
    make varchar(15),
    model varchar(20),
    year integer,
    gas_mileage integer,
    capacity integer,
    owner integer,
    primary key (car_id),
    foreign key (owner) references person (userid));
    I am trying to create a trigger that would delete all those records in vehicle whenever someone deletes a record in the person table. Here is the code that I run but it get a compilation error. Here is the the trigger text followed by the error:
    CREATE OR REPLACE TRIGGER ON_DELETE_PERSON
    AFTER DELETE ON person FOR EACH ROW
    BEGIN
    DELETE from vehicle
    where owner=userId;
    END;
    2/4 PL/SQL: SQL Statement ignored
    3/19 PL/SQL: ORA-00904: "USERID": invalid identifier
    Any suggestions?

    CREATE OR REPLACE TRIGGER ON_DELETE_PERSON
    BEFORE DELETE ON person FOR EACH ROW
    BEGIN
    DELETE from vehicle
    where owner=:old.userId;
    END;

  • Need help on which router to buy for my BB 8320

    Now i know 8320 is dated but at this point i am not planning to change anytime soon .
    So I have a router which is kinda old, it didnt really occur to me since it worked. When i got my bb 8320 i was in a hotel and i could connect through their wireless without any hassle. I could surf, use youtube, name it.
    When i got home i couldnt do anything, i spent countless nights trying to figure out waht was wrong then i realized its my router. If only BB said somethign it wont support old routers then i wouldve saved myself hours of self-loathing.
    Anyways I also have gone to my friends house, and i could connect to her linksys router without any hassle. i was the one who set her router up and we bought it this year. i didnt do anything special, configuration-wise or w/e.
    So NOW i am just going to buy a new router. I really need help!!!!
    I was wondering if this one is good:
    W311R Wireless-N Broadband Router
    W311R integrates the wireless AP, router, four-port switch and firewall in one, and increases over 4 times transmission range of ordinary 802.11g products. Compatible with IEEE802.11n (Draft 2.0) and IEEE802.11g/b standards, it can provide up to 150Mbps stable transmission rate. It is dedicated to SOHOs and students’ dormitory. In addition, URL and MAC address filtering can take it easy for parents and network administrator to manage network life, and QoS bandwidth control over specific computer’s downloading speed is supported as well. Moreover, UPnP and WMM support can smooth your MSN voice better, and the included Setup Wizard on CD-ROM will be easy and fast for non-savvy users to install the device and access to the Internet.
    Overview:
    * Includes router, wireless access point, four-port switch and firewall in one
    * Provides up to 150Mbps uploading and downloading speed
    * Supports two WPS (Wi-Fi Protected Setup) encryption methods: PBC and PIN
    * Compliant to IEEE802.11n, IEEE802.11g, IEEE802.11b, IEEE802.3 and IEEE802.3u standards
    * Supports far-distance transmission, 100 meters indoor, 400 meters outdoor (depends on the environments around)
    * Supports 64/128-bit WEP encryption, WPA and the latest WPA2 encryption security authentication
    * Supports RTS/CTS protocol and data partitioning function
    * Provides one 10/100Mbps Auto-Negotiation Ethernet WAN ports for WAN connection
    * Provides four 10/100Mbps Auto-Negotiation Ethernet LAN ports for LAN connections
    * Supports xDSL/Cable MODEM, static and dynamic IP in community networking
    * Supports remote/local Web management
    * Supports WMM to better smooth your voice and video
    * Supports SSID stealth mode and access control based over MAC address (up to 30 entries)
    * Supports Auto MDI/MDIX
    * Supports wireless Roaming technology and ensures high-efficient wireless connections
    * Supports auto negotiation/manual mode for 802.11b/802.11g/802.11n
    * Supports UPnP and DDNS
    * Supports Firefox 1.0, IE5.5 or above
    * Supports SNTP
    * Supports virtual server, DMZ host
    * Built-in firewall for hacker’s attack prevention
    * Supports DHCP server/client
    * Supports auto wireless channel selection
    * Supports the control over LAN access to Internet
    * Provides syslog to record the status of the router
    * Supports WDS wireless network extension
    * Supports QoS function
    Input Voltage Range
    AC 110~240V
    Output Voltage Range
    9V~1000mA
    Consumption
    20dbm
    Operating Temperature
    0? ~ 40?
    Storage Temperature
    -40? ~ 70?
    Operating Humidity
    10% ~ 90% RH non-condensing
    Storage Humidity
    5% ~ 90% RH non-condensing
    Antenna
    One Non-detachable external antenna (5dBi)
    Frequency Range
    2.4GHz-2.5GHz
    EVM
    -30dB
    Sensitivity
    54M:-74dBm@10% PER; 11M:-85dBm@8% PER; 6M:-88dBm@10% PER; 1M:-90dBm@8% PER
    Outdoor
    400m
    Indoor
    100m
    WLAN?LAN
    93Mbps
    WLAN?WLAN
    93Mbps
    Frequency Range
    2.4GHz
    Gain
    5dBi
    Nominal Impedance
    50
    Polarization
    Linear; Vertical
    Maximum Power
    1W
    * Vertical Beamwidth 360º

    Flip UltraHD.
    Shoots mp4 H264 format files. Fits in a shirt pocket and records 2 hrs worth of material to an internal card. Charges from your USB port as you download. If you are just trimming clips, you can use QT Pro without conversion. If you need to edit, convert to ProRes 720p30. Works like a dream.
    Just make sure you have it solidly placed when you pull the trigger as there is no image stabilization.
    Oh, and it is only $199 US.
    x

  • Need help to redesign legacy SQL Script

    Hello Experts,
    I have the below code which produces a CREATE TRIGGER statement. as of now this does for updating. I need to re-design this code to add for inserting and deleting as well. I just need help in the structuring wise. I can build the logic for inserting and updating inside. I want to know how i can continue to get for "inserting" and "deleting" as well.
    you will understand my question better if you go through main code, present output and required output format below.
    I know this is a bad design first of all. but the below code is a legacy one. so i cant change the entire structure of the code :-( all i can do is to continue designing it to add new changes. Hence sought help from you all.
    please help
    SQL CODE:
    WITH audit_tables
    AS
       (SELECT object_name,
               MIN (column_id) min_col,
               MAX (column_id) max_col
        FROM   user_objects o,
               user_tab_columns c
        WHERE  o.object_name = 'CHR_VAL_DESC_A_T'
        AND    o.object_name = c.table_name
        GROUP BY object_name
    SELECT txt
    FROM (
    SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
           '   AFTER INSERT ' || CHR(13) ||
           '   OR    UPDATE ' || CHR(13) ||
           '   OR    DELETE ' || CHR(13) ||
           '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
           '   FOR EACH ROW ' || CHR(13) ||
           ' DECLARE ' || CHR(13) ||
           ' BEGIN ' || CHR(13) ||
           ' IF updating THEN ' || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 1 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 2 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 3 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
              WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''I'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''I'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                   END
              END AS txt,object_name, 4 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT 'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
           object_name, 5 disp_order, 0
    FROM    audit_tables)
    ORDER BY object_name, disp_order, column_id
    PRESENT OUTPUT:
    CREATE OR REPLACE TRIGGER CHR_VAL_DESC_ADT_TRG
       AFTER INSERT
       OR    UPDATE
       OR    DELETE
       ON CHR_VAL_DESC_T
       FOR EACH ROW
    DECLARE
    BEGIN
    IF updating THEN
       INSERT INTO CHR_VAL_DESC_A_T
        TXN_ID,                                  
        TXN_TYP,                                 
        ADT_DTTM,                                
        CHR_VAL_DESC_ID,                         
        CHR_VAL_ID,                              
        LANG_ID,                                 
        DESC_ID,                                 
        O_CHR_VAL_DESC,                          
        N_CHR_VAL_DESC,                          
        O_TRANS_STATE,                           
        N_TRANS_STATE,                           
        CRTD_BY,                                 
        CRTD_DTTM,                               
        O_UPD_BY,                                
        N_UPD_BY,                                
        O_UPD_DTTM,                              
        N_UPD_DTTM,                              
        O_LOCK_NUM,                              
        N_LOCK_NUM                               
       VALUES
        1,                                       
        'I',                                     
        SYSDATE,                                 
        :NEW.CHR_VAL_DESC_ID,                    
        :NEW.CHR_VAL_ID,                         
        :NEW.LANG_ID,                            
        :NEW.DESC_ID,                            
        :OLD.CHR_VAL_DESC,                       
        :NEW.CHR_VAL_DESC,                       
        :OLD.TRANS_STATE,                        
        :NEW.TRANS_STATE,                        
        :NEW.CRTD_BY,                            
        :NEW.CRTD_DTTM,                          
        :OLD.UPD_BY,                             
        :NEW.UPD_BY,                             
        :OLD.UPD_DTTM,                           
        :NEW.UPD_DTTM,                           
        :OLD.LOCK_NUM,                           
        :NEW.LOCK_NUM);                          
    END CHR_VAL_DESC_ADT_TRG;
    REQUIRED OUTPUT FORMAT:
    CREATE OR REPLACE TRIGGER TRIGGER_NAME
       AFTER INSERT
       OR    UPDATE
       OR    DELETE
       ON TABLE_NAME
       FOR EACH ROW
    DECLARE
    BEGIN
    IF updating THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    IF inserting THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    IF deleting THEN
       INSERT TABLE_NAME
        list of column names                               
       VALUES
    END TRIGGER_NAME;

    can anyone please help?
    i tried adding with inserting and updating also..but when i tried to add deleting part the final output not comes in proper structure.
    WITH audit_tables
    AS
       (SELECT object_name,
               MIN (column_id) min_col,
               MAX (column_id) max_col
        FROM   user_objects o,
               user_tab_columns c
        WHERE  o.object_name IN ('CHR_VAL_DESC_A_T', 'CHR_VAL_A_T')
        AND    o.object_name = c.table_name
        GROUP BY object_name
    SELECT txt
    FROM (
    SELECT ' CREATE OR REPLACE TRIGGER ' || REPLACE(object_name,'_A_T') || '_ADT_TRG' || CHR(13) ||
           '   AFTER INSERT ' || CHR(13) ||
           '   OR    UPDATE ' || CHR(13) ||
           '   OR    DELETE ' || CHR(13) ||
           '   ON ' || REPLACE(object_name,'_A_T','_T') || CHR(13) ||
           '   FOR EACH ROW ' || CHR(13) ||
           ' DECLARE ' || CHR(13) ||
           ' BEGIN ' || CHR(13) ||
           *' IF inserting THEN '* || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 1 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 2 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 3 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
              WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    NULL'||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''I'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    NULL'||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''I'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                   END
              END AS txt,object_name, 4 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM(SELECT *' ELSIF updating THEN '* || CHR(13) ||
           '   INSERT INTO ' || object_name || CHR(13) ||
           '   (' txt, object_name, 5 disp_order, 0 column_id
    FROM audit_tables
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT 
            CASE
              WHEN max_col = column_id THEN
                '    '||column_name
              ELSE
                '    '||column_name || ','
              END AS txt, object_name, 6 disp_order, column_id
          FROM  audit_tables t,
                user_tab_columns C
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT '   )' || CHR(13) ||
           '   VALUES ' || CHR(13) ||
           '   (', object_name, 7 disp_order, 0
    FROM audit_tables t
    UNION ALL
    SELECT txt, object_name, disp_order, column_id
    FROM (SELECT
            CASE
             WHEN max_col = column_id THEN
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||');'
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||');'
                  WHEN min_col = column_id THEN
                    '    1'
                  WHEN column_id = 2 THEN
                    '     ''U'''
                  WHEN column_id = 3 THEN
                    '    SYSDATE'
                  ELSE
                  '    :NEW.'||column_name||');'
                END
              ELSE
                CASE
                  WHEN SUBSTR(column_name,1,2) = 'N_' THEN
                    '    :NEW.'||decode(substr(column_name,1,2),'N_',substr(column_name,3))||','
                  WHEN SUBSTR(column_name,1,2) = 'O_' THEN
                    '    :OLD.'||decode(substr(column_name,1,2),'O_',substr(column_name,3))||','
                  WHEN min_col = column_id THEN
                    '    1'||','
                  WHEN column_id = 2 THEN
                    '    ''U'''||','
                  WHEN column_id = 3 THEN
                    '    SYSDATE' ||','
                  ELSE
                    '    :NEW.'||column_name||','
                END
              END AS txt,object_name, 8 disp_order, column_id
          FROM audit_tables t,
               user_tab_columns c
          WHERE c.table_name = t.object_name
          ORDER BY c.column_id ASC)
    UNION ALL
    SELECT 'END IF;' || CHR(13) ||
           'END '||REPLACE(object_name,'_A_T') || '_ADT_TRG;' || CHR(13),
           object_name, 9 disp_order, 0
    FROM    audit_tables)
    ORDER BY object_name, disp_order, column_id)

  • Need Help with my Imessage

    i need help with my imessage i am using a Iphone 4 ios 6.1.3 but when i go to settings>message>send and reecieve. i only get the options Apple ID: and You can be reached by iMessage at: my current email and add another email. my question is how do i get it to where imessage uses my cell phone number instead of my Email i have looked all over the web and no luck......

    The hidden text should be sent for you automatically by the phone. From personal experience, this is automatic, but something has obviously tripped up somewhere on your phone.
    It appears from reading the documentation, I would first try signing out of your Apple ID by going to Settings > Messages > Send and Receive then press your Apple ID, and press Sign Out. Then sign back in. This should hopefully trigger a re-activation of your mobile number. Your mobile number should be assigned to your Apple ID on first sign-in so hopefully this signing in and out should trigger an automatic re-activation.
    Failing that, others have posted a reset of the phone, as does the support page I quoted. It appears this could be a last resort as a reset can be a bit of a pain (although if you Back your phone up via iTunes, you should be able to restore it to how it is currently). I would try the signing in and out method. Hopefully, fingers crossed, it should kick your phone back into action.

  • Need help on classical report

    hi friends i need help on classical reports,
    sold-party,
    material
    sales and distrubitutation channel ,division,
    incoming orders,order number,invoice ,credit,
    i need sub totals and final total of invoice and each customer should display in new page .

    Hi
    Use the Tables KNA1,VBAk,VBAP,VBRK and VBRP and design the report
    see the sample report using KNA1,VBAK and VBAP.
    REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
    HEADING.
    *TABLES DECLARATION
    TABLES : KNA1, VBAK, VBAP.
    *SELECT OPTIONS
    SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
    *INITIALIZATION
    INITIALIZATION.
    CUST_NO-LOW = '01'.
    CUST_NO-HIGH = '5000'.
    CUST_NO-SIGN = 'I'.
    CUST_NO-OPTION = 'BT'.
    APPEND CUST_NO.
    *SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN ON CUST_NO.
    LOOP AT SCREEN.
    IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
    MESSAGE E001(ZTJ1).
    ENDIF.
    ENDLOOP.
    *BASIC LIST SELECTION
    START-OF-SELECTION.
    SELECT KUNNR NAME1 ORT01 LAND1 INTO
    (KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
    FROM KNA1
    WHERE KUNNR IN CUST_NO.
    WRITE:/1 SY-VLINE,
    KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    KNA1-NAME1 UNDER 'NAME',
    61 SY-VLINE,
    KNA1-ORT01 UNDER 'CITY',
    86 SY-VLINE,
    KNA1-LAND1 UNDER 'COUNTRY',
    103 SY-VLINE.
    HIDE: KNA1-KUNNR.
    ENDSELECT.
    ULINE.
    *SECONDARY LIST ACCESS
    AT user-command.
    IF SY-UCOMM = 'IONE'.
    PERFORM SALES_ORD.
    ENDIF.
    IF SY-UCOMM = 'ITWO'.
    PERFORM ITEM_DET.
    ENDIF.
    *TOP OF PAGE
    TOP-OF-PAGE.
    FORMAT COLOR 1.
    WRITE : 'CUSTOMER DETAILS'.
    FORMAT COLOR 1 OFF.
    ULINE.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'NAME',
    61 SY-VLINE,
    63 'CITY',
    86 SY-VLINE,
    88 'COUNTRY',
    103 SY-VLINE.
    ULINE.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR SECONDARY LISTS
    TOP-OF-PAGE DURING LINE-SELECTION.
    *TOP OF PAGE FOR 1ST SECONDARY LIST
    IF SY-UCOMM = 'IONE'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'SALES ORDER DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'DATE',
    60 SY-VLINE,
    62 'CREATOR',
    85 SY-VLINE,
    87 'DOC DATE',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR 2ND SECONDARY LIST
    IF SY-UCOMM = 'ITWO'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'ITEM DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'SALES ITEM NO.',
    60 SY-VLINE,
    62 'ORDER QUANTITY',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *END OF PAGE
    END-OF-PAGE.
    ULINE.
    WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
    SY-PAGNO.
    SKIP.
    *& Form SALES_ORD
    *& FIRST SECONDARY LIST FORM
    FORM SALES_ORD .
    SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
    (VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
    FROM VBAK
    WHERE KUNNR = KNA1-KUNNR.
    WRITE:/1 SY-VLINE,
    VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
    40 SY-VLINE,
    VBAK-ERDAT UNDER 'DATE',
    60 SY-VLINE,
    VBAK-ERNAM UNDER 'CREATOR',
    85 SY-VLINE,
    VBAK-AUDAT UNDER 'DOC DATE',
    103 SY-VLINE.
    HIDE : VBAK-VBELN.
    ENDSELECT.
    ULINE.
    ENDFORM. " SALES_ORD
    *& Form ITEM_DET
    *& SECOND SECONDARY LIST FORM
    FORM ITEM_DET .
    SELECT VBELN POSNR KWMENG INTO
    (VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
    FROM VBAP
    WHERE VBELN = VBAK-VBELN.
    WRITE : /1 SY-VLINE,
    VBAP-VBELN UNDER 'SALES ORDER NO.',
    40 SY-VLINE,
    VBAP-POSNR UNDER 'SALES ITEM NO.',
    60 SY-VLINE,
    VBAP-KWMENG UNDER 'ORDER QUANTITY',
    103 SY-VLINE.
    ENDSELECT.
    ULINE.
    ENDFORM. " ITEM_DET
    REPORT demo_list_at_pf.
    START-OF-SELECTION.
    WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
    AT pf5.
    PERFORM out.
    AT pf6.
    PERFORM out.
    AT pf7.
    PERFORM out.
    AT pf8.
    PERFORM out.
    FORM out.
    WRITE: 'Secondary List by PF-Key Selection',
    / 'SY-LSIND =', sy-lsind,
    / 'SY-UCOMM =', sy-ucomm.
    ENDFORM.
    After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
    Secondary List by PF-Key Selection
    SY-LSIND = 14
    SY-UCOMM = PF06
    Example for AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
    WRITE: 'Basic List',
    / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
    WRITE 'Top-of-Page'.
    ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'TEST'.
    WRITE 'Self-defined GUI for Function Codes'.
    ULINE.
    ENDCASE.
    AT LINE-SELECTION.
    SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
    PERFORM out.
    sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'FC1'.
    PERFORM out.
    WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
    PERFORM out.
    WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
    PERFORM out.
    WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
    PERFORM out.
    WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
    PERFORM out.
    WRITE / 'Button FUN 5 was pressed'.
    ENDCASE.
    sy-lsind = sy-lsind - 1.
    FORM out.
    WRITE: 'Secondary List',
    / 'SY-LSIND:', sy-lsind,
    / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    Reward points for useful Answers
    Regards
    Anji

  • Need Help in SQL script

    hi guys ,
    Got a small question ,  Table(test) has 4 columns ID, NAME, Definition, Notes with some data in it.And ID is identity column. Now I have to add a new column called UID.
    ID     NAME       Definition   Notes       
    1                      xxx
              xxxxx        xxxx
    2                      xxx
              xxxxx    xxxx
    3                      xxx
              xxxxx    xxxx
    4                      xxx            xxxxx    
       xxxx 
    5                      xxx            xxxxx    
        xxxx 
    6                      xxx            xxxxx  
        xxxx 
    7                      xxx
               xxxxx    xxxx
    8                      xxx
               xxxxx    xxxx
     need to add a new column in table (test) called UID. Note that this is NOT an identity column like ID. Need to Create  a TRIGGER that will copy value of ID to UID ONLY upon creation of new name. If the test table is copied/migrated to different
    DB or server, the UID should not be overridden with the new value of ID.
    AcronyM_ID     NAME       Definition   Notes       acronym_uid
    1                       xxx
                 xxxxx
       xxxx          NULL
    2                       xxx
                 xxxxx
       xxxx          NULL
    3                       xxx
                 xxxxx
       xxxx          NULL
    4                       xxx              xxxxx    xxxx          NULL
    5                       xxx               xxxxx   xxxx        
     NULL
    6                       xxx               xxxxx   xxxx      
       NULL
    7                       xxx
                  xxxxx
       xxxx         NULL
    8                       xxx
                  xxxxx
       xxxx        NULL
    9                       xxx
                  xxxxx
       xxxx         9
    10                      xxx           xxxxx         xxxxx       10
    thanks
    sidhu

    hello siddu_123,
    per your description, it does not look like you need  either a trigger or another column to store acroymn_ID. since acroymn_id is an identity column, it cannot be updated. 
    if the database was migrated to different server either by backup restore method and data import\export method, you can still preserve the identity property on the column and hence you will have the same values.
    Hope it Helps!!

  • Need help with ext. SWF and XML

    I'm trying to create an External SWF to load into my main
    site (photography).
    Home | Portfolio | Published Work | Bio | Contact
    The SWF I want to load externally is Portfolio because it has
    5 sections
    Those 5 sections are:
    -Editorial
    -Adventure
    -Fly Fishing
    -Multimedia
    -Weddings
    I'm looking to keep this dynamic as possible, but I'm one of
    those guys who doesn't write code from scratch, but knows AS well
    enough to modify a base or a generic template if ever given. It
    would be easier to use one subsection as an example, which could be
    applied to all others.
    e.g. "Fly Fishing" 1-Main container; 5-10 thumbnails (1
    dyanamic thumbnailcontainer)
    - I don't know XML (but can modify it). basically having an
    ID tag for each image, possibly dynamically generate a thumbnail
    too. Also have a spot for dynamic text to load in (captions with
    multiple text lines for images upon onRelease - maybe this could be
    it's own MC that loads on top of the main photo container)
    - on (release) on a thumbnail: there would be a little
    information icon that would appear. If you mouse over, it would
    overlay a layer over that specific ID photo, and the text appear.
    RollOut it would fade out the layer above that specific ID photo.
    - Transition: FadeOut/Blur/Exposure Blur, something
    interesting to that nature.
    - Thumbnails: is it just easier to create thumbnail images
    manually, and just create a separate container?
    - Image folders: I would imagine each section would have
    it's own watch folder. For example "Fly Fishing" would be a folder
    "/swfImg_flyFishing/", but perhaps having one XML file.
    - XML file details
    id
    location
    caption summary
    title
    As you can see, if I had one template to build off of, I
    could repeat it self for the others. I need help and if there is a
    flash component (free or purchase) that does at least 70% of what I
    need, please share information. thank you!Portfolio

    I know doing a pushback to the client requires Flex Data
    Services, but since I don't use FDS I can't tell you exactly how.
    But look in the documentation about "pushing" data to the client.
    Once you've figured out how to do that, you can trigger that push
    once you've finished editing the xml file. You may want to ask over
    in the FDS forum.

  • Need Help with a Flash Web Project

    Hello, everyone. I am trying to use Flash to make a two-step
    system. I want the flash document to, first, allow a person to
    upload multiple image files and then, second, for the flash
    document be able to create a slideshow with the uploaded images and
    fade in and out from each image until the slideshow is over. I want
    it to be where the flash document creates its own slideshow with
    the images that are uploaded in the first step that I mentioned. I
    want it to do it completely on its own so I need to know how to
    give it the proper AI so that it can do this task.
    So, are there any tips that anyone has on how to do this? Can
    anyone tell me exactly how to do this? I really need help with this
    for my new website project. Thanks in advance, everyone!

    The problem with the text not appearing at all has to do with you setting the alpha of the movieclip to 0%.  Not within the movieclip, but the movieclip itself.  The same for the xray graphic, except you have that as a graphic symbol rather than a movieclip.  To have that play while inhabiting one frame you'll need to change it to a movieclip symbol.
    To get the text to play after the blinds (just a minor critique, I'd speed up the blinds), you will want to add some code in the frame where you added the stop in the blinds animation.  You will also need to assign instance names for the text movieclips in the properties panel, as well as place a stop(); in their first frames (inside).
    Let's say you name them upperText and lowerText.  Then the code you'd add at the end of the blinds animation (in the stop frame) would be...
    _parent.upperText.play();
    _parent.lowerText.play();
    The "_parent" portion of that is used to target the timeline that is containing the item making the command, basically meaning it's the guy inside the blinds telling the guy outside the blinds to do something.
    You'll probably want to add stops to the ends of the text animations as well.
    If you want to have the first text trigger the second text, then you'd take that second line above and place it in the last frame of the first text animation instead of the blinds animation.
    Note, on occasion, undeterminably, that code above doesn't work for some odd reason... the animation plays to the next frame and stops... so if you run into that, just put a play(); in the second frame to help push it along.
    PS GotoandPlay would actually be gotoAndPlay, and for the code above you could substitute play(); with gotoAndPlay(2);

  • Need help with the session state value items.

    I need help with the session state value items.
    Trigger is created (on After delete, insert action) on table A.
    When insert in table B at least one row, then trigger update value to 'Y'
    in table A.
    When delete all rows from a table B,, then trigger update value to 'N'
    in table A.
    In detail report changes are visible, but the trigger replacement value is not set in session value.
    How can I implement this?

    You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
    For example
    SELECT YN_COLUMN
    FROM My_TABLE
    INTO My_Page_Item
    WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
    If the value is showing in a report, make sure the report refreshes on reload of the page.
    Edited by: Bob37 on Dec 6, 2011 10:36 AM

Maybe you are looking for

  • How to share a bind variable across multiple view objects?

    Hi, Can someone tell me if it's possible to share a bind variable among multiple view objects within an application module? My web page displays data from different VOs on different regions. But all data should be controlled by the same bind variable

  • Cross Company Code Charging Against WBS

    I am trying to understand if Company Code A can charge against a WBS that was created by Company Code B.  In the scenario I am working with, we have a single controlling area with multiple company codes.  The people reside in Company Code A.  Product

  • Create new content type...

    Greetings all, I am trying to include the Word, PowerPoint and Excel content types in my document libraries so that when a user clicks the "New" drop down they can select which document they want to create.  However I seem to be running into some pro

  • ThinkStation E30, built-in Intel HD Graphics and 2560x1440 display

    I'm setting up a ThinkStation E30 w/ Intel HD Graphics and connecting it to an EIZO CG276 display. The EIZO display supports 2560x1440 but I'm only able to get 1920x1200 from the built-in graphics (Win7 64bit). Since the display only shipped with a D

  • Como recuperar os dados armazenados no icloud em um novo iphone?

    Como recuperar os dados armazenados no icloud em um novo iphone?