Re: sqlcl and sqlplus (Jeff Smith)

From: Sayan Malakshinov <xt.and.r_at_gmail.com>
Date: Sun, 16 Jun 2019 00:56:05 +0300
Message-ID: <CAOVevU4s2rZ0ea_FLXR05T3Q9Mr0hjJasOXdFOjeeRY1FWP4qA_at_mail.gmail.com>



There are 3 standard ways to do that:

  1. Ignore such unsupported errors using "set termout off": set termout off; set history 200; set sqlformat ansiconsole; set termout on;
  2. create different aliases for sqlplus and sqlcl where you can change SQLPATH and start required program. For example, I use "splus" for sqlplus and it changes path and starts sqlplus within rlwrap, and "sqlcl" for "sql"
  3. You can create conditional glogin: *glogin.sql:* set ver off feed off; col conditional_glogin new_val conditional_glogin noprint col _PWD new_val _PWD noprint; select '' as "_PWD" from dual where 1=0; select nvl2('&_PWD','sqlcl','sqlplus') conditional_glogin from dual; _at__at_&conditional_glogin set ver on feed on;

*sqlcl.sql:*
prompt SQLCL!

*sqlplus.sql*:
prompt SQLPLUS!

Full example:
https://gist.github.com/xtender/8b7897c02839a74bf78db00613754068 [oracle_at_ORA193 admin]$ cat glogin.sql set ver off feed off;
col conditional_glogin new_val conditional_glogin noprint col _PWD new_val _PWD noprint;
select '' as "_PWD" from dual where 1=0; select nvl2('&_PWD','sqlcl','sqlplus') conditional_glogin from dual; _at__at_&conditional_glogin
set ver on feed on;
[oracle_at_ORA193 admin]$ cat sqlcl.sql
prompt SQLCL!
[oracle_at_ORA193 admin]$ cat sqlplus.sql prompt SQLPLUS!
[oracle_at_ORA193 admin]$ *sqlplus / as sysdba*

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Jun 15 21:44:13 2019 Version 19.3.0.0.0

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

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

*SQLPLUS!*
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle_at_ORA193 admin]$ *sql / as sysdba*

SQLcl: Release 19.1 Production on Sat Jun 15 21:44:20 2019

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

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

*SQLCL!* SQL> exit

Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

On Sun, Jun 16, 2019 at 12:31 AM Mladen Gogala <gogala.mladen_at_gmail.com> wrote:

> First, the product are diverging so the files should be different.
> Second, both products are following SQLPATH so if the files are the
> same, one of the products will throw an error.
>
> Regards
>
> On 6/15/19 5:15 PM, Andy Klock wrote:
> >
> > Rather than changing the products couldn't you just set SQLPATH to a
> > directory containing your glogin.sql ?
> >
> > Andy K
>
> --
> Mladen Gogala
> Database Consultant
> Tel: (347) 321-1217
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

-- 
Best regards,
Sayan Malakshinov
Oracle performance tuning engineer
Oracle ACE Associate
http://orasql.org

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Jun 15 2019 - 23:56:05 CEST

Original text of this message