Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: UNIX sqlplus can't echo multiline commands in order

Re: UNIX sqlplus can't echo multiline commands in order

From: joel garry <joel-garry_at_home.com>
Date: 4 Oct 2006 17:02:24 -0700
Message-ID: <1160006544.649958.258780@m73g2000cwd.googlegroups.com>

yong321_at_yahoo.com wrote:
> I''m sure everyone has seen this. If I copy
>
> select * from dual;
> select * from dual;
> select * from dual;
> select * from dual;
>
> from my Windows clipboard and paste them all into sqlplus running on
> UNIX or Linux, the screen looks like this:
>
> SQL> select * from dual;
> select * from dual;
> select * from dual;
> select * from dual;
>
> D
> -
> X
>
> SQL>
> D
> -
> X
>
> SQL>
> D
> -
> X
>
> SQL>
> D
> -
> X
>
> If I do this to DOS sqlplus, I don't have this problem. Can anybody
> offer a suggestion? One way is to save the multi-line input to a file
> myscript.sql and run it with @myscript.sql. Perhaps some third party
> sqlplus replacement can also do it. Any other suggestion?
>
> At first I thought this was related to the shell I launched sqlplus
> from, because at least on my bash shell window, pasting multiple lines
> of "sleep 1" echos them back one line at a time. But going into
> sqlplus, I still have the above problem. (I posted a message about that
> "sleep 1" problem here:
> http://groups.google.com/group/comp.unix.shell/browse_frm/thread/b78159e69d1f63ad
> )
>
> Yong Huang

Since I often use awk to create scripts on the fly, I use it to put in an extra select '<what the next command will be>' from dual;

Not pretty, but could be with some thought about set heading. I usually don't care about pretty for that stuff, anyways, I want info in the log of the session, set echo on doesn't satisfy me since just code isn't necessarily what I want, and some of my scripts echo <commands>|sqlplus or hereis the sql:

sqlplus -s <<EOF >mylog

        $schemapassword
-- obviously, the login in a variable

        set head off
        select 'select * from dual #1' from dual;
        select * from dual;
        select 'select * from dual #2' from dual;
        select * from dual;

EOF jg
-- 
@home.com is bogus.
http://www.newsoftheweird.com/archive/index.html
Received on Wed Oct 04 2006 - 19:02:24 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US