Oracle Create Table if it does not exist

前端 未结 4 1058
渐次进展
渐次进展 2020-12-11 03:36

Can anyone point me to the right syntax to use in order to create a table only if it does not currently exist in the database?

I\'m currently programming a Java GUI

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-11 03:50

    try
    {
        // insert query for insert new record in your table 
    }
    catch(Exception Ex)
    {
        //if it throw exception then catch it
    
         int s=Ex.getErrorCode(); // check it for 903 error
    
         //903 is table not existing error in oracle11g
    
     // then create your new table here otherwise if table present then record get stored in database
    }
    

提交回复
热议问题