copy&paste multi-line SQL from sqlplus on Windows

Copy & paste multi-line SQL from sqlplus in one PuTTy window to another putty window is clumsy
because, as you see below, real SQL text is prefixed by line#.

Here's example#1. You can suppress line# by "set sqlnumber off" , though.

Autotrace running total : autotrace « SQL Plus « Oracle PL / SQL

SQL> create table t
  2  as
  3  select object_name ename,
  4         mod(object_id,50deptno,

Here's example#2. "set sqlnumber off" won't help.

Simple Pleasures…rlwrap and SQL*Plus Command Line editing on Linux | The Anti-Kyte

SQL> l
  SELECT name, wkts, average
  FROM top_bowlers
  3* WHERE country = 'AUSTRALIA'

You can copy&paste to notepad and edit but there's quicker way on Windows if Cygwin is installed.

After hitting Ctrl+C, go to bash prompt and ...

$ cut -c6- /dev/clipboard >/dev/clipboard

Now, Ctrl+V will paste SQL statements with line numbers removed.
You can use 'sed' also and be more creative.

Or if you don't have bash prompt open, you can use Windows "Run..." prompt.

I'm sure there's similar way for Mac OS.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Personal View of a Sales Engineer in Tokyo.

Search

Archives
« May 2016
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today