What is sub-program in SQL?
Sub-program is a programming unit which is created in a database to perform some tasks on data.
Basic usages of sub-program?
Create
CREATE PROCEDURE or CREATE FUNCTION
Delete
DROP PROCEDURE or DROP FUNCTION
Two kinds of sub-program:
PROCEDURE: perform an action but NOT return a value, but we can get output value by OUT variables.
and FUNCTION: compute and return a value
Create procedure:
Create function:
What is cursor?
A cursor holds the rows (one or more) returned by a SQL statement.
Triggers are stored programs, which are automatically executed or fired when some events occur.
A database transaction is an atomic unit of work that may consist of one or more related SQL statements.
Crystal report in MySQL (current version Crystal report 2013). It is a business intelligence tool to provide report from a data source.
Sub-program is a programming unit which is created in a database to perform some tasks on data.
Basic usages of sub-program?
Create
CREATE PROCEDURE or CREATE FUNCTION
Delete
DROP PROCEDURE or DROP FUNCTION
Two kinds of sub-program:
PROCEDURE: perform an action but NOT return a value, but we can get output value by OUT variables.
and FUNCTION: compute and return a value
Create procedure:
CREATE [OR REPLACE] PROCEDURE procedure_name [(parameter_name [IN | OUT | IN OUT] type [, ...])] {IS | AS} BEGIN < procedure_body > END procedure_name;
Create function:
CREATE [OR REPLACE] FUNCTION function_name [(parameter_name [IN | OUT | IN OUT] type [, ...])] RETURN return_datatype {IS | AS} BEGIN < function_body > END [function_name];
What is cursor?
A cursor holds the rows (one or more) returned by a SQL statement.
Triggers are stored programs, which are automatically executed or fired when some events occur.
CREATE [OR REPLACE ] TRIGGER trigger_name {BEFORE | AFTER | INSTEAD OF } {INSERT [OR] | UPDATE [OR] | DELETE} [OF col_name] ON table_name [REFERENCING OLD AS o NEW AS n] [FOR EACH ROW] WHEN (condition) DECLARE Declaration-statements BEGIN Executable-statements EXCEPTION Exception-handling-statements END;
A database transaction is an atomic unit of work that may consist of one or more related SQL statements.
Crystal report in MySQL (current version Crystal report 2013). It is a business intelligence tool to provide report from a data source.
Comments
Post a Comment