Working With an ASCII EDITOR: SQL is a single sentence language. The sentence once typed at the SQL > Prompt cannot be retrieved and corrected if a spelling or syntax error was discovered after it was dispatched to the Oracle engine for processing.

The technique used to overcome this constant retyping of sentences is to create an ASCII file. Place the SQL sentence as the contents of the ASCII file. When the sentence has to be executed, appropriate commands in SQL * Plus opens the ASCII file and passes its contents to the Oracle Server for execution.

Any ASCII editor can be used. Once convenient editor to use will be Windows Notepad Editor, which is a part of the MS Windows Operating System. Hence, Notepad can be invoked while the SQL prompt is on the screen as the editor of choice.

1. To invoke Notepad, Window's full page ASCII editor, from SQL * plus type Ed followed by the file name at the SQL prompt. If the file does not exist then the system comes up with a message asking the user to create a new file.

2. At this point an ASCII file of the filename specified is opened in memory. Start to type in SQL sentences in the ASCII file. Each SQL sentence is to be terminated with a / (backslash) in the first column of the next line.

3. Save the file using the Notepad Menu choices File,Save.

4. This file can be invoked and used repeatedly at the SQL > Prompt.

5. To exit from the tool click on File,Exit.

No comments: