Monday, January 2, 2012

Requirements to use functions in SQL

1. Compatible data type (no Boolean, Record, Table, etc.)
2. Should be stored in the database
3. Only IN mode parameters
4. Positional notation only
5. SELECT: No DML statements on any tables in function
6. UPDATE, DELETE: no query, no modify referenced tables (mutating tables otherwise)
7. No transaction, session or system control language, no DDL (COMMIT, SET ROLE, ALTER SYSTEM, CREATE,  etc.)

Where functions can be used in SQL?
SELECT: column list as expressions on the column value, WHERE, GROUP BY, HAVING, ORDER BY; 
UPDATE: SET, WHERE
DELETE: WHERE
INSERT: VALUES

No comments:

Post a Comment