DROP PROCEDURE CopiaPRCLVLCUSTDETProc
GO
CREATE PROCEDURE CopiaPRCLVLCUSTDETProc
(	@CORRNBR int,
        @PRCLVLCUSTID	 UD_PRCLVLCUSTID
)
AS
BEGIN    
	BEGIN TRAN
	DECLARE   @ERROR	integer


       INSERT 	INTO 	TMP_OP_PRCLVLCUSTDET(CORRNBR,SITEID,DISCMTO,SLS_PRICE,SLS_PRICECUST,INVTIDSKU,DESCR)
		SELECT 	@CORRNBR,SITEID,DISCMTO,SLS_PRICE,SLS_PRICECUST,INVTIDSKU,DESCR
		FROM	OP_PRCLVLCUSTDET
		WHERE	PRCLVLCUSTID=@PRCLVLCUSTID

	IF (@@error!=0 OR @@ROWCOUNT=0 )
    	BEGIN
		ROLLBACK  
      		RETURN(1)
    	END
  COMMIT TRAN
  RETURN (0)

END


