Solved

Oracle forms 6i

Posted on 2009-07-06
7
763 Views
Last Modified: 2013-12-19
Dear Expert,
Iam Developing a form in oracle 6i.
In that form i have a user entry block.
in that form the user is entering itemname,no ,......
And i have kept a commit button for the block.
When the user press the commit button.It has to validate the block.
if any duplicate entry is there it has to show a  alert.
Can anybody please send query for me.
0
Comment
Question by:daprjo
7 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 24789034
Is the entry block based on an existing table ?
Has the table a primairy and/or unique key  defined to prevent duplicatie entries ?

If both questions can be answered with yes , you can depend on the default behaviour of  oracle forms and the oracle databases :  the user wil get an error message.
Your job might be to modify the message in a friendly message for your user.

If not both questions can be answered with yes, try to explain in more detail what you want to do:
the when-validate-item, when-validate-record triggers are problaby the ones to use.


0
 

Author Comment

by:daprjo
ID: 24791271
Dear Expert,
If i press the commit button,
it has to loop through the block anf find out the duplicate entries. and show alert that this itemname   has entered for n times.
0
 
LVL 1

Expert Comment

by:gkhngkdmr
ID: 24792023
i hope, you have non-database block,
so,

to show your message, please create an ALERT object with MESSAGE name,

if your blockname is MYBLOCK,
please, write the following code into your button-trigger "WHEN-BUTTON-PRESSED"


it is possible for you to improve the following code.

------------------------------------

declare
  but varchar2(200);
 
begin
    go_block('MYBLOCK');
    first_record;
    loop
        begin    
          insert into <your_table> (a_column, b_cloumn)
          values (:MYBLOCK.a_clm, :MYBLOCK.b_clm);
        exception
           when dupvalonindex then
             set_alert_button("MESSAGE",alert_message_text,"write here your message");
             but := show_alert("MESSAGE");
        end;

        IF :system.last_record = 'TRUE' THEN
        EXIT;
      END IF;
    end loop;
end;

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:latorreconsultores
ID: 24794429
last comment is ur best aproach to ur solution.
0
 

Author Comment

by:daprjo
ID: 24795020
Dear Expert my block is a database block
and it has no primary key field.
Please help me .


Thanks & Regards,

Priya
0
 
LVL 1

Accepted Solution

by:
gkhngkdmr earned 500 total points
ID: 24795627
if your block is a database block and all items of the block are your db table  columns, and if your table does not have a primary key, you can use PRE-INSERT trigger.

Define the PRE-INSERT Trigger on your block.
in the PRE-INSERT trigger, you can check the data exists or not,

-- in the pre-insert trigger,
declare
   cursor c (p_column1 IN VARCHAR2, p_column2 IN VARCHAR2)  is
        select * from <your_table>
        where column1 = p_column1 and column2 = p_column2;
   r c%ROWTYPE;
begin
   open c( :MYBLOCK.a_clm, :MYBLOCK.b_clm);
   fetch c into r;
   if c%FOUND then
             raise form_trigger_failure;  
  end if;
  close c;
end;
0
 

Author Closing Comment

by:daprjo
ID: 31600311
Dear Expert,

Thanks a lot
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question