Need help with creating trigger using instead of insert.

Hi all,
I am trying to create a trigger that can read the inserted Mail data from table1 and check if the Mail data matches the Mail data from table2. If the Mail data matches the Mail data from table2 it will get the EmpID from table2 and insert it into table1
column EmpID. 
Here are table2 columns:
EmpID (int) Mail(varchar) Mail2(varchar)
101 [email protected] [email protected]
102 [email protected] [email protected]
table1 columns 
EmpID (int)(primary key) Mail(varchar) Mail2(varchar)
If I insert [email protected] into table1 column Mail, I would like it to get the value for the EmpID from table2 before actually inserting the record into table1, by matching the Mail from table1 = Mail from table2.
I am using ASP.Net to insert the records into Mail and Mail2.
How can I achieve that?
I appreciate any help.

There should be two SQL statements in the stored procedure in order to accomplish the task?
Ideally you need to include logic as a part of your insert procedure itself. You should have a standard insert stored procedure which should include this logic and should be used for all inserts.
Also if EmpID field has to have a non NULL value always you may better off creating a foreign key constraint from Table1 to Table2 on EmpID column to enforce the Referential Integrity.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Need help with create trigger based on more then 1 table and join.

    Hello,
    Here i have 3 tables
    1. Employee
    PERSON_ID
    1
    1
    N
    NUMBER
    None
    ORG_ID
    2
    N
    NUMBER
    Frequency
    LOC_ID
    3
    N
    NUMBER
    Frequency
    JOB_ID
    4
    Y
    NUMBER
    Height Balanced
    FLSA_STATUS_ID
    5
    Y
    NUMBER
    Frequency
    FULL_NAME
    6
    N
    VARCHAR2 (250 Byte)
    Height Balanced
    FIRST_NAME
    7
    N
    VARCHAR2 (20 Byte)
    Height Balanced
    MIDDLE_NAME
    8
    Y
    VARCHAR2 (60 Byte)
    Height Balanced
    LAST_NAME
    9
    N
    VARCHAR2 (40 Byte)
    Height Balanced
    PREFERRED_NAME
    10
    Y
    VARCHAR2 (80 Byte)
    None
    EMAIL
    11
    Y
    VARCHAR2 (250 Byte)
    None
    MAILSTOP
    12
    Y
    VARCHAR2 (100 Byte)
    None
    HIRE_DATE
    13
    N
    DATE
    None
    2. ems_candidate
    EMS_CANDIDATE_ID
    1
    1
    N
    NUMBER
    None
    EMS_JOB_ID
    2
    Y
    NUMBER
    Frequency
    NAME
    3
    N
    VARCHAR2 (255 Byte)
    Frequency
    EMAIL
    4
    Y
    VARCHAR2 (255 Byte)
    None
    TELEPHONE
    5
    Y
    VARCHAR2 (25 Byte)
    None
    EMS_SOURCE_ID
    6
    Y
    NUMBER
    Frequency
    RECEIVED_DATE
    7
    Y
    DATE
    Frequency
    COMMENTS
    8
    Y
    VARCHAR2 (4000 Byte)
    None
    3. employee_resources
    EMP_RES_ID
    1
    1
    N
    NUMBER
    None
    PERSON_ID
    2
    Y
    NUMBER
    Height Balanced
    CANDIDATE_ID
    3
    Y
    NUMBER
    Frequency
    EMP_START_DATE
    4
    Y
    DATE
    None
    CUSTOM_RESOURCE_FLAG
    5
    Y
    NUMBER (1)
    None
    RESOURCE_GROUP_ID
    6
    N
    NUMBER
    Frequency
    RESOURCE_STATUS_ID
    7
    N
    NUMBER
    Frequency
    GROUP_LOC_ID
    8
    N
    NUMBER
    Height Balanced
    ASSIGNED_JIRA
    9
    Y
    VARCHAR2 (250 Byte)
    None
    REVOKED_JIRA
    10
    Y
    VARCHAR2 (250 Byte)
    None
    CREATED_DATE
    11
    Y
    DATE
    SYSDATE
    None
    UPDATED_DATE
    12
    Y
    DATE
    None
    Now i want to create trigger when new record get inserted in employee table wanted to update person_id in employee_resources table.
    So i want to match ems_candidate.name with employee.full_name , ems_candidate.ems_job_id with employee.ems_job_id. And if it matched then update person_id in employee_resources table else through an exception and insert record in temp table.
    If anybody has an idea can u please help me.
    Thanks,
    Gayatri.

    I created below trigger
    CREATE TRIGGER emp_resources_upd_person_id
    AFTER INSERT ON ems.employee
    FOR EACH ROW
    BEGIN
        UPDATE ems.employee_resources
           SET person_id = :new.person_id
         WHERE candidate_id = (SELECT ems_candidate_id  
                                 FROM ems.ems_candidate cand, ems.employee emp
                                WHERE TRIM(UPPER(emp.first_name)) = TRIM(UPPER(SUBSTR (cand.name, 1, INSTR (cand.name, ' ') - 1)))
                                  AND TRIM(UPPER(emp.last_name)) = TRIM(UPPER(SUBSTR (cand.name,INSTR (cand.name, ' ') + 1,DECODE (INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' '),0,LENGTH (cand.name),(INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' ') - 1)))))
                                  AND emp.person_id = :new.person_id);
    EXCEPTION
      WHEN OTHERS THEN
        INSERT INTO ems.update_person_id_exception(person_id,first_name,last_name,full_name) VALUES(:new.person_id,:new.first_name,:new.last_name,:new.full_name);
    END;
    Now when i am trying to insert row in ems.employee  table it gives me an error
    ORA-04091
    table string.string is mutating, trigger/function may not see it
    Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.
    Action: Rewrite the trigger (or function) so it does not read that table.
    Can anybody please help me to come out from these error.
    Thanks,
    Gayatri.

  • I need help with Creating Key Pairs

    Hello,
    I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
    the class is :
    import java.io.*;
    import java.math.BigInteger;
    import java.security.*;
    import java.security.spec.*;
    import java.security.interfaces.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import au.net.aba.crypto.provider.ABAProvider;
    class CreateKeyPairs {
    private static KeyPair keyPair;
    private static KeyPairGenerator pairGenerator;
    private static PrivateKey privateKey;
    private static PublicKey publicKey;
    public static void main(String[] args) throws Exception {
    if (args.length != 2) {
    System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
    return;
    createKeys();
    saveKey(args[0],publicKey);
    saveKey(args[1],privateKey);
    private static void createKeys() throws Exception {
    Security.addProvider(new ABAProvider());
    pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
    pairGenerator.initialize(1024, new SecureRandom());
    keyPair = pairGenerator.generateKeyPair();
    privateKey = keyPair.getPrivate();
    publicKey = keyPair.getPublic();
    private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
    ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
    out.writeObject(key);
    out.close();
    the public key is:
    �� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�|  xpt Javaur [Ljava.lang.String;��V��{G  xp   q ~ ur [B���T�  xp   ��ccR}o���[!#I����lo������
    ����^"`8�|���Z>������&
    d ����"B��
    ^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
    How i can generated the key pairs in base 64 or binary????
    Thanxs for help me
    Luis Navarro Nu�ez
    Santiago.
    Chile.
    South America.

    I don't use ABA but BouncyCastle
    this could help you :
    try
    java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
    java.security.KeyPair kp = kg.generateKeyPair();
    java.security.Key pub = kp.getPublic();
    java.security.Key pri = kp.getPrivate();
    System.out.println("pub: " + pub);
    System.out.println("pri: " + pri);
    byte[] pub_e = pub.getEncoded();
    byte[] pri_e = pri.getEncoded();
    java.io.PrintWriter o;
    java.io.DataInputStream i;
    java.io.File f;
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
    o.println(new sun.misc.BASE64Encoder().encode(pub_e));
    o.close();
    o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
    o.println(new sun.misc.BASE64Encoder().encode(pri_e));
    o.close();
    java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
    StringBuffer keyBase64 = new StringBuffer();
    String line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
    keyBase64 = new StringBuffer();
    line = br.readLine ();
    while(line != null)
    keyBase64.append (line);
    line = br.readLine ();
    byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
    java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
    java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
    System.out.println("pub: " + pubKey);
    java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
    System.out.println("pri: " + priKey);
    catch(Exception e)
    e.printStackTrace ();
    }

  • I need help with creating PDF with Preview...

    Hello
    I need help with creating PDF documetns with Preview. Just a few days ago, I was able to create PDF files composed of scanned images (notes) and everything worked perfectly fine. However, today I was having trouble with it. I scanned my notebook and saved 8 images/pages in jpeg format. I did the usual routine with Preview (select all files>print>PDF>save as PDF>then save). Well this worked a few days ago, but when I tried it today, I was able to save it, but the after opening the PDF file that I have saved, only the first page was there. The other pages weren't included. I really don't see anything wrong with what I'm doing. I really need help. Any help would be greatly appreciated.

    I can't find it.  I went into advanced and then document processing but no batch sequence is there and everything is grayed out.
    EDIT: I realized that you cant do batch sequences in standard.  Any other ideas?

  • Need help with creating a brush

    Hi guys,
    I wanted to ask for help with creating a brush (even a link to a tutorial will be goon enough ).
    I got this sample:
    I've created a brush from it, and i'm trying to get this kind of result:
    but it's only duplicates it and gives me this result:
    Can someone help me please understand what i need to define in order to make the brush behave like a continues brush instead of duplicate it?
    Thank you very much
    shlomit

    what you need to do is make a brush that looks like the tip of a brush. photoshop has several already but you can make your own that will be better.
    get a paintbrush and paint a spot kind of like what you did but dont paint a stroke. make it look kindof grungy. then make your brush from that, making sure to desaturate it and everything.
    EDIT:
    oh, and if you bring the fill down to like 10-20% your stroke will look better

  • I need help with creating some formulas

    I'm not sure if anyone around here can help me, but I'm trying to create a Numbers document and need some help with creating a formula/function.
    I have a column of amounts and I would like to create a formula which deducts a percentage (11.9%) and puts the result in another column.
    If anyone can help me, it would be greatly appreciated.

    Here is an example that shows one way to do this:
    The original data is in column A.  In column B we will store formulas to adjust the amounts:
    1) select the cell where you want to formula (in this case cell B2)
    2) Type the "=" (equal sign):
    3) click cell A2:
    4) now type the rest of the formula which is: "*(100-11.9)/100"  that is asterisk, then open parenthesis, 100 minus eleven point nine close parenthesis forward slash  one hundred
    The Asterisk is the multiply operator  (times) and the forward slash is the division operator (divide)
    now hit return.  select cell B2 and hover the cursor over the bottom edge of the cell:
    drag the little yellow dot down to "fill" the formula down as needed.

  • Need help with creating template. Changes are not going through to index.html page

    Hi all,
    I have an issue with my template that I am creating and also a question about creating template Regions (Repeating and Editable).
    Somehow my changes to my index.dwt are not changing my index.html page.
    Also my other question is: For my top navigation bar and left navigation bar links, do I need to select and define each individual button or link as Repeating/Editable Region? or can I just select the whole navigation bar (the one on the top) etc...
    Below are my steps for creating my template...I am kinda fairly new to using DW and this is my first attempt to making a template following the DW tutorial CD that came with DW CS3.
    I appreciate any help with this...regards, Dano
    -Open my index.html file
    -File/save as template
    -Save
    -update links - yes
    -Select Repeating and Editable Regions (I selected the whole top navigation bar and selected Repeating Region and Editable Region, same with the left side navigation links)
    -File close all
    -Open the index.dwt
    -Save as and selected the index.html and chose to overide it..
    When I make changes to my index.dwt it is not changing the index.html
    I feel that I am missing some important steps here.....
    Website address
    www.defenseproshop.com

    Figured out

  • I am Stuck! Need Help With Multicast Streaming Using VLC Player

    I have a Multicast network topology shown below
    and my configs
    HUB ROUTER
    no ip domain lookup
    ip domain name primestarhotel.com
    ip multicast-routing
    interface Loopback0
    ip address 5.5.5.5 255.255.255.255
    ip pim sparse-dense-mode
    interface FastEthernet0/0
    ip address 200.0.0.2 255.255.255.240
    ip pim sparse-dense-mode
    ip virtual-reassembly
    speed 100
    full-duplex
    interface FastEthernet0/1.65
    description "Server Vlan"
    encapsulation dot1Q 65
    ip address 10.1.65.1 255.255.255.0
    ip pim sparse-dense-mode
    ip virtual-reassembly
    router ospf 200
    log-adjacency-changes
    network 5.5.5.5 0.0.0.0 area 0
    network 10.1.65.0 0.0.0.255 area 0
    network 200.0.0.0 0.0.0.15 area 0
    ip route 200.1.1.0 255.255.255.252 200.0.0.1
    ip route 200.2.2.0 255.255.255.252 200.0.0.1
    no ip http server
    no ip http secure-server
    ip pim send-rp-announce Loopback0 scope 6
    ip pim send-rp-discovery Loopback0 scope 6
    ISP ROUTER
    interface FastEthernet1/0
    interface FastEthernet1/1
    no switchport
    ip address 200.0.0.1 255.255.255.240
    ip pim sparse-dense-mode
    duplex full
    speed 100
    interface FastEthernet1/2
    no switchport
    ip address 200.1.1.1 255.255.255.252
    ip pim sparse-dense-mode
    duplex full
    speed 100
    interface FastEthernet1/3
    no switchport
    ip address 200.2.2.1 255.255.255.252
    ip pim sparse-dense-mode
    duplex full
    speed 100
    router ospf 200
    log-adjacency-changes
    network 200.0.0.0 0.0.0.15 area 0
    network 200.1.1.0 0.0.0.3 area 0
    network 200.2.2.0 0.0.0.3 area 0
    SPOKE 1 Router
    interface FastEthernet0/0
    ip address 200.1.1.2 255.255.255.252
    ip pim sparse-dense-mode
    speed 100
    full-duplex
    interface FastEthernet0/1
    no ip address
    ip pim sparse-dense-mode
    ip virtual-reassembly
    speed 100
    full-duplex
    interface FastEthernet0/1.12
    description "Workstation pc"
    encapsulation dot1Q 12
    ip address 10.1.12.1 255.255.255.0
    ip pim sparse-dense-mode
    router ospf 200
    log-adjacency-changes
    network 10.1.12.0 0.0.0.255 area 0
    network 200.1.1.0 0.0.0.3 area 0
    ip route 0.0.0.0 0.0.0.0 200.1.1.1
    SPOKE 2
    interface FastEthernet0/0
    ip address 200.2.2.2 255.255.255.252
    ip pim sparse-dense-mode
    speed 100
    full-duplex
    interface FastEthernet0/1
    ip address 10.2.22.1 255.255.255.0
    ip pim sparse-dense-mode
    speed 100
    full-duplex
    router ospf 200
    log-adjacency-changes
    network 10.2.22.0 0.0.0.255 area 0
    network 200.2.2.0 0.0.0.3 area 0
    ip route 0.0.0.0 0.0.0.0 200.2.2.1
    ip route 200.2.2.0 255.255.255.252 200.0.0.1
    I have implemented multicast on the network in a hub and spoke topology. i have set up ospf routing protocol and broadcast all network and can successfully ping.
    I am currently using VLC player as my media streaming server and client. i have set up rtp streaming from the HUb router using multicast ip 224.2.2.2 and unable to broadcast the multicast traffic across the spokes 1 and 2 PC's
    I have never used vlc player  never set up multicast network before and i am struggling with this and need help.
    these are my router configs below
    http://dl.dropbox.com/u/20145606/ip%20video%20config.txt
    Message was edited by: Louis Ojuwu

    I have edited the message and the configs and topology are visible above now. instead of the links i provided

  • Need Help With Military DTD Using FrameMaker 8

    Fellow Forum Members,
    I hope someone out there with experience in using Department of Defense DTDs with FrameMaker can contribute to this thread.
    Attached is the MIL STD 400051-2 DTD that needs to play with FrameMaker. Does anyone out there know where I could find FrameMaker templates already setup that comply and play with the MIL STD 400051-2 DTD standard? If the Department of Defense is freely distributing the MIL STD 400051-2 DTD, shouldn't somebody in the Department of Defense also be providing MIL STD 400051-2 FrameMaker Templates for free that are already setup?  I would greatly appreciate if anyone out there could provide an online source where I could download MIL STD 400051-2 FrameMaker templates.
    Lastly, can anyone out there clarify what the purpose of the entities are inside the "Charant" and "Boilerplate" folders?  The Department of Defense does not provide a readme file that define what the "Charant" and "Boilerplate" folders are about.
    Any info will be greatly appreciated. Thanks.

    I'll answer the specifics that I know about your questions, but please look at the post from Srini for additional info:
    1) Do i need to do full export using SYS/SYSTEM user.
    exp80 system/manager file=c:full.dmp log=c:\full.txt full=y consistent=yA full export will move as much information (metadata/data) as possible. In order to do a full export/import, you need to do this from a
    privileged account. A privileged account is one with EXP_FULL_DATABASE for export and IMP_FULL_DATABASE for import.
    2) Will there be any data corruption while export.The data in the objects that you are exporting is being read, nothing is written to user data. I'm not sure what this is available in 8.0.6,
    but if you need a consistent export, look to see if consistent=y is available in 8.0.6. All this means is that the dump file created will have
    consistent data in it.
    3) Is export/import the only method of migration/upgradation.If you are changing hardware, the only supported way from 8.0 to 10.2.0.4, that I know of, is using exp/imp.
    Hope this helps.
    Dean

  • Need help with database migration using export/import

    Hi,
    I am planning to do a database migration from 8.0.6 to 10.2.0.4. I am using export/import. Please answer some of my queries:
    1) Do i need to do full export using SYS/SYSTEM user.
    exp80 system/manager file=c:full.dmp log=c:\full.txt full=y consistent=y
    2) Will there be any data corruption while export.
    3) Is export/import the only method of migration/upgradation.
    Please help
    Thanks.

    I'll answer the specifics that I know about your questions, but please look at the post from Srini for additional info:
    1) Do i need to do full export using SYS/SYSTEM user.
    exp80 system/manager file=c:full.dmp log=c:\full.txt full=y consistent=yA full export will move as much information (metadata/data) as possible. In order to do a full export/import, you need to do this from a
    privileged account. A privileged account is one with EXP_FULL_DATABASE for export and IMP_FULL_DATABASE for import.
    2) Will there be any data corruption while export.The data in the objects that you are exporting is being read, nothing is written to user data. I'm not sure what this is available in 8.0.6,
    but if you need a consistent export, look to see if consistent=y is available in 8.0.6. All this means is that the dump file created will have
    consistent data in it.
    3) Is export/import the only method of migration/upgradation.If you are changing hardware, the only supported way from 8.0 to 10.2.0.4, that I know of, is using exp/imp.
    Hope this helps.
    Dean

  • Need help with creating custom form

    hi all,
    i'm working on creating a new form. it has 2 blocks for 2 tables. headers and lines tables. the headers table mostly have columns that are id's from other tables. i.e. customer_id, location_id etc.. in my screen, obviously i would not show the id's. i'll display the descriptions / names of the id's instead like customer_name for customer_id... but in order to do this i created a table that joins more than 2 tables. so in the block query data source name, i enter the name of this view.. then i add a ON-INSERT, ON-UPDATE, ON-DELETE triggers at block level and i call the corresponding package which does the insert, update and delete. i'm able to insert but update and delete causes a problem. "ORA-01445: cannot select ROWID from, or sample, a join.. ".. i'm thinking the reason is that when the form does an update or delete, it locks the record which causes the error.. also the reason i need the view is because i need to be able to query the customer_name in the screen instead of the customer_id... what i can't figure out is how i can make this work... or a work-around may be...
    can anyone help.
    thanks

    Matt Rasmussen wrote:
    You're right that the form is locking the record so you just need to control how it locks the record with an on-lock trigger. From the Oracle Applications Developer's Guide:
    page 3-9:
    When basing a block on a view, you must code ON–INSERT, ON–UPDATE, ON–DELETE, and ON–LOCK triggers to insert, update, delete, and lock the root table instead of the view.
    Most of the on-lock triggers I have written follow this template:
    <pre>     SELECT     field1, field2, field3
         INTO     :block.field3, :block.field2, :block.field3
         FROM     view
         WHERE     rowid = :block.row_id
         FOR UPDATE OF field1, field2, field3;</pre>
    I think once you've added this trigger, your form will work the way you want it.hi,
    i tried your suggestion but still get the same error.. anyways, here are the details of what i have so far.
    here's my table.
    CREATE TABLE XXPN_VR_VOL_HEADERS_ALL
      VOL_HEADER_ID     NUMBER,
      CUSTOMER_ID       NUMBER,
      LEASE_ID          NUMBER,
      LOCATION_ID       NUMBER,
      VAR_RENT_ID       NUMBER,
      PERIOD_SET_NAME   VARCHAR2(15 BYTE),
      PERIOD_NAME       VARCHAR2(15 BYTE),
      IMPORT_FLAG       VARCHAR2(1 BYTE),
      IMPORT_DATE       DATE,
      CALC_TYPE         VARCHAR2(30 BYTE),
      PASSTHROUGH_FLAG  VARCHAR2(1 BYTE),
      COMMENTS          VARCHAR2(2000 BYTE),
      CREATED_BY        NUMBER,
      CREATION_DATE     DATE,
      LAST_UPDATED_BY   NUMBER,
      LAST_UPDATE_DATE  DATE
    );here's my view.
    create or replace view xxpn_vr_vol_headers_v ( row_id
                                                  ,vol_header_id
                                                  ,customer_id
                                                  ,customer_name
                                                  ,lease_id
                                                  ,lease_name
                                                  ,lease_number
                                                  ,location_id
                                                  ,location_code
                                                  ,var_rent_id
                                                  ,var_rent_number
                                                  ,period_set_name
                                                  ,period_name
                                                  ,import_flag
                                                  ,import_date
                                                  ,calc_type
                                                  ,passthrough_flag
                                                  ,created_by
                                                  ,creation_date
                                                  ,comments
                                                  ,last_updated_by
                                                  ,last_update_date )
    as
      select xvvha.rowid
            ,xvvha.vol_header_id
            ,xvvha.customer_id
            ,hp.party_name
            ,xvvha.lease_id
            ,pl.name
            ,pl.lease_num
            ,xvvha.location_id
            ,loc.location_code
            ,xvvha.var_rent_id
            ,pvr.rent_num
            ,xvvha.period_set_name
            ,xvvha.period_name
            ,xvvha.import_flag
            ,xvvha.import_date
            ,xvvha.calc_type
            ,xvvha.passthrough_flag
            ,xvvha.created_by
            ,xvvha.creation_date
            ,xvvha.comments
            ,xvvha.last_updated_by
            ,xvvha.last_update_date
        from xxpn_vr_vol_headers_all xvvha
            ,hz_parties hp
            ,pn_leases_all pl
            ,pn_locations_all loc
            ,pn_var_rents_v pvr
       where -1 = -1
         and xvvha.customer_id = hp.party_id (+)
         and xvvha.lease_id = pl.lease_id (+)
         and xvvha.location_id = loc.location_id (+)
         and xvvha.var_rent_id = pvr.var_rent_id (+);here's my ON-UPDATE trigger block level
    begin
      xxpn_vr_vol_data_pkg.update_vr_vol_hdr_data ( p_vol_header_id     => :XXPNVRVOLHDRS.vol_header_id
                                                   ,p_customer_id       => :XXPNVRVOLHDRS.customer_id
                                                   ,p_lease_id          => :XXPNVRVOLHDRS.lease_id
                                                   ,p_location_id       => :XXPNVRVOLHDRS.location_id
                                                   ,p_var_rent_id       => :XXPNVRVOLHDRS.var_rent_id
                                                   ,p_period_set_name   => :XXPNVRVOLHDRS.period_set_name
                                                   ,p_period_name       => :XXPNVRVOLHDRS.period_name
                                                   ,p_import_flag       => :XXPNVRVOLHDRS.import_flag
                                                   ,p_passthrough_flag  => :XXPNVRVOLHDRS.passthrough_flag
                                                   ,p_comments          => :XXPNVRVOLHDRS.comments
                                                   ,x_last_updated_by   => :XXPNVRVOLHDRS.last_updated_by
                                                   ,x_last_update_date  => :XXPNVRVOLHDRS.last_update_date );
    end;here's my code in ON-LOCK trigger block level
    begin
      select lease_id
            ,lease_name
            ,lease_number
            ,location_id
            ,location_code
            ,customer_id
            ,customer_name
            ,var_rent_id
            ,var_rent_number
            ,period_name
            ,comments
            ,period_set_name
            ,import_flag
            ,passthrough_flag
            ,created_by
            ,creation_date
            ,last_updated_by
            ,last_update_date
        into :XXPNVRVOLHDRS.lease_id
            ,:XXPNVRVOLHDRS.lease_name
            ,:XXPNVRVOLHDRS.lease_number
            ,:XXPNVRVOLHDRS.location_id
            ,:XXPNVRVOLHDRS.location_code
            ,:XXPNVRVOLHDRS.customer_id
            ,:XXPNVRVOLHDRS.customer_name
            ,:XXPNVRVOLHDRS.var_rent_id
            ,:XXPNVRVOLHDRS.var_rent_number
            ,:XXPNVRVOLHDRS.period_name
            ,:XXPNVRVOLHDRS.comments
            ,:XXPNVRVOLHDRS.period_set_name
            ,:XXPNVRVOLHDRS.import_flag
            ,:XXPNVRVOLHDRS.passthrough_flag
            ,:XXPNVRVOLHDRS.created_by
            ,:XXPNVRVOLHDRS.creation_date
            ,:XXPNVRVOLHDRS.last_updated_by
            ,:XXPNVRVOLHDRS.last_update_date
        from xxpn_vr_vol_headers_v
       where rowid = :XXPNVRVOLHDRS.ROW_ID
         for update of lease_id
                      ,lease_name
                      ,lease_number
                      ,location_id
                      ,location_code
                      ,customer_id
                      ,customer_name
                      ,var_rent_id
                      ,var_rent_number
                      ,period_name
                      ,comments
                      ,period_set_name
                      ,import_flag
                      ,passthrough_flag
                      ,created_by
                      ,creation_date
                      ,last_updated_by
                      ,last_update_date;
    end;properties for the block
    Query Data Source Type: Table
    Query Data Source Name: XXPN_VR_VOL_HEADERS_V
    DML Target Type: Table
    DML Target Name: XXPN_VR_VOL_HEADERS_V
    i'd appreciate any help.
    thanks

  • Need Help With Redirect That Uses Session Variable

    I am new to dynamic sites, php, and developer toolbox, but I have been able to create a login site using the different form wizards fairly easily (in CS3 with Developers toolbox).
    <br />
    <br />I am trying to set a server behavior on a page that redirects the user to a new page if a session variable matches a recordset.
    <br />
    <br />I was using an extension (PHP Sessions - http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;extid=681308 ) that worked great, but when I installed developers toolbox, it stopped working (get error message about runtime/MX environment).
    <br />
    <br />Ive been struggling for days and this is what Ive come up with so far:
    <br />------------------------------------
    <br />session_start();
    <br />if (!isset($HTTP_SESSION_VARS[$_SESSION['kt_firstname']]) || $HTTP_SESSION_VARS[$_SESSION['kt_firstname']] = $row_Recordsetfname['firstname']) {
    <br /> header ("Location: ../firstname/firstname1.php");
    <br />}
    <br />------------------------------------
    <br />
    <br />It redirects regardless of the match. Any ideas on what I can do to get this working? Here is all of the code (with block from above inserted) up until the doc type:
    <br />------------------------------------
    <br /><?php require_once('../Connections/project1.php'); ?>
    <br /><?php<br />// Load the tNG classes<br />require_once('../includes/tng/tNG.inc.php');<br /><br />// Make unified connection variable<br />$conn_project1 = new KT_connection($project1, $database_project1);<br /><br />//Start Restrict Access To Page<br />$restrict = new tNG_RestrictAccess($conn_project1, "../");<br />//Grand Levels: Any<br />$restrict->Execute();<br />//End Restrict Access To Page<br /><br />if (!function_exists("GetSQLValueString")) {<br />function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") <br />{<br />  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;<br /><br />  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);<br /><br />  switch ($theType) {<br />    case "text":<br />      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br />      break;    <br />    case "long":<br />    case "int":<br />      $theValue = ($theValue != "") ? intval($theValue) : "NULL";<br />      break;<br />    case "double":<br />      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";<br />      break;<br />    case "date":<br />      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";<br />      break;<br />    case "defined":<br />      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;<br />      break;<br />  }<br />  return $theValue;<br />}<br />}<br /><br />// FELIXONE - 2002   SB by Felice Di Stefano - www.felixone.it<br />session_start();<br />if (!isset($HTTP_SESSION_VARS[$_SESSION['kt_firstname']]) || $HTTP_SESSION_VARS[$_SESSION['kt_firstname']] = $row_Recordsetfname['firstname']) {<br />  header ("Location: ../firstname/firstname1.php");<br />}<br /><br />$colname_Recordsetfname = "-1";<br />if (isset($_SESSION['kt_user_name'])) {<br />  $colname_Recordsetfname = $_SESSION['kt_user_name'];<br />}<br />mysql_select_db($database_project1, $project1);<br />$query_Recordsetfname = sprintf("SELECT firstname FROM registration WHERE user_name = %s", GetSQLValueString($colname_Recordsetfname, "text"));<br />$Recordsetfname = mysql_query($query_Recordsetfname, $project1) or die(mysql_error());<br />$row_Recordsetfname = mysql_fetch_assoc($Recordsetfname);<br />$totalRows_Recordsetfname = mysql_num_rows($Recordsetfname);<br /><br />$colname_Recordset1 = "-1";<br />if (isset($_SESSION['kt_user_name'])) {<br />  $colname_Recordset1 = $_SESSION['kt_user_name'];<br />}<br />mysql_select_db($database_project1, $project1);<br />$query_Recordset1 = sprintf("SELECT `Date` FROM registration WHERE user_name = %s", GetSQLValueString($colname_Recordset1, "text"));<br />$Recordset1 = mysql_query($query_Recordset1, $project1) or die(mysql_error());<br />$row_Recordset1 = mysql_fetch_assoc($Recordset1);<br />$totalRows_Recordset1 = mysql_num_rows($Recordset1);<br />?>
    <br />
    <br />------------------------------

    I am new to adobe toolbox... I ve created a ligin page but not sure how to pass the session variable. I am trying to direct successful login to a page like... index.php?id=filter
    <br />
    <br />been struggling all day with this. Please help!!!
    <br />
    <br /><?php require_once('Connections/comm.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("");<br /><br />// Make unified connection variable<br />$conn_comm = new KT_connection($comm, $database_comm);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$formValidation->addField("kt_login_user", true, "text", "", "", "", "");<br />$formValidation->addField("kt_login_password", true, "text", "", "", "", "");<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />// Make a login transaction instance<br />$loginTransaction = new tNG_login($conn_comm);<br />$tNGs->addTransaction($loginTransaction);<br />// Register triggers<br />$loginTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "kt_login1");<br />$loginTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$loginTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "{kt_login_redirect}");<br />// Add columns<br />$loginTransaction->addColumn("kt_login_user", "STRING_TYPE", "POST", "kt_login_user");<br />$loginTransaction->addColumn("kt_login_password", "STRING_TYPE", "POST", "kt_login_password");<br />$loginTransaction->addColumn("kt_login_rememberme", "CHECKBOX_1_0_TYPE", "POST", "kt_login_rememberme", "0");<br />// End of login transaction instance<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rscustom = $tNGs->getRecordset("custom");<br />$row_rscustom = mysql_fetch_assoc($rscustom);<br />$totalRows_rscustom = mysql_num_rows($rscustom);<br /><br />?>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <script src="includes/common/js/base.js" type="text/javascript"></script>
    <br />
    <script src="includes/common/js/utility.js" type="text/javascript"></script>
    <br />
    <script src="includes/skins/style.js" type="text/javascript"></script>
    <br /><?php echo $tNGs->displayValidationRules();?>
    <br />
    <br />
    <br />
    <br /><?php<br /> echo $tNGs->getLoginMsg();<br />?>
    <br /><?php<br /> echo $tNGs->getErrorMsg();<br />?>
    <br />
    <form method="post" id="form1" class="KT_tngformerror" action="%3C?php%20echo%20KT_escapeAttribute(KT_getFullUri());%20?%3E">
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <table cellpadding="2" cellspacing="0" class="KT_tngtable">
    <tr>
    <td class="KT_th">
    <label for="kt_login_user">Username:</label>
    </td>
    <td>
    <input type="text" name="kt_login_user" id="kt_login_user" value="<?php echo KT_escapeAttribute($row_rscustom['kt_login_user']); ?>" size="32" />
    <br /> <?php echo $tNGs->displayFieldHint("kt_login_user");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_user"); ?></td>
    </tr>
    <tr>
    <td class="KT_th">
    <label for="kt_login_password">Password:</label>
    </td>
    <td>
    <input type="password" name="kt_login_password" id="kt_login_password" value="" size="32" />
    <br /> <?php echo $tNGs->displayFieldHint("kt_login_password");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_password"); ?></td>
    </tr>
    <tr>
    <td class="KT_th">
    <label for="kt_login_rememberme">Remember me:</label>
    </td>
    <td>
    <input <?php if (!(strcmp(KT_escapeAttribute($row_rscustom['kt_login_rememberme']),"1"))) {echo "checked";} ?> type="checkbox" name="kt_login_rememberme" id="kt_login_rememberme" value="1" />
    <br /> <?php echo $tNGs->displayFieldError("custom", "kt_login_rememberme"); ?></td>
    </tr>
    <tr class="KT_buttons">
    <td colspan="2">
    <input type="submit" name="kt_login1" id="kt_login1" value="Login" />
    <br /></td>
    </tr>
    </table>
    <br />
    <a href="forgot_password.php">Forgot your password?</a>
    <br /></form>
    <br />
    <p>&#160;</p>
    <br />
    <br />

  • I need help with a trigger mutating a table

    I'll add the trigger I have written now at the bottom. Here is the problem that I have. We have employees and their families in an individual table.
    A family is indicated by matching client, branch, and emp_id. An employee is indicated by individual_num = 1. All other numbers indicate family members. A person is determined to be terminated by having a date other than '2299/12/31' (It's a varchar(10) and very very wrong. Don't ask...) in the termination date column.
    A family member can be terminated in the system independent of the rest of there family. However, if an employee is terminated then all active family members need the termination date set to the same date as the employee. If that termination date is then changed for the employee all family members with the same date need to have their dates updated.
    I understand why this causes table mutation but I need a work around. Any ideas? Please...
    CREATE OR REPLACE TRIGGER INDIV_EMP_TERM
    after update on INDIVIDUAL
    for each row
    begin
    if ( :new.INDIVIDUAL_NUM = 1 and :old.TERMINATION_DATE <> :new.TERMINATION_DATE ) then
    if ( :old.TERMINATION_DATE = '2299/12/31' ) then
         update INDIVIDUAL
              set TERMINATION_DATE = :new.TERMINATION_DATE
              where CLIENT = :new.CLIENT
              and BRANCH = :new.BRANCH
              and EMP_ID = :new.EMP_ID
              and INDIVIDUAL_NUM <> 1
              and TERMINATION_DATE = '2299/12/31';
         else
         update INDIVIDUAL
              set TERMINATION_DATE = :new.TERMINATION_DATE
              where CLIENT = :new.CLIENT
              and BRANCH = :new.BRANCH
              and EMP_ID = :new.EMP_ID
              and INDIVIDUAL_NUM <> 1
              and TERMINATION_DATE = :old.TERMINATION_DATE;
         end if;
    end if;
    end;

    Try your code like this below .It will help you to eliminate the mutating error
    create or replace PACKAGE test_update IS
    type row_type is table of rowid index by binary_integer;
    v_row row_type ;
    v_index binary_integer ;
    v_num integer := 0 ;
    flag integer := 1 ;
    END;
    create or replace trigger test_up
    before update
    on test123
    begin
    select USR_ID
    into test_update.v_num
    from test123 ;
    dbms_output.put_line ( 'before update '||test_update.v_num );
    test_update.v_index := 0;
    end ;
    create or replace trigger test_up_after
    after update
    on test123
    begin
    dbms_output.put_line ( test_update.v_index );
    test_update.flag := 0 ;
    for i in 1 .. test_update.v_index loop
    update test123
    set UPD_BY = nvl(test_update.v_num ,0),
    UPD_DATE = sysdate
    where rowid = test_update.v_row(i) ;
    end loop ;
    test_update.flag := 1 ;
    test_update.v_index := 0;
    end ;
    create or replace trigger test_1
    after update on test123
    for each row
    begin
    -- dbms_output.put_line ( 'after update test flag '||test_update.flag );
    if test_update.flag = 1 then
    test_update.v_index := test_update.v_index + 1 ;
    test_update.v_row(test_update.v_index) := :old.rowid ;
    end if ;
    end ;

  • New user - need help with PC Suite use

    Hello. I have a new Nokia 6233, and have installed the current version of PC Suite (6.84.10.4), but can't figure out how to make certain things work that seem like they should. I'm using Windows XP with Service Pack2, and am connecting my phone with my PC via Bluetooth.
    1) I have installed an application using the Install Applications component of PC Suite, and it now shows that the new app is on the phone -- but how do I actually get it from showing up in that category on PC suite to the actual phone?
    2) I have hundreds of phone numbers that migrated over poorly from my old Sony Ericsson via SIM, and would like to edit them on the PC instead of on the phone. However, I see nothing under Contacts in PC Suite. How do I get the PC to recognise the contacts on the phone? If I enter new ones on the PC, how do I get them to the actual phone?
    Thanks in advance if you can help!
    //Albie

    Hi,
    1) Do you mean that you can not find installed application from phone (or what)?
    2) Try to update Contacts folder -> open Nokia Phone Browser > "phone name" > Contacts > and press F5 button.
    Contacts folder includes also button for create a new contact and when you click "Save", it saves that in phone.
    BTW: if you contacts are in SIM card -> you have to copy those first in phone memory.

  • Need help with creating invoice and list of invoices

    Hello everybody,
    I need to create Credit / Debit memo invoices and for this I try to use FM GN_INVOICE_CREATE in my Z program, please let me know if it is correct way to go?
    As well I need to create list of Credit / Debit memo invoices, how to achieve this?
    Thanks in advance.
    Usefull answers will be awarded.
    Regards, M.

    You can use RV_INVOICE_CREATE for credit memo and debit memo
    list of credit and debit memo - use this FM - RV_INVOICE_LIST_CREATE
    see the below sample code
    refresh: XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS.
      clear  : XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS,
               VBSK_I.
      VBSK_I-SMART = 'F'.
      XKOMFK-VBELN =  v_deliv.
      XKOMFK-VBTYP = 'J'.
      APPEND XKOMFK.
      CALL FUNCTION 'RV_INVOICE_CREATE'
           EXPORTING
                VBSK_I       = VBSK_I
                WITH_POSTING = 'C'
           TABLES
                XKOMFK       = XKOMFK
                XKOMV        = XKOMV
                XTHEAD       = XTHEAD
                XVBFS        = XVBFS
                XVBPA        = XVBPA
                XVBRK        = XVBRK
                XVBRP        = XVBRP
                XVBSS        = XVBSS.
      if sy-subrc eq 0.
        COMMIT WORK.
       flag = 'X'.
      else.
      message i011 with p_vbeln.
      endif.
    Reward Points if it is helpful
    Thanks
    Seshu

Maybe you are looking for