Example 1: SqlHandle with simple SQL
The following code executes a simple UPDATE statement with the base.SqlHandle
API:
MAIN
DEFINE h base.SqlHandle
CONNECT TO "mydb"
LET h = base.SqlHandle.create()
CALL h.prepare("UPDATE t1 SET name = ? WHERE pk = ?")
CALL h.setParameter(1, "Scott")
CALL h.setParameter(2, "8723")
TRY
CALL h.execute()
CATCH
DISPLAY "Error detected: ", SQLCA.SQLCODE
END TRY
END MAIN