@@ -45,7 +45,7 @@ CREATE DATABASE library OPTIONS(
4545<pre >
4646CREATE
4747 [ OR REPLACE ]
48- [ TEMP | TEMPORARY ]
48+ [ TEMP[ORARY] ]
4949 TABLE
5050 [ IF NOT EXISTS ]
5151 table_name [ ( <span class =" var " >table_element</span >, ... ) ]
@@ -453,7 +453,7 @@ CREATE TABLE books AS (
453453```
454454CREATE
455455 [OR REPLACE]
456- [TEMP | TEMPORARY ]
456+ [TEMP[ORARY] ]
457457 VIEW
458458 [IF NOT EXISTS]
459459 view_name
@@ -488,7 +488,7 @@ The `CREATE VIEW` statement creates a view based on a specific query.
488488```
489489CREATE
490490 [OR REPLACE]
491- [TEMP | TEMPORARY ]
491+ [TEMP[ORARY] ]
492492 EXTERNAL TABLE
493493 [IF NOT EXISTS]
494494 table_name
@@ -687,7 +687,60 @@ Documentation is pending for this feature.
687687
688688## CREATE CONSTANT
689689
690- Documentation is pending for this feature.
690+ <pre >
691+ CREATE
692+ [OR REPLACE]
693+ [{ TEMP[ORARY] | PUBLIC | PRIVATE }]
694+ CONSTANT
695+ [IF NOT EXISTS]
696+ <span class =" var " >constant_name</span > = <span class =" var " >constant_value</span >;
697+ </pre >
698+
699+ ** Description**
700+
701+ The ` CREATE CONSTANT ` statement creates a constant and assigns a value to it.
702+ The value cannot be altered later with the ` ALTER ` statement, but you can use
703+ ` CREATE OR REPLACE CONSTANT ` if you need to replace the value.
704+
705+ + ` OR REPLACE ` : Replace a constant if it already exists. This cannot appear
706+ with ` IF NOT EXISTS ` .
707+ + ` TEMP | TEMPORARY ` : Creates a temporary constant. The lifetime of the
708+ constant is system-specific.
709+ + ` PUBLIC ` : If the constant is declared in a module, ` PUBLIC ` specifies that it
710+ is available outside of the module.
711+ + ` PRIVATE ` : If the constant is declared in a module, ` PRIVATE ` specifies that
712+ it is only available inside of the module (default).
713+ + ` IF NOT EXISTS ` : Do not create a constant if it already exists. If the
714+ constant already exists, don't produce an error and keep the existing value.
715+ This cannot appear with ` OR REPLACE ` .
716+ + ` constant_name ` : The name of the constant. This can include a path.
717+ + ` constant_value ` : An expression that represents the value for the constant.
718+
719+ The constant declaration does not specify a type. The constant type is the
720+ ` constant_value ` type. You cannot ` ALTER ` , ` RENAME ` , or ` DROP ` a constant.
721+
722+ Constants cannot be used as arguments to aggregate
723+ user-defined functions (UDFs).
724+
725+ ** Example**
726+
727+ Create a constant, ` DEFAULT_HEIGHT ` :
728+
729+ ``` sql
730+ CREATE TEMPORARY CONSTANT DEFAULT_HEIGHT = 25 ;
731+ ```
732+
733+ Use it in a statement:
734+
735+ ``` sql
736+ SELECT (DEFAULT_HEIGHT + 5 ) AS result;
737+
738+ + -- ------+
739+ | result |
740+ + -- ------+
741+ | 30 |
742+ + -- ------+
743+ ```
691744
692745## CREATE AGGREGATE FUNCTION
693746
0 commit comments