Solved

Oracle forms 6i

Posted on 2009-07-06
7
768 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

724 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