CodeIgniter Forums
Handle Exceptions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Handle Exceptions (/showthread.php?tid=26650)



Handle Exceptions - El Forum - 01-19-2010

[eluser]alejandronanez[/eluser]
Hey everybody it's me again.

I'm working with Oracle XE, I developed a form for creating new data on one of my tables but that table has a UNIQUE KEY restriction, and when I insert an existing record CI says this.


Quote:A Database Error Occurred

Error Number:


INSERT INTO "table" ("field2", "field3") VALUES ('name', 'last name')

How can I handle this exception?

Any suggestion?

Thanks!


Handle Exceptions - El Forum - 01-20-2010

[eluser]flaky[/eluser]
you can try transactions
or you could basically first make a select to check if the unique key exists then if it doesn't exist make the insert


Handle Exceptions - El Forum - 01-20-2010

[eluser]alejandronanez[/eluser]
Thanks!!! I'll try and I will tell you aboyut it. Thanks again!!!