Solved

Oracle forms 6i

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

Title # Comments Views Activity
levels for reporting 5 65
Convert Oracle data into XML document 2 59
Determine Who is Runnig my Bash Shell Script 4 65
sort a spool into file output in oracle 1 22
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

863 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

20 Experts available now in Live!

Get 1:1 Help Now