Solved

Oracle forms 6i

Posted on 2009-07-06
7
755 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.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Oracle Pivot 2 32
EXECUTE IMMEDIATE 5 34
Concat multi row values of a field in oracle 6 35
SQL Retrieve Values 4 42
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
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 set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

707 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now