Scope of an SQL Object
An SQL object can be instantiated only from PeopleCode.
This object can be used anywhere you have PeopleCode, that is, in an application class, Application Engine PeopleCode, record field PeopleCode, and so on.
Your SQL statements sometimes change the database. When your SQL changes the database, your code should be only in one of the following events:
Application Engine PeopleCode action