Solved

Oracle forms 6i

Posted on 2009-07-06
7
759 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

778 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