Search This Blog

2008-11-13

vi Macro Sample 1 for Oracle

Product: Oracle database, UNIX vi editor

Tips for Oracle in UNIX or Linux environment. This will map F4 function key to perform following so that it helps DBA to edit the SQL script
1. Insert a blank line before each of the ALTER TABLE statement

This is helpful when you get a SQL from someone, or imp utility, which you need to find the position of ALTER TABLE fast while scrolling down the page

Following vi macro will search for ALTER TABLE, and insert a blank line before it.  Then it move the cursor down 2 lines
:map <F4> /ALTER TABLE^V<ESC>O^V<ESC>jj

No comments: