1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

problem with trigger ,help .

Discussion in 'Oracle Forms and Reports' started by bony, May 6, 2009.

  1. bony

    bony Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    hello every one !
    im using form builder version 10.1.2.0.2 , oracle 10g .
    im making aproject for iron auto selling for subject at university , i have created the tables
    and now during making the forms -which take along time till i feel crazy-
    the problem is that i made afor for employees information to give the user the ability to check for employees through entering substring of there names and oracle gonna show the employees got the match .
    i make text box and button beside the button has when button pressed trigger i wrote the following :

    Code (SQL):
    DECLARE
       len   NUMBER := LENGTH (:text_item15);

       CURSOR SEARCH
       IS
          SELECT worker_id, wname
            FROM workers
           WHERE UPPER (SUBSTR (wname, 0, len - 1)) = UPPER (:text_item15);
    BEGIN
       IF ((:text_item15 IS NOT NULL))
       THEN
          OPEN SEARCH;

          LOOP
             FETCH SEARCH
              INTO :worker_id, :wname;

             EXIT WHEN search%NOTFOUND;
          END LOOP;
       END IF;
    END;
    and its compiled without error but no execution:mad:
    the form is connected to workers in database but i added departments , contact_info
    as none data base items and make trigger when validate item on name
    so that it will return these info when name validated .-for now this form is for checking- .
    as the following :

    Code (SQL):
    BEGIN
       SELECT descreption
         INTO :text_item11
         FROM departments, workers
        WHERE :worker_id = worker_id AND workers.dept_id = departments.dept_id;

       SELECT fax, phone, email, address
         INTO :text_item9, :text_item10, :text_item12, :text_item13
         FROM contact_info
        WHERE :worker_id = woker_id;
    END;
    its not working i enter name in the text box , but nothing work
    do help plz ? quick
    many thanks
     
  2. tyro

    tyro Forum Genius

    Messages:
    368
    Likes Received:
    20
    Trophy Points:
    260
    Location:
    India
    I am not an expert on Oracle Forms but why do you want to make a button to search. Why not just base your block on the employee table and users can enter the query mode and query the employee table with some characters and use % to match any string.
     
  3. bony

    bony Active Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    55
    i dont understand ur point , but there is other infomation about workers . in other tables
    which are :departments , contact info .
    to make it user friendly , end user can enter any substring and system make query according to the substing entered .

    can we use % with variables containg strings>
     
  4. salmankhalid

    salmankhalid Forum Advisor

    Messages:
    116
    Likes Received:
    6
    Trophy Points:
    260
    Location:
    Lahore, Pakistan
    what i think is this that you should use the proper exception handling in it or use the message feature to display the values of your fields at different points in your cursor, for this you make know problem why your sursor is not returning the value also you can debug your form by debugger to check where the actual problem exists

    cehkc this out first it will definitely help you if not then do inform us again.........
     
  5. NAVEED

    NAVEED Active Member

    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    55
    Location:
    karachi
    your concept is wrong I am sending your script after some changing you follow this query INSHALLAH your problem will be solve.
    Code (SQL):

    BEGIN
       SELECT descreption
         INTO :text_item11
         FROM departments, workers
        WHERE worker_id = :worker_id AND departments.dept_id = :workers.dept_id;

       SELECT fax, phone, email, address
         INTO :text_item9, :text_item10, :text_item12, :text_item13
         FROM contact_info
        WHERE worker_id = :woker_id;
    END;
     
  6. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    Hi Naveed thanks for the Query. I just formatted it with Toad's formatter Plus and Put it under the Highlight tags. :) (The one you get when you click on the SQL Button ) But I don't see any change in the query from the original poster's :confused: