Article View: borland.public.interbase.sql
Article #122Re: insert into problem
From: Wayne Niddery (TeamB)
Date: Sun, 08 Jun 2008 03:32
Date: Sun, 08 Jun 2008 03:32
24 lines
1999 bytes
1999 bytes
"Isaac" <no@no.com> wrote in message news:484b16e4@newsgroups.borland.com... >> select max(item_code) from inventory_items >> where (inventory_items.inv_code = :p_to_inv_code) >> and (inventory_items.item_code = :p_item_code) >> into :v_max_item_code; >> >> if (v_max_item_code is null) then >> v_max_item_code = 1; >> else >> v_max_item_code = v_max_item_code + 1; >> >> insert into inventory_items (INV_CODE, ITEM_CODE, ITEM_NAME, CUR_QTY, >> MIN_QTY, OB_QTY, OB_TOTAL_COST, UNIT_PRICE, UNIT_COST) >> values (:p_to_inv_code, :v_max_item_code, >> :v_item_name, :v_cur_qty, 0, 0, 0, 0, 0); >> end Is this a multiuser system? If so, this method of getting a new key for a new record is very dangerous. Use a generaotr for new keys. -- Wayne Niddery - TeamB (www.teamb.com) Winwright, Inc. (www.winwright.ca)
Technical Details
Message-ID:
<484b52eb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<484b07da@newsgroups.borland.com> <484b16e4@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,ed255c09332ecd2c X-Google-Attributes: gid114a0e,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Wayne Niddery \(TeamB\)" <wniddery@chaffaci.on.ca> Newsgroups: borland.public.interbase.sql References: <484b07da@newsgroups.borland.com> <484b16e4@newsgroups.borland.com> In-Reply-To: <484b16e4@newsgroups.borland.com> Subject: Re: insert into problem Date: Sat, 7 Jun 2008 23:32:49 -0400 Lines: 25 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Windows Mail 6.0.6001.18000 X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000 NNTP-Posting-Host: 24.137.214.213 Message-ID: <484b52eb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1212895979 24.137.214.213 (7 Jun 2008 20:32:59 -0700) X-Authenticated-User: wniddery Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail