LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  DB Execute with exception handling

    Employee
    Posted 07-08-2014 18:34

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Patman

    I am using DB Execute for dropping a table.
    It works fine but it returns an error in the node whenever the table does not exist which is what I do not want.

    Anyone knows how to handle such error? Thanks

    SQL:

    drop table Temp_table


  • 2.  RE: DB Execute with exception handling

    Employee
    Posted 07-09-2014 07:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    You could first query the database (in another node) to see if the table exists, an then decide whether to execute the DROP node based upon the result from the first node.

    In Oracle:
    select TABLE_NAME from sys.all_tables where TABLE_NAME='Temp_Table'

    If this outputs a record then the table exists. So connect this output of this to the DROP node.


  • 3.  RE: DB Execute with exception handling

    Employee
    Posted 07-09-2014 19:03

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Patman

    Thanks, I'll do that.

    I was hoping there would be some catch statement or return value from the sqlNonSelect since the node can already discern there was an error.

    sqlNonSelect("drop table Temp_table")

    Anyway, your suggestion works also.

    Thanks!