Search results
Results From The WOW.Com Content Network
Using an INSERT statement with RETURNING clause for PostgreSQL (since 8.2). The returned list is identical to the result of a INSERT. Firebird has the same syntax in Data Modification Language statements (DSQL); the statement may add at most one row. [2] In stored procedures, triggers and execution blocks (PSQL) the aforementioned Oracle syntax ...
Stored procedures can also be invoked from a database trigger or a condition handler. For example, a stored procedure may be triggered by an insert on a specific table, or update of a specific field in a table, and the code inside the stored procedure would be executed.
PL/pgSQL (Procedural Language/PostgreSQL) is a procedural programming language supported by the PostgreSQL ORDBMS. It closely resembles Oracle 's PL/SQL language. Implemented by Jan Wieck, PL/pgSQL first appeared with PostgreSQL 6.4, released on October 30, 1998. [ 1 ]
A stored procedure, which is also precompiled and stored on the server for later execution, has similar advantages. Unlike a stored procedure, a prepared statement is not normally written in a procedural language and cannot use or modify variables or use control flow structures, relying instead on the declarative database query language.
Often procedures can be used to greatly reduce the amount of information transferred within and outside of a system. For increased security, the system design may grant access to only the stored procedures and not directly to the tables. Fundamental stored procedures contain the logic needed to insert new and update existing data.
Examples of these include the geographic information system (GIS) data types from the PostGIS project for PostgreSQL. There is also a data type called a domain , which is the same as any other data type but with optional constraints defined by the creator of that domain.
A procedure may also be created in a PL/SQL package - this is called a Package Procedure. A procedure created in a PL/SQL anonymous block is called a nested procedure. The standalone or package procedures, stored in the database, are referred to as "stored procedures". Procedures can have three types of parameters: IN, OUT and IN OUT.
SQL allows triggers to fire on updates to specific columns; As of version 9.0 of PostgreSQL this feature is also implemented in PostgreSQL. The standard allows the execution of a number of SQL statements other than SELECT , INSERT , UPDATE , such as CREATE TABLE as the triggered action.