Example 1: Setting the characteristics to SQL92 SQL> ATTACH 'ALIAS MIA1 FILENAME MIA_CHAR_SET DISPLAY CHARACTER SET SHIFT_JIS'; SQL> CONNECT TO 'ALIAS MIA1 FILENAME MIA_CHAR_SET' AS 'TEST'; SQL> SHOW CONNECTIONS TEST; Connection: TEST Default alias is RDB$DBHANDLE Default catalog name is RDB$CATALOG Default schema name is SMITH Dialect: SQLV40 Default character unit: OCTETS Keyword Rules: SQLV40 View Rules: SQLV40 Default DATE type: DATE VMS Quoting Rules: SQLV40 Optimization Level: DEFAULT Hold Cursors default: WITH HOLD PRESERVE NONE Quiet commit mode: OFF Compound transactions mode: EXTERNAL Default character set is DEC_MCS National character set is DEC_MCS Identifier character set is SHIFT_JIS Literal character set is SHIFT_JIS Display character set is SHIFT_JIS Alias MIA1: Identifier character set is DEC_KANJI Default character set is KATAKANA National character set is KANJI SQL> -- SQL> -- Change the environment from SQLV40 to MIA. Notice that the session SQL> -- character sets change. SQL> -- SQL> SET DIALECT 'MIA'; SQL> SHOW CONNECTIONS TEST; Connection: TEST Default alias is RDB$DBHANDLE Default catalog name is RDB$CATALOG Default schema name is SMITH Dialect: MIA Default character unit: CHARACTERS Keyword Rules: MIA View Rules: ANSI/ISO Default DATE type: DATE ANSI Quoting Rules: ANSI/ISO Optimization Level: DEFAULT Hold Cursors default: WITH HOLD PRESERVE NONE Quiet commit mode: OFF Compound transactions mode: EXTERNAL Default character set is KATAKANA National character set is KANJI Identifier character set is DEC_KANJI Literal character set is KATAKANA Display character set is SHIFT_JIS Alias MIA1: Identifier character set is DEC_KANJI Default character set is KATAKANA National character set is KANJI SQL> -- SQL> -- Change the environment from MIA to SQL99. Notice that the SQL> -- session characters DO NOT change from the MIA settings. SQL> -- SQL> SET DIALECT 'SQL99'; SQL> SHOW CONNECTIONS TEST; Connection: TEST Default alias is RDB$DBHANDLE Default catalog name is RDB$CATALOG Default schema name is SMITH Dialect: SQL99 Default character unit: CHARACTERS Keyword Rules: SQL99 View Rules: ANSI/ISO Default DATE type: DATE ANSI Quoting Rules: ANSI/ISO Optimization Level: DEFAULT Hold Cursors default: WITH HOLD PRESERVE NONE Quiet commit mode: ON Compound transactions mode: EXTERNAL Default character set is KATAKANA National character set is KANJI Identifier character set is DEC_KANJI Literal character set is KATAKANA Display character set is SHIFT_JIS Alias MIA1: Identifier character set is DEC_KANJI Default character set is KATAKANA National character set is KANJI Example 2: Saving and restoring dialect in interactive SQL This example shows the use of declared variables in interactive SQL to save (using GET ENVIRONMENT) and restore the dialect during execution of a script that requires an alternate dialect. This example simply displays the dialect using the SHOW CONNECTION statement. SQL> set dialect 'sql99'; SQL> -- save current dialect SQL> declare :dialect char(40); SQL> get environment (session) :dialect = DIALECT; SQL> print :dialect; DIALECT SQL99 SQL> set dialect 'oracle level2'; SQL> show connection rdb$default_connection; Connection: RDB$DEFAULT_CONNECTION Default alias is RDB$DBHANDLE Default catalog name is RDB$CATALOG Default schema name is SMITH Dialect: SQL99 (ORACLE LEVEL2) Default character unit: CHARACTERS Keyword Rules: SQL99 View Rules: ANSI/ISO Default DATE type: DATE VMS Quoting Rules: ANSI/ISO Optimization Level: DEFAULT Hold Cursors default: WITH HOLD PRESERVE NONE Quiet commit mode: ON Compound transactions mode: EXTERNAL Default character set is DEC_MCS National character set is DEC_MCS Identifier character set is DEC_MCS Literal character set is DEC_MCS Display character set is UNSPECIFIED SQL> SQL> -- restore previous dialect SQL> set dialect :dialect; SQL> show connection rdb$default_connection; Connection: RDB$DEFAULT_CONNECTION Default alias is RDB$DBHANDLE Default catalog name is RDB$CATALOG Default schema name is SMITH Dialect: SQL99 Default character unit: CHARACTERS Keyword Rules: SQL99 View Rules: ANSI/ISO Default DATE type: DATE ANSI Quoting Rules: ANSI/ISO Optimization Level: DEFAULT Hold Cursors default: WITH HOLD PRESERVE NONE Quiet commit mode: ON Compound transactions mode: EXTERNAL Default character set is DEC_MCS National character set is DEC_MCS Identifier character set is DEC_MCS Literal character set is DEC_MCS Display character set is UNSPECIFIED SQL>