Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> "Embed" command files inside queries?
Hello, I've just started using Oracle and I'm using the command line
client SQL*Plus to teach myself basic SQL.
As you know, you can write command files containing queries that you
can execute by performing:
SQL> @name_of_command_file
Anyway, my problem is that my queries are starting to become rather long for my taste so I was wondering if I could embed a command file inside a query? Something like:
$ cat my_command_file.sql
SELECT key FROM supplier WHERE city IN (SELECT name FROM city WHERE
state LIKE'Mass');
And then, inside SQL*Plus, do something like:
SQL> SELECT * FROM supply WHERE supplier IN (@my_command_file);
instead of:
SQL> SELECT * FROM supply WHERE supplier IN (SELECT key FROM supplier
WHERE city IN (SELECT name FROM city WHERE state LIKE'Mass'));
Or maybe there's a way to create short aliases for an expression and use that alias inside another expression and have SQL*Plus expand it when executing the query?
Thanks for any replies Received on Mon Sep 19 2005 - 14:50:13 CDT