Solo disponible en BuenasTareas
  • Páginas : 2 (449 palabras )
  • Descarga(s) : 0
  • Publicado : 28 de mayo de 2011
Leer documento completo
Vista previa del texto

Many modern databases support a more procedural approach to databases-- they allow you to write procedural codeto work with data. Usually, it takes the form of SQL interweaved with the more familiar IF statements, etc.

Note that this has nothing to do with accessing the database. You can access anydatabase from virtually any language. What we´re talking about is the code that is executed by the database server .
While there are many various ‘database’ language, we will only talk about theprimary two:
T-SQL, which is supported by SQL Server and Sybase, and PL/SQL, which is supported by oracle.
Many other languages may be supported. For example, oracle allows you to write storeprocedures and triggers in java, etc.


Besides plain vanilla SQL, Oracle support PL/SQL. The PL stands for procedural language, withmeans you can have things like IF statements, loops, variables, and other procedural things along with declarative SQL statements. PL/SQL

Just as most procedural language, PL/SQL has some sort of variables. The types of variables are plain SQL column types that you’re all used to. You can also refer to a type of aparticular column explicitly by specifying the fully qualified column name (table.columnname ) followed by %TYPE for example PRODUCT. PRICE%TYPE.

This would refer to a single record stored in thePRODUC Table.
Along with the above mentioned, some common types are: BOOLEAN, DATE, NUMBER, CHAR and VARCHAR2.
We declare variables of these types similarly to specifying columns in tables. firstwe list the name of the variable, then the type we want it to have. For example, to declare a price variable of a fixed point NUMBER, we might do something like this;
PRICE NUMBER (6, 2)...
tracking img