cli

Differences

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

Link to this comparison view

cli [2015/09/23 20:26]
127.0.0.1 external edit
cli [2016/04/20 07:31]
dmtolpeko
Line 1: Line 1:
-====== ​PL/HQL Command Line ======+====== ​HPL/SQL Command Line ======
  
-You can run //plhql// tool from a command line to execute a SQL statement or HQL script.+You can run //hplsql// tool from a command line to execute a SQL statement or HPL/​SQL ​script.
  
 **Syntax**: **Syntax**:
  
 <code language="​sql">​ <code language="​sql">​
-plhql -e '​query'​ | -f file +hplsql ​-e '​query'​ | -f file 
       [-main procname]       [-main procname]
       [-d | --define | -hiveconf | -hivevar var=value ...]        [-d | --define | -hiveconf | -hivevar var=value ...] 
Line 16: Line 16:
 **Parameters:​** **Parameters:​**
  
-| **Parameter** || **Description** | **PL/HQL Version** | +| **Parameter** || **Description** | **HPL/SQL Version** | 
 | -e '​query'​ || SQL statements to execute | 0.1 | | -e '​query'​ || SQL statements to execute | 0.1 |
 | -f file || Execute SQL statements from //file// | 0.1 |  | -f file || Execute SQL statements from //file// | 0.1 | 
Line 24: Line 24:
 | -hiveconf var=value ||:::| 0.1 |  | -hiveconf var=value ||:::| 0.1 | 
 | -hivevar var=value ||:::| 0.1 |  | -hivevar var=value ||:::| 0.1 | 
-| -version | %%--%%version | Print PL/HQL version | 0.1 |+| -version | %%--%%version | Print HPL/SQL version | 0.1 |
 | -trace | %%--%%trace | Print trace information | 0.1 | | -trace | %%--%%trace | Print trace information | 0.1 |
 | -H | %%--%%help | Print help information and exit | 0.1 | | -H | %%--%%help | Print help information and exit | 0.1 |
Line 31: Line 31:
  
   * -e and -f cannot be specified together   * -e and -f cannot be specified together
-  * if -main option is not specified, ​PL/HQL start executing all statements from the beginning of the script+  * if -main option is not specified, ​HPL/SQL starts ​executing all statements from the beginning of the script
   * You can use single '​query'​ and double "​query"​ quotes with -e option   * You can use single '​query'​ and double "​query"​ quotes with -e option
   * Currently -d, %%--%%define,​ -hivevar and -hiveconf are equivalent and allow you to define input variables.   * Currently -d, %%--%%define,​ -hivevar and -hiveconf are equivalent and allow you to define input variables.
Line 37: Line 37:
 **Example 1:** **Example 1:**
  
-Executing ​PL/HQL statements from a script:+Executing ​HPL/SQL statements from a script:
  
 <code language="​sql">​ <code language="​sql">​
-plhql -f script.hql +hplsql ​-f script.sql 
 </​code> ​ </​code> ​
  
 **Example 2:** **Example 2:**
  
-Executing ​PL/HQL statements from command line:+Executing ​HPL/SQL statements from command line:
  
 <code language="​sql">​ <code language="​sql">​
-plhql -e "​NVL(MAX_PARTITION_DATE(db.sales,​ local_dt, code='​A'​),​ CURRENT_DATE)" ​+hplsql ​-e "​NVL(MAX_PARTITION_DATE(db.sales,​ local_dt, code='​A'​),​ CURRENT_DATE)" ​
 </​code> ​ </​code> ​
  
Line 56: Line 56:
  
 <code language="​sql">​ <code language="​sql">​
-plhql -e "PRINT a || ', ' || b" -d a=Hello -d b=world ​+hplsql ​-e "PRINT a || ', ' || b" -d a=Hello -d b=world ​
 </​code> ​ </​code> ​
  
 Result: Result:
 <​code>​Hello,​ world</​code>​ <​code>​Hello,​ world</​code>​