How to bypass an exception error that occurs in Oracle when invoked through ASP.net code

I have a program that reads a oracle table and parse the data into various sub tables

The problem i am facing is that when an error occurs while tranforming the data to the sub tables, i need the program to continue processing the remainder of the records . How do i do implement this.

Here is a code i use to insert to sub tables.  When an error occurs while inserting a record to this table, i need it to continue on....

 Public Sub InsertDiversity(ByVal lEngagementID As Long, ByVal sScopeDiversity As String)

        Dim oDataAccess As New DataAccess, oReader As OracleDataReader
        Dim sSQL, sSQLQuery As String
        Dim lSeqID As Long
        Try
            lSeqID = oDataAccess.ExecuteInsertReturnKeyByRef("ENGAGEMENT_DIVERSITY_ID_SEQ")
            sSQL = "INSERT INTO DIVERSITY   ( ENGAGEMENT_DIVERSITY_ID ,ENGAGEMENT_ID,DIVERSITY_LIST,CREATE_DATE ) " & _
                           "VALUES(" & lSeqID & "," & lEngagementID & ",'" & oGeneric.clearSingleQuote(sScopeDiversity) & "', sysdate )"
            '  sSQLQuery = "INSERT INTO ENGAGEMENT_DIVERSITY_SQL   ( ID,SQLQUERY) VALUES( " & lSeqID & ",'" & sSQL & "')"
            ' oDataAccess.ExecuteNonQuery(sSQLQuery)
            AddtoFile(sSQL, "Diversity.txt")
            oDataAccess.ExecuteNonQuery(sSQL)
        Finally


            oDataAccess.Close()


        End Try



    End Sub
LVL 1
GSK_DEVAsked:
Who is Participating?
 
Carl TawnSystems and Integration DeveloperCommented:
You mean it throws the exception still ?

If so, just add an empty Catch block.

        Dim oDataAccess As New DataAccess, oReader As OracleDataReader
        Dim sSQL, sSQLQuery As String
        Dim lSeqID As Long
        Try
            lSeqID = oDataAccess.ExecuteInsertReturnKeyByRef("ENGAGEMENT_DIVERSITY_ID_SEQ")
            sSQL = "INSERT INTO DIVERSITY   ( ENGAGEMENT_DIVERSITY_ID ,ENGAGEMENT_ID,DIVERSITY_LIST,CREATE_DATE ) " & _
                           "VALUES(" & lSeqID & "," & lEngagementID & ",'" & oGeneric.clearSingleQuote(sScopeDiversity) & "', sysdate )"
            '  sSQLQuery = "INSERT INTO ENGAGEMENT_DIVERSITY_SQL   ( ID,SQLQUERY) VALUES( " & lSeqID & ",'" & sSQL & "')"
            ' oDataAccess.ExecuteNonQuery(sSQLQuery)
            AddtoFile(sSQL, "Diversity.txt")
            oDataAccess.ExecuteNonQuery(sSQL)
        Catch
            '// Don't do anything
        Finally

            oDataAccess.Close()

        End Try
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.