Skip to Main Content

SQLcl: MCP Server & SQL Prompt

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sql script changes working directory (linux)

B.DelméeFeb 25 2020 — edited Feb 25 2020

Hello, i could not find if this has been reported already.

Our dba recently upgraded our db instances to 19.3 (on RHEL7).

I am happy to have a recent version of sql(cl)  to use on linux now, but have noticed the following glitch: the "sql' script is actually a one liner that changes the current working directory.

As a result, if i try "@somscript.sql" that won't run even though the referenced script exists in the directory where i started from because the "sql" driver script alters the working directory.

See below for version details

$ ll dummy.sql
-rw-r--r-- 1 bimadmin bimadmin 50 Feb 25 11:46 dummy.sql
$ cat dummy.sql
select user,sysdate,global_name from global_name;
$ type sql
sql is hashed (/ora_bim_home01/product/19.3/bin/sql)
$ cat /ora_bim_home01/product/19.3/bin/sql
#!/bin/bash
########################################################################
#  (@)sql.sh
#
#  Copyright 2014 by Oracle Corporation,
#  500 Oracle Parkway, Redwood Shores, California, 94065, U.S.A.
#  All rights reserved.
#
#  This software is the confidential and proprietary information
#  of Oracle Corporation.
#
#  NAME sql
#
#  DESC         This script starts SQLCL from $ORACLE_HOME in Database install.
########################################################################

cd "`dirname $0`"/../sqldeveloper/sqldeveloper/bin && bash sql $*
$
$ sql

SQLcl: Release 19.1 Production on Tue Feb 25 11:47:25 2020

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Last Successful login time: Tue Feb 25 2020 11:47:26 +01:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0


SQL> @dummy.sql
SP2-0310: Unable to open file: "dummy.sql"

Comments
Post Details
Added on Feb 25 2020
0 comments
261 views