Document Type | Technical Information
Category | Administration
Applicable Product Version | Tibero 7.2.4
Document Number | TADTI150
Overview
This is a method for gathering major SQL statements that are used repeatedly and frequently in one place so that they can be executed from any location while operating the database.
In this content, the following SQL files are created in a separate HOME/work directory.
$ ls -l $HOME/work -rw-r--r-- 1 tibero dba 22 Dec 16 17:45 1.sql ==> [select 1 from dual ;] -rw-r--r-- 1 tibero dba 22 Dec 16 17:46 2.sql ==> [select 2 from dual ;] -rw-r--r-- 1 tibero dba 22 Dec 16 17:46 3.sql ==> [select 3 from dual ;]
Method
Before Configuration
$ cd /dev/
$ tbsql sys/tibero
SQL> !pwd
/dev
SQL> @1.sql
TBS-70002: Failed to open the file '1.sql': No such file or directory.
SQL> @2.sql
TBS-70002: Failed to open the file '2.sql': No such file or directory.
SQL> @3.sql
TBS-70002: Failed to open the file '3.sql': No such file or directory.
SQL> @$HOME/work/1.sql
1
----------
1
1 row selected.
SQL> @$HOME/work/2.sql
2
----------
2
1 row selected.
SQL> @$HOME/work/3.sql
3
----------
3
1 row selected.
After Configuration
Add the following to the tibero account's environment variables and check again.
$ vi ~/.bash_profile
ββββββββββββββββββββββββββββββββββββββββ
(omitted)
export TB_SQLPATH=$HOME/work
ββββββββββββββββββββββββββββββββββββββββ
$ . ~/.bash_profile
$ cd /dev/
$ tbsql sys/tibero
SQL> !pwd
/dev
SQL> @1.sql
1
----------
1
1 row selected.
SQL> @2.sql
2
----------
2
1 row selected.
SQL> @3.sql
3
----------
3
1 row selected.