Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL Brain Teaser -- Shouldnt be too difficult for an expert
In article <5c45388c.0302050721.268dcb7f_at_posting.google.com>,
programguru_at_hotmail.com says...
> 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?
>
Forget about the 30 parameters. Write the 30 values into a table
(temporary if you want). You can put a unique constraint on this table's
priority column. Then just INSERT INTO real_table SELECT * FROM
temp_table. Wrap the whole thing in a transaction and go have a beer.
![]() |
![]() |