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: tojo <Tojo_at_hotmail.com>
Date: Wed, 5 Feb 2003 17:21:53 +0100
Message-ID: <MPG.18ab5890bb4e63f29896f3@news.t-online.de>


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.

Received on Wed Feb 05 2003 - 10:21:53 CST

Original text of this message

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