Re: SQL*Plus & #include

From: Eric D Pierce <sac50216_at_saclink1.csus.edu>
Date: 1995/04/10
Message-ID: <3mcbhh$k3g_at_news.csus.edu>#1/1


an215493_at_anon.penet.fi wrote:

: In C if I want to include a file in another file, all I need to do is
:
: #include "file"
:
: at the location I wish to include it.  Is there a way to do that in
: SQL*Plus?  The reason I ask is that I need to do something like the
: following:
:
: ----------------------------------------------------------------------------
: To find out more about the anon service, send mail to help_at_anon.penet.fi.
: If you reply to this message, your message WILL be *automatically* anonymized
: and you are allocated an anon id. Read the help file to prevent this.
: Please report any problems, inappropriate use etc. to admin_at_anon.penet.fi.

Howdy,

I'm not "C" orientated, so not sure this will help:

With DOS SQL*Plus v3.0, if you invoke the following from the DOS prompt: SQLPLUS _at_c:\crap1b.sql

Where contents of crap1a.sql:
>select count(*) from student_master
>/

Where contents of crap1b.sql:
>username/password
>get c:\crap1a.sql
>/

then the query in "included" file will execute.

So, "get" works like "#include file" (at least for SQL*Plus scripts to be executed)?

  • * *

Not sure what your example below the line of "----------" means!

To just show some text on the screen maybe do:

>create table temp_crap (text_stuff varchar(2000));
>spool c:\morecrap.sql
>rem also need to turn off all report header stuff I can't remember
>rem
>select 'insert into temp_crap ('''To find out more ...''');' from dual;
>spool off
>start c:\morecrap.sql
>select text_stuff from temp_crap;

There are probably syntax errors in the above, but you get the idea?

>select 'insert into temp_crap ('''To find out more ...''');' from dual;

                                   ^^^^^^^^^^^^^^^^

If you want to dynamically insert this text by specifying a file name, I don't remember how to do it!

A guess: since the SQL statement is in a buffer, you could make a "host" call the append a file with the text to the file containing the buffer contents?

ARGGG. There is probably a really easy PL/SQL way to do it?

EP Received on Mon Apr 10 1995 - 00:00:00 CEST

Original text of this message