Cita:
CREATE PROCEDURE sp_AperturaSolicitud_Gas
@nSolicitudes Numeric(15) OUTPUT,
@nSolicitudes1 Numeric(15) = Null,
@nAgenci Smallint = Null,
@nTalleres Smallint = Null,
@nFinancieras Smallint = Null,
@nTipoCredito Smallint = Null,
@cPlaca varchar(10) = Null,
@cApePaterno varchar(50) = Null,
@cApeMaterno varchar(50) = Null,
@cNombres varchar(50) = Null,
@nTipoDocumento Smallint = Null,
@cNumDocumento varchar(12) = Null,
@dFechaNacimiento datetime = Null,
@cUsuarioRegistro Varchar(12) = null,
@nCalif01 smallint = null,
@nCalif02 smallint = null,
@nCalif03 smallint = null,
@nCalif04 smallint = null,
@nTotalEndeudam Numeric(11,2) = null,
@nNumBancosEndeuda smallint = null,
@nAñoFabrica smallint = null,
@dFechaSunarp datetime = null,
@dFechaSOAT datetime = null,
@cFlagCelular smallint = null,
@cFlagFondJub smallint = null,
@cFlaGVtaSoat smallint = null,
@cFlagSegVida smallint = null,
@cFlagOtros smallint = null,
@cFlagSegVehic smallint = null,
@cFlagSegMed smallint = null,
@nImpFondJub Numeric(11,2) = null,
@nImpSegMed Numeric(11,2) = null,
@nImpSegVida Numeric(11,2) = null,
@nImpVtaSOAT Numeric(11,2) = null,
@nImpCelular Numeric(11,2) = null,
@nImpOtros Numeric(11,2) = null,
@cGlosaOtros Varchar(100) = null,
@nImpSegVehic Numeric(11,2) = null,
@nMtoConversion Numeric(11,2) = null,
@nMtoReparacion Numeric(11,2) = null,
@nMtoVehiculo Numeric(11,2) = null,
@nMtoCuotaInicial Numeric(11,2) = null,
@nTipoCliente smallint = null,
@cFlagCliente1 char(1) = null,
@cFlagCliente2 char(1) = null,
@cFlagCliente3 char(1) = null,
@dFechaVigDocCon datetime = null,
@nCuoMenComp Numeric(11,2) = Null,
@nTipoVehic Smallint = Null,
@nCliAsoc Smallint = Null,
@dFechaVigTit Datetime = Null
AS
Declare @nResultado integer
BEGIN
BEGIN TRANSACTION AperturaSolicitud
If @nSolicitudes1 = 999999
BEGIN
SELECT @nSolicitudes = nULTNRO
FROM CorrelProductos
WHERE nTIPDOC = @nFinancieras
--
UPDATE CorrelProductos
SET nULTNRO = nULTNRO + 1
WHERE nTIPDOC = @nFinancieras
IF (@@ROWCOUNT < 1) OR (@@ERROR <> 0)
BEGIN
ROLLBACK TRANSACTION AperturaSolicitud
RETURN (1)
END
--
@nSolicitudes Numeric(15) OUTPUT,
@nSolicitudes1 Numeric(15) = Null,
@nAgenci Smallint = Null,
@nTalleres Smallint = Null,
@nFinancieras Smallint = Null,
@nTipoCredito Smallint = Null,
@cPlaca varchar(10) = Null,
@cApePaterno varchar(50) = Null,
@cApeMaterno varchar(50) = Null,
@cNombres varchar(50) = Null,
@nTipoDocumento Smallint = Null,
@cNumDocumento varchar(12) = Null,
@dFechaNacimiento datetime = Null,
@cUsuarioRegistro Varchar(12) = null,
@nCalif01 smallint = null,
@nCalif02 smallint = null,
@nCalif03 smallint = null,
@nCalif04 smallint = null,
@nTotalEndeudam Numeric(11,2) = null,
@nNumBancosEndeuda smallint = null,
@nAñoFabrica smallint = null,
@dFechaSunarp datetime = null,
@dFechaSOAT datetime = null,
@cFlagCelular smallint = null,
@cFlagFondJub smallint = null,
@cFlaGVtaSoat smallint = null,
@cFlagSegVida smallint = null,
@cFlagOtros smallint = null,
@cFlagSegVehic smallint = null,
@cFlagSegMed smallint = null,
@nImpFondJub Numeric(11,2) = null,
@nImpSegMed Numeric(11,2) = null,
@nImpSegVida Numeric(11,2) = null,
@nImpVtaSOAT Numeric(11,2) = null,
@nImpCelular Numeric(11,2) = null,
@nImpOtros Numeric(11,2) = null,
@cGlosaOtros Varchar(100) = null,
@nImpSegVehic Numeric(11,2) = null,
@nMtoConversion Numeric(11,2) = null,
@nMtoReparacion Numeric(11,2) = null,
@nMtoVehiculo Numeric(11,2) = null,
@nMtoCuotaInicial Numeric(11,2) = null,
@nTipoCliente smallint = null,
@cFlagCliente1 char(1) = null,
@cFlagCliente2 char(1) = null,
@cFlagCliente3 char(1) = null,
@dFechaVigDocCon datetime = null,
@nCuoMenComp Numeric(11,2) = Null,
@nTipoVehic Smallint = Null,
@nCliAsoc Smallint = Null,
@dFechaVigTit Datetime = Null
AS
Declare @nResultado integer
BEGIN
BEGIN TRANSACTION AperturaSolicitud
If @nSolicitudes1 = 999999
BEGIN
SELECT @nSolicitudes = nULTNRO
FROM CorrelProductos
WHERE nTIPDOC = @nFinancieras
--
UPDATE CorrelProductos
SET nULTNRO = nULTNRO + 1
WHERE nTIPDOC = @nFinancieras
IF (@@ROWCOUNT < 1) OR (@@ERROR <> 0)
BEGIN
ROLLBACK TRANSACTION AperturaSolicitud
RETURN (1)
END
--