declare

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
declare [2015/09/23 20:27]
127.0.0.1 external edit
declare [2015/10/19 09:32] (current)
dmtolpeko [DECLARE Block]
Line 10: Line 10:
  
 <code language=sql>​ <code language=sql>​
-DECLARE var datatype [:= | = | 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 =====