Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Location
    Bangalore
    Posts
    2

    Angry Unanswered: WHEN-BUTTON-PRESSED trigger

    Hello,
    I am trying to create a form for hospital management, this form has few fields and buttons like ADD, UPDATE, SEARCH and EXIT.

    The functionality of the form would be to add a new record to the database when the ADD button is clicked. Update would be to update the details and search would be to query the form given any one of the parameter. Exit would be to exit the form.

    Under the ADD button I have created a WHEN-BUTTON-PRESSED trigger. The code written under this trigger is as below:
    BEGIN
    INSERT INTO PATIENT_ENTRY_TABLE (REGISTRATION_NUMBER,
    PATIENT_NAME,
    PATIENT_ADDRESS,
    MARITAL_STATUS,
    FATHERS_NAME,
    REGISTRATION_DATE,
    CITY,
    TELEPHONE_NUMBER,
    GENDER,
    STATUS,
    AGE )
    VALUES('& REGISTRATION_NUMBER &',
    '& PATIENT_NAME &',
    '& PATIENT_ADDRESS &',
    '& MARITAL_STATUS &',
    '& FATHERS_NAME &',
    '& REGISTRATION_DATE &',
    '& CITY &',
    '& TELEPHONE_NO &',
    '& GENDER &',
    '& STATUS &',
    '& AGE &');
    END;
    this code is compiled but when I execute the form I get an error ORA: 01722 WHEN-BUTTON_PRESSED unhandled execption.

    Please help me.
    Thanks in Advance
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Reading what you posted, I think that you should take some time and read documentation about Oracle Forms and/or attend training. Because, this is very far from how Forms work - both logic & code.

    First of all, it appears that you should have created a data block (i.e. the one based on a table). Use Data Block Wizard to do that. Then do NOT touch the form any more - just run it, and it will be fully functional - you'll be able to insert records, query records stored in a table, update them and delete them. Forms is smart enough to do that without you. No coding at all. None.

    There are cases when built-in functionalities aren't enough so you have to code *something*. INSERT statement might be used, but not the way you did it. Where did you find such a syntax? What is '& CITY &' supposed to do? Form item's value is referenced with a colon in front of item name:
    Code:
    insert into some_table (some_col)
      values (:block_name.some_item_name);
    Seriously, educate yourself.

  3. #3
    Join Date
    Apr 2012
    Location
    Bangalore
    Posts
    2

    Thank You for your Advice

    Thank You for ur advice.

    I am very new to the Oracle forms. The syntax I tried is the one used in Microsoft Visual Studioto design Forms. I just wanted to try if the same thing would apply here too.

    But I now have learnt from my mistake. I have learnt something new.
    Thank You for replying.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    If you built the form in Visual Studio using VB.NET then your VB sytax is fine. I'd be willing to bet that some of the data you were inserting wasn't compatible with the column data types. To test my theory try to insert a row with a single 1 in every column.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •