This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
declare [2015/10/19 08:49] dmtolpeko [DECLARE Block] |
declare [2015/10/19 09:32] dmtolpeko [DECLARE Block] |
||
---|---|---|---|
Line 10: | Line 10: | ||
<code language=sql> | <code language=sql> | ||
- | DECLARE var datatype [NOT NULL] [:= | = | DEFAULT expression]; | + | DECLARE |
- | ... | + | var datatype [NOT NULL] [:= | = | DEFAULT expression]; |
+ | ... | ||
+ | BEGIN | ||
+ | ... | ||
+ | END; | ||
+ | </code> | ||
+ | |||
+ | HPL/SQL also allows you to define a constant: | ||
+ | |||
+ | <code language=sql> | ||
+ | var CONSTANT datatype := | DEFAULT expression | ||
</code> | </code> | ||
Line 22: | Line 32: | ||
count SMALLINT = 0; | count SMALLINT = 0; | ||
limit INT DEFAULT 100; | limit INT DEFAULT 100; | ||
+ | max_limit CONSTANT INT := 1000; | ||
+ | BEGIN | ||
+ | ... | ||
+ | END; | ||
</code> | </code> | ||
**Compatibility:** Declaration block syntax is similar to Oracle PL/SQL, PostgreSQL PL/pgSQL and Netezza NZPLSQL. | **Compatibility:** Declaration block syntax is similar to Oracle PL/SQL, PostgreSQL PL/pgSQL and Netezza NZPLSQL. | ||
- | |||
===== DECLARE Statement ===== | ===== DECLARE Statement ===== | ||