Passing Contents of File as Parameter to Sql*Plus Command

Viewed 2294

I'm trying to write a sqlplus command that creates a table from a query that is stored in an .sql file.

The particular .sql file that contains the query would be supplied to my sqlplus command as a variable (&v_InputQuery).

I've tried something like this, but it doesn't work.

CREATE TABLE &v_OutputTable AS
(
< &v_InputQuery
)
;

I get an error saying that there's a missing SELECT keyword.

What I'd really like is for &v_InputQuery to be replaced not with the name of the file specified by the user, but with the actual contents of the file. Is there a way to do that?

Thank you very much.

3 Answers
Related