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 newbie question....

Re: Pl/sql newbie question....

From: <smenard_at_avior.ca>
Date: Fri, 04 Oct 2002 16:24:32 -0400
Message-ID: <20021004.162428.1501252996.12214@avior.ca>


In article <Vmmn9.719$W83.60950778_at_newssvr13.news.prodigy.com>, "Karsten Farell" <kfarrell_at_medimpact.com> wrote:
that help...
thans a lot
> smenard_at_avior.com wrote:
>> What is the best way to implement the column count when i insert a new
>> row in this table...?
>
> For one thing, 'count' is a very poor choice for a column name. Unless
> you want to hardcode every value of 'inv_id' in your cursor, you need to
> pass an argument to the cursor containing the required value of inv_id
> (perhaps from another cursor or loop).
>
> Maybe something like:
>
> cursor test_cur (in_inv_id in inv_id%type) is
> select max(count_column_name)
> from inv
> where inv_id = in_inv_id
> for update of count_column_name;
> ...
> open test_cur (whatever_value_of_inv_id_required); fetch test_cur into
> nb_count;
> insert into inv values(
> whatever_value_of_inv_id_required,
> nb_count+1,...);
> close test_cur;
>
> ...[plus any other processing required]...
>
Received on Fri Oct 04 2002 - 15:24:32 CDT

Original text of this message

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