Can this be done through COPY OTHER > BOOKMARKED LINES ?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
manualph
Posts: 13
Joined: Mon Jan 04, 2010 7:08 am
Location: India

Can this be done through COPY OTHER > BOOKMARKED LINES ?

Post by manualph »

Version 5.3.1
I need to find all lines with the string

Code: Select all

ERROR at line 1:
and copy 3 lines prior to this line

As you can see below in an SQL script execution log, i have no use with bookmarking and copying the error line itself. I actually need the commands which errored out which appears in the 3rd line prior to the error message.

Code: Select all

SQL > alter table FIN_RT1.ITEM_MASTER_UPLOAD modify (DIVISION_CODE_C_C varchar2(30));
Table altered.

SQL > alter table FIN_RT1.ITEM_MASTER_UPLOAD_INT modify (DIVISION_CODE_C_C varchar2(30));
Table altered.

SQL > alter table FIN_RT1.SKU_COM_EMPCATEGORY modify (CATEGORY_TYPE_C varchar2(30));
alter table FIN_RT1.SKU_COM_EMPCATEGORY modify (CATEGORY_TYPE_C varchar2(30))
																										*
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype

SQL > alter table WM_2006.SKU_COM_EMPCATEGORY modify (CATEGORY_TYPE_C varchar2(30));
alter table WM_2009.SKU_COM_EMPCATEGORY modify (CATEGORY_TYPE_C varchar2(30))
																										*
ERROR at line 1:
ORA-01439: column to be modified must be empty to change datatype

SQL > alter table FIN_RT1.ITEM_MASTER_STP modify (DIVISION_CODE_C_C varchar2(30));
Table altered.
Is there a way to do this?
ACRobin
Posts: 134
Joined: Fri Nov 04, 2005 9:51 pm
Location: Northumberland,UK
Contact:

Post by ACRobin »

Yes there is a way to do what you what using the "find/replace" function and regular expressions.

In the find dialogue enter the line you what to find.

In the replace dialogue enter the text lines you want and do "replace all" with "regular expression" ticked.

to generate the replace dialogue:
create a new document and type in the lines you want inserted above the "error at line 1" text and including the "error at line 1".
copy all this text into the clipboard and go to the document you want to edit and paste the clipboard contents into the "replace dialogue".

Hope you can undestand this.
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

ACRobin, I think you misunderstood manualph's question. He/she wants to copy the SQL statements in the execution log that generated errors.

One way to do it is by recording a macro:
  1. On the Macros menu, click Record.
  2. On the Search menu, click Find.
  3. In Find what, enter ERROR at line and click Find Next.
  4. Click Close.
  5. Press UP three times.
  6. On the Edit menu, point to Copy Other, and then click Line Append.
  7. On the Search menu, click Find Next.
  8. On the Macros menu, click Stop Recording.
To use the macro:
  1. Clear the clipboard by copying a newline or space character or by using a clipboard utility.
  2. Press CTRL+R to play back the macro repeatedly until the search string is no longer found.
  3. Paste the copied lines from the clipboard.
Andrew
manualph
Posts: 13
Joined: Mon Jan 04, 2010 7:08 am
Location: India

Post by manualph »

Andrew, AC Robin
Thank you very much. Macros did work.
Post Reply