Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Brain Teaser -- Shouldnt be too difficult for an expert

Re: PL/SQL Brain Teaser -- Shouldnt be too difficult for an expert

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 5 Feb 2003 12:57:12 -0800
Message-ID: <92eeeff0.0302051257.7d1eb064@posting.google.com>


programguru_at_hotmail.com (DG) wrote in message news:<5c45388c.0302050721.268dcb7f_at_posting.google.com>...
> This can only be done in PL/SQL.
>
> I have a table with two fields. Each value has a corresponding
> priority number with it. A sample table is below:
>
> Values, Priorities
> a1 1
> a2 15
> a3 10
> .
> .
> a15 2
>
> I am passing 30 arguments to a procedure. They are as follows:
> (value1, priority1, value2, priority2......., value15, priority15)
> These values will update the table above, however i need to make sure
> that all priorities are unique.
>
> What is the best way to determine that there are no duplicate priority
> numbers?
>
>
> Any ideas how to go about this?

Unique constraint and exception handling inside the procedure can take care of this.

alter table <name> add constraint <name> unique (Priorities);

In your procedure after the update/insert statement, ....
Exception
  when other then

Regards
/Rauf Sarwar Received on Wed Feb 05 2003 - 14:57:12 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US