on 2016 Nov 08 4:48 AM
Hi
I have the following stored procedure
ALTER PROCEDURE dba.jg_x_new_pn @oldpn varchar(25)
AS
BEGIN
DECLARE @newpn varchar(25)
SET @newpn = string('78',dba.getnextprimary('primary_key'))
INSERT INTO dba.table1
SELECT opco_code,@newpn,proddesc,prodcateg,prodsell,discmat,sequence,obsolete,prodcost,replace(memo,'9010','9003'),qtytype,qtydecimal,qtyfactor,allowsplit,stocked,selldecimals,costdecimals,pack,altref1,altref2,altref3,altref4,privatememo,lastupdatedtimestamp,lastupdated,lastupdatedby,created,createdby,allowlinediscount,allowoveralldiscount,allowsettlementdiscount,saleprice,nextprice,salefrom,saleto,nextpricestart,vatcode,unitdescription,purchaseanalysis,salesanalysis,warranty,warrantydefault,defaultwarehouse,unitweight,unitweightdecimals,unitweightdesc,unitvolume,unitvolumedecimals,unitvolumedesc,prodtype,webcatalog,webprodref,webproddesc,webprodextdesc,weballowsplit,hazardsubstance,recipientrecordrequired,datenextavailable,qtyavailable,barcode,parentprodref,variationdesc,specification,sys_a_objects_key,purchasecurrency,purchasecost,purchasecostdecimals,cataloguecode,catalogueref,manufacturer,manufacturerref,templateprodref,isatemplate,binlocation,costcentre,department,webvalidation,deliverychargetype,excludefromoverallpromotion,defaultsupersededby,supersededqtyratio,supersededqtymultiply
FROM dba.table1
WHERE prodref = @oldpn
SELECT @newpn
INSERT INTO dba.table2 (id, prodref, notes)
VALUES (getNextPrimary('primary_key_notes.id'), (SELECT @newpn), 'I MADE THIS')
END
COMMIT;
The first insert command runs fine, but the second INSERT command doesn't do anything. I was expecting it to INSERT a new line into table2 using the new part number (@newpn).
What am I doing wrong?
Request clarification before answering.
User | Count |
---|---|
82 | |
29 | |
9 | |
8 | |
7 | |
7 | |
7 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.