On 3/06/2009 5:15 PM, robinsmathew wrote: > its showing an error near "if": syntax error
"it", my crystal ball tells me, is an SQL processor, behaving much as expected when fed what looks like an "if" statement in some other language ... > Kees Nuyt wrote: >> Pseudocode: google("pseudocode") >> BEGIN; >> UPDATE stock_tab SET ..... WHERE stock_id = 10000; >> if sqlite_error() >> INSERT INTO stock_tab SET (...) VALUES (...); >> endif >> COMMIT; Try this exploded version, written using functions in some arbitrary wrapper language, which you need to translate into whatever language you are using, supplying missing arguments like a connection and maybe a cursor, and adding error-checking where appropriate: exec_sql("BEGIN") exec_sql("UPDATE stock_tab SET ..... WHERE stock_id = 10000") if an_error_happened(): exec_sql("INSERT INTO stock_tab SET (...) VALUES (...)") exec_sql("COMMIT") HTH, John _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users