SnowConvert AI - Oracle - SQL*Plus¶
This is a translation reference to convert SQL Plus statements to SnowSQL (CLI Client)
Accept¶
Warning
Transformation for this command is pending
Description¶
Reads a line of input and stores it in a given substitution variable.. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command. To emulate this functionality, the SnowCLI!system command will be used by taking advantage of the system resources for the input operations.
1. Accept command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Warning
Note that this approach only applies to macOS and Linux. If you want to run these queries in Windows you may need a terminal that supports a Linux bash script language.
Known Issues¶
No Known Issues.
Append¶
Warning
Transformation for this command is pending
Description¶
Adds specified text to the end of the current line in the SQL buffer. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command. The Snowflake !edit command can be used to edit the last query using a predefined text editor. Whenever this approach does not cover all the APPEND functionality but it is an alternative.
1. Append command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Archive Log¶
Warning
Transformation for this command is pending
Description¶
The
ARCHIVE LOGcommand displays information about redoing log files. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command. The Snowflake !optionscommand can be used to display the location path of some log files, however, it does not fully comply with the behavior expected by the ARCHIVE LOG command. At transformation time, an EWI will be added.
1. Archive Log command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Attribute¶
Warning
Transformation for this command is pending
Description¶
The
ATTRIBUTEcommand specifies display characteristics for a given attribute of an Object Type column. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command.
1. Attribute command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Warning
The code for the EWI is not defined yet.
Known Issues¶
1. SnowSQL can set the format of a column
Currently, SnowSQL does not support custom types nor does it have a command to format columns. However, you can use the following workaround to format columns in your query result:
This alternative solution must consider an additional strategy to disable when in Oracle the ATTRIBUTE command receives the OFF option.
Related EWIs¶
No related EWIs.
Break¶
Warning
Transformation for this command is pending
Description¶
Specifies where changes occur in a report and the formatting action to perform. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not support the use of this command and does not have any that might resemble its functionality. At the time of transformation, an EWI will be added.
1. BREAK command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Btitle¶
Warning
Transformation for this command is pending
Description¶
The
BTITLEcommand places and formats a specified title at the bottom of each report page, or lists the current BTITLE definition. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command.
1. Btitle command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
1. SnowSQL does not support the display of custom headers and footers in query
Currently, SnowSQL does not support the display of custom headers and footers in query output. However, you can use the following workaround to display header and footer information in your query output:
This alternative solution must consider an additional strategy to disable when in Oracle the BTITLE command receives the OFF option.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Change¶
Warning
Transformation for this command is pending
Description¶
The
CHANGEcommand Changes the first occurrence of the specified text on the current line in the buffer. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent to this command. The Snowflake !edit command can be used to edit the last query using a predefined text editor. Whenever this approach does not cover all the CHANGE functionality but it is an alternative.
1. Change command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
1. Unsupported scenarios
The CHANGE command can be presented in various ways, of which 2 of them are not currently supported by the translator, these are presented below:
Entering a line number followed by a string will replace the line regardless of the text that follows the line number. This scenario is not supported as this does not follow the command grammar.
Enter the text to replace followed by the command without using spaces. This scenario is not supported since it does not follow the logic of tokenization by spaces.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Column¶
Warning
Transformation for this command is pending
Description¶
The
COLUMNcommand specifies display attributes for a given column. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not support the use of this command and does not have any that might resemble its functionality. At the time of transformation, an EWI will be added.
1. Column command¶
The COLUMN command with no clauses to list all current column display attributes.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Define¶
Warning
Transformation for this command is pending
Description¶
The
DEFINEcommand specifies a user or predefined variable and assigns a CHAR value to it, or lists the value and variable type of a single variable or all variables. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !define¶
Note
Snowflake recommends not adding whitespace in the variable value assignment statement.
1. Define with simple variable assignment¶
Hint
This case is functionally equivalent.
The DEFINE command is replaced by the !define command.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
For referring to a previously defined variable, & is preceded by the name of the variable, if the variable does not exist, Oracle allows its execution time assignment, however, Snowflake would throw an error indicating the non-existence of said variable
2. Define without variable assignments¶
Warning
This case is not functionally equivalent.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
The DEFINE command used without the assignment statement is used in Oracle to show the definition of the variable, on the other hand in Snowflake this way of using the DEFINE command would reset the assignment of the variable, so a way to simulate the behavior presented in Oracle it is by using the SELECT command.
This solution would be something like this:
Command¶
Known Issues¶
1. Enabling variable substitution
To enable SnowSQL CLI to substitute values for the variables, you must set the variable_substitution configuration option to true. This process can be done at installation, when starting a database instance, or by running the following command:
Command¶
2. Predefined variables
There are nine predefined variables during SQL*Plus installation. These variables can be used later by the user. The SnowSQL CLI client only has two predefined variables __ROWCOUNT and __SFQID.
Host¶
Warning
Transformation for this command is pending
Description¶
The
HOSTcommand executes an operating system command without leaving SQL*Plus. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !system¶
1. Set with simple variable assignment¶
Hint
This case is functionally equivalent.
The HOST command is replaced by the !system command.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
No related EWIs.
Prompt¶
Warning
Transformation for this command is pending
Description¶
The
PROMPTcommand sends the specified message or a blank line to the user’s screen. If you omit a text,PROMPTdisplays a blank line on the user’s screen. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !print¶
1. Simple print¶
The PROMPT command is replaced by the !print command.
Hint
This case is functionally equivalent.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues
Related EWIs¶
No related EWIs.
Remark¶
Warning
Transformation for this command is pending
Description¶
The
REMARKcommand begins a comment in a script. SQL*Plus does not interpret the comment as a command.. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent for this command. However, some of its functionalities can be emulated.
1. Remark after the first line¶
Hint
This case is functionally equivalent.
When the REMARK command is not at the beginning of a script you can use the standard SQL comment markers and double hyphens.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
2. Remark on the first line¶
Warning
This case is not functionally equivalent.
When the REMARK command is at the beginning of a script, scenarios could appear such as:
Case 1: The next line is a query, in which case the conversion to Snowflake of the REMARK command succeeds.
Case 2: The next line is another SQL*Plus command, in which case the conversion cannot be performed since Snowflake is not capable of executing either of the two statements (This also applies to the scenario where there is only one statement in the script statement that corresponds to the REMARK command).
Below are some examples, where the first two could not be translated correctly.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Set¶
Warning
Transformation for this command is pending
Description¶
The
SETcommand sets a system variable to alter the SQL*Plus environment settings for your current session. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !set¶
Note
Snowflake recommends not adding whitespace in the variable value assignment statement.
1. Set with simple variable assignment¶
Hint
This case is functionally equivalent.
The SET command is replaced by the !set command.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
2. Define without variable assignments¶
Warning
This case is not functionally equivalent.
Oracle allows bypassing the key-value rule for assigning values to system variables with a numeric domain, assigning the value of 0 by default in such cases. In Snowflake this is not allowed, so an alternative is to set the value of 0 to a said variable explicitly.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
1. Predefined variables
The SET command only works for system variables, which may differ in quantity, name, or domain between the two languages, so a review should be done on the variable being used within the command to find its correct Snowflake equivalence. To see the list of system variables in Oracle you can use the command SHOW ALL whereas in Snowflake you can use !options.
Related EWIs¶
No related EWIs.
Show¶
Warning
Transformation for this command is pending
Description¶
Shows the value of a SQLPlus system variable or the current SQLPlus environment. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not have a direct equivalent for this command. However, some of its functionalities can be emulated.
1. Show ERRORS¶
Shows the compilation errors of a stored procedure (includes stored functions, procedures, and packages). After you use the CREATE command to create a stored procedure, a message is displayed if the stored procedure has any compilation errors.
In Snowflake, performing an extra statement to display all the compilation errors is unnecessary. The compilation errors are displayed immediately when executing the CREATE statement.
Oracle¶
Command¶
Result¶
Note
Note that the INTO keyword is misspelled to cause a compilation error.
SnowSQL (CLI Client)¶
Command¶
Result¶
Show ALL¶
Lists the settings of all SHOW options, except ERRORS and SGA, in alphabetical order.
To display all the possible options in SnowCLI you can run the !options command.
Oracle¶
Command¶
Result¶
SnowSQL (CLI Client)¶
Command¶
Result¶
Name |
Value |
Help |
|---|---|---|
auto_completion |
True |
Displays auto-completion suggestions for commands and Snowflake objects |
client_session_keep_alive |
False |
Keeps the session active indefinitely, even if there is no activity from the user. |
client_store_temporary_credential |
False |
Enable Linux users to use temporary file to store ID_TOKEN. |
connection_options |
{} |
Set arbitrary connection parameters in underlying Python connector connections. |
echo |
False |
Outputs the SQL command to the terminal when it is executed |
editor |
vim |
Changes the editor to use for the !edit command |
empty_for_null_in_tsv |
False |
Outputs an empty string for NULL values in TSV format |
environment_variables |
[] |
Specifies the environment variables to be set in the SnowSQL variables. |
The variable names should be comma separated. |
||
execution_only |
False |
Executes queries only. No data will be fetched |
exit_on_error |
False |
Quits when SnowSQL encounters an error |
fix_parameter_precedence |
True |
Fix the connection parameter precedence in the order of 1) Environment variables, 2) Connection parameters, 3) Default connection parameters. |
force_put_overwrite |
False |
Forces OVERWRITE=true for PUT. This is to mitigate S3’s eventually consistent issue. |
friendly |
True |
Shows the splash text and goodbye messages |
header |
True |
Outputs the header in query results |
insecure_mode |
False |
Turns off OSCP certificate checks |
key_bindings |
emacs |
Changes keybindings for navigating the prompt to emacs or vi |
log_bootstrap_file |
../snowsql_rt.log_bo.. |
SnowSQL bootstrap log file location |
log_file |
../snowsql_rt.log |
SnowSQL main log file location |
log_level |
DEBUG |
Changes the log level (critical, debug, info, error, warning) |
login_timeout |
120 |
Login timeout in seconds. |
noup |
False |
Turns off auto upgrading Snowsql |
ocsp_fail_open |
True |
Sets the fail open mode for OCSP Failures. For help please refer the documentation. |
output_file |
None |
Writes output to the specified file in addition to the terminal |
output_format |
psql |
Sets the output format for query results. |
paging |
False |
Enables paging to pause output per screen height. |
progress_bar |
True |
Shows progress bar while transferring data. |
prompt_format |
[user]#[warehouse]@[.. |
Sets the prompt format. For help, see the documentation |
quiet |
False |
Hides all output |
remove_comments |
False |
Removes comments before sending query to Snowflake |
remove_trailing_semicolons |
False |
Removes trailing semicolons from SQL text before sending queries to Snowflake |
results |
True |
If set to off, queries will be sent asynchronously, but no results will be fetched. |
Use !queries to check the status. |
||
rowset_size |
1000 |
Sets the size of rowsets to fetch from the server. |
Set the option low for smooth output, high for fast output. |
||
sfqid |
False |
Turns on/off Snowflake query id in the summary. |
sfqid_in_error |
False |
Turns on/off Snowflake query id in the error message |
sql_delimiter |
; |
Defines what reserved keyword splits SQL statements from each other. |
sql_split |
snowflake.connector… |
Choose SQL spliter implementation. Currently snowflake.connector.util_text, or snowflake.cli.sqlsplit. |
stop_on_error |
False |
Stops all queries yet to run when SnowSQL encounters an error |
syntax_style |
default |
Sets the colors for the text of SnowSQL. |
timing |
True |
Turns on/off timing for each query |
timing_in_output_file |
False |
Includes timing in the output file. |
variable_substitution |
False |
Substitutes variables (starting with ‘&’) with values |
version |
1.2.24 |
SnowSQL version |
wrap |
True |
Truncates lines at the width of the terminal screen |
———————————– |
———————— |
———————————————————————————————————————————————– |
Known Issues¶
1. It’s not possible in SnowCLI to display the value of a single option.
SnowCLI does not provide a way to display the value of a specific option. You may use !options to watch the value of the option.
2. Research is pending to match each SQLPLUS option to a SnowflakeCLI equivalent.
It is pending to define an equivalent for each SQLPLUS option.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Spool¶
Warning
Transformation for this command is pending
Description¶
The
SPOOLcommand stores query results in a file, or optionally sends the file to a printer. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !spool¶
1. Spool without options¶
Hint
This case is functionally equivalent.
When the SPOOL command is not accompanied by any option, by default it creates a new file with the specified name and extension. The SPOOL command is replaced by the !spool command.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
2. Spool with write options¶
Warning
This case is not functionally equivalent.
Oracle allows 3 types of options when writing to a file through the SPOOL command, the CREATE and APPEND options create a file for writing from scratch and concatenate text to the end of an existing file (or create a new one if it doesn’t exist) respectively. Snowflake does not support these options, however, its default behavior is to create a file and if it exists, concatenate the text in it. The REPLACE option, on the other hand, writes to the specific file replacing the existing content. To simulate this behavior in Snowflake it is recommended to delete the file where you want to write and start writing again, as shown in the following code
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
3. Spool turn off¶
Hint
This case is functionally equivalent.
Oracle has two options to turn off results spooling, OFF and OUT. both are meant to stop rolling, with the difference that the second also sends the file to the computer’s standard (default) printer. This option is not available on some operating systems. Snowflake only has the option to turn off results spooling
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
No related EWIs.
Start¶
Warning
Transformation for this command is pending
Description¶
The
STARTcommand runs the SQL*Plus statements in the specified script. The script can be called from the local file system or from a web server. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
SnowSQL (CLI Client) !load¶
1. Simple start¶
The START command is replaced by the !load command.
Hint
This case is functionally equivalent.
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
2. Start with arguments¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Warning
Script arguments are currently not supported for SnowSQL (CLI Client).
Known Issues¶
1. Arguments are not supported in the SnowSQL CLI Client
Oracle can pass down multiple arguments to a script and can be accessed with &1, &2, and so on, but this cannot be done in the SnowSQL CLI Client. You can simulate arguments by declaring variables with the !define command. Keep in mind that these values are defined globally for all the scripts so the behavior may not be equivalent.
This workaround would look something like this:
Related EWIs¶
No related EWIs.
Whenever oserror¶
Warning
Transformation for this command is pending
Description¶
The
WHENEVER OSERRORcommand Performs the specified action (exits SQL*Plus by default) if an operating system error occurs. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not support the use of this command and does not have any that might resemble its functionality. At the time of transformation, an EWI will be added.
1. Whenever oserror command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.
Whenever sqlerror¶
Warning
Transformation for this command is pending
Description¶
The
WHENEVER SQLERRORcommand Performs the specified action (exits SQL*Plus by default) if a SQL command or PL/SQL block generates an error. (Oracle SQL Plus User’s Guide and Reference)
Oracle Syntax¶
Snowflake does not support the use of this command and does not have any that might resemble its functionality. At the time of transformation, an EWI will be added.
1. Whenever sqlerror command¶
Oracle¶
Command¶
SnowSQL (CLI Client)¶
Command¶
Known Issues¶
No Known Issues.
Related EWIs¶
SSC-EWI-0073: Pending Functional Equivalence Review.