NO updating table

  • I wrote this Stored Procedure in order to update a table, but it is not inserting anything...do you have any suggestion ???

    This is my Stored Procedure :

    CREATE PROCEDURE udp_LOT_Batch_Headers_Ins

    --PARAMETERS

    @p_Prod_Order udd_LOT_strProdOrder ,

    @p_SAP_Item_Code udd_LOT_strSAPItem ,

    @p_Quantity FLOAT ,

    @p_UOM udd_LOT_strUOM ,

    @p_Non_Conform_Flag CHAR (1) ,

    @p_Process_Tank_ID udd_LOT_strSAPLocn ,

    @p_Start_Time CHAR(24), -- ODBC Canonical: String formatted as: "yyyy-mm-dd hh:mi:ss.mmm " 24h

    @p_End_Time CHAR(24), -- ODBC Canonical: String formatted as: "yyyy-mm-dd hh:mi:ss.mmm " 24h

    @p_Login_Name udd_LOT_strUserName ,

    @p_Mix_Duration INT ,

    @p_Process_Time CHAR(24), -- ODBC Canonical: String formatted as: "yyyy-mm-dd hh:mi:ss.mmm " 24h ,

    @p_Prod_Order_Status CHAR (1) ,

    @p_Parent_Prod_Order udd_LOT_strProdOrder ,

    @p_Replace_Flag CHAR (1) ,

    @p_return_code INT OUTPUT

    /* return code is 0 for success, Negative for Error, Positive for Warning*/

    AS

    BEGIN -- begin of udp_LOT_Batch_Headers_Ins

    --Variable declarations

    DECLARE @v_start_time DATETIME

    DECLARE @v_end_time DATETIME

    DECLARE @v_process_time DATETIME

    -- Variable Initializations

    SET @v_start_time = CONVERT(datetime,@p_start_time,121)

    SET @v_end_time = CONVERT(datetime,@p_end_time,121)

    SET @v_process_time = CONVERT(datetime,@p_process_time,121)

    BEGIN TRANSACTION

    INSERT INTO udt_LOT_Batch_Headers(

    Record_ID, Prod_Order, SAP_Item_Code, Quantity, UOM, Non_Conform_Flag,

    Process_Tank_ID, Start_Time, End_Time, Login_Name, Mix_Duration,

    Process_Time, Prod_Order_Status, Parent_Prod_Order, Replace_Flag,

    Row_Status, Row_Created_Time, Row_Created_By, Row_Updated_Time, Row_Updated_By

    )

    VALUES (

    NEWID(), @p_Prod_Order ,@p_SAP_Item_Code, @p_Quantity, @p_UOM, @p_Non_Conform_Flag ,

    @p_Process_Tank_ID, @v_Start_Time, @v_End_Time, @p_Login_Name, @p_Mix_Duration ,

    @v_Process_Time, @p_Prod_Order_Status, @p_Parent_Prod_Order, @p_Replace_Flag ,

    'A',GETDATE(),@p_Login_Name,GETDATE(), @p_Login_Name )

    if @@error = 0

    BEGIN

    COMMIT TRANSACTION

    SET @p_return_code = 0 --Success

    RETURN(0)

    END

    else

    BEGIN

    ROLLBACK TRANSACTION

    set @p_return_code = -1 --ERROR

    Return (-1)

    END

    END -- end of udp_LOT_Batch_Headers_Ins

    GO

  • I forgot to mention that Stored Procedure return no error, and apparently execute the commit without update the database

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply