SPOOL file, how to remove the SQL statement starting

xiaoxiao2021-03-06  41

SPOOL a SQL file, usually do this:

Spool c: /RName.sql

SELECT 'RENAME "' || Table_name || '" To' || Table_name || ';' from cat where table_type = 'table';

Spool OFF;

Spool's starting with SQL>, there will be some annoying things in the middle, if this spool file is executed, there must be an error, how to remove the SQL statement starting with the file.

Set your system environment variable first, this is necessary

SET HEAD OFF;

Set echo OFF;

SET TERM OFF;

Set line 200;

SET PAGES 0;

SET feed OFF;

then

Spool c: /RName.sql

SELECT 'RENAME "' || Table_name || '" To' || Table_name || ';' from cat where table_type = 'table';

Spool OFF;

Results There is still SQL before and after>

There are two ways at this time:

1. Put these statements in a text file, then execute this text file in SQLPlus, and the file coming out will be;

2, set SQLPROMPT --SQL>, although there is still a "SQL" before and after, it will not report an error because he has been commented.

转载请注明原文地址:https://www.9cbs.com/read-56755.html

New Post(0)