Good morning,
Is there a command in vsql that acts like the GET command in Oracle SQL*Plus that will just loads a host operating system file into the SQL buffer?
Is there a GET command?
Moderator: NorbertKrupa
Is there a GET command?
Thank you!
Joshua
Joshua
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Is there a GET command?
Hey Josh,
Hmm. I was hoping the \e meta-command would do the trick.
You can run a command like \e /home/dbadmin/test.sql. This will load the file into the default editor. For me it is vi, so I did a :wq! to save the file, but this will also execute the SQL. Then I tried just a :q! to exit vi, but this will not save the file to the SQL buffer.
Maybe once you load the the file into vi with the /e meta-command you can add a WHERE clause predicate like 1=2 so that even though the query is executed, no results are returned.
Hmm. I was hoping the \e meta-command would do the trick.
You can run a command like \e /home/dbadmin/test.sql. This will load the file into the default editor. For me it is vi, so I did a :wq! to save the file, but this will also execute the SQL. Then I tried just a :q! to exit vi, but this will not save the file to the SQL buffer.
Maybe once you load the the file into vi with the /e meta-command you can add a WHERE clause predicate like 1=2 so that even though the query is executed, no results are returned.
Code: Select all
dbadmin=> \e /home/dbadmin/test.sql
dbadmin=> \! cat /home/dbadmin/test.sql
select * from dual;
dbadmin=> \e /home/dbadmin/test.sql
dummy
-------
(0 rows)
dbadmin=> \p
select * from dual
where 1=2;
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
-
- GURU
- Posts: 527
- Joined: Tue Oct 22, 2013 9:36 pm
- Location: Chicago, IL
- Contact:
Re: Is there a GET command?
Not sure if it helps, but in the query buffer, you could omit the ; from the statement, then :wq and cancel from the line.
Code: Select all
dbadmin=> \e
dbadmin->
dbadmin=>
Checkout vertica.tips for more Vertica resources.
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Is there a GET command?
Yeah! That's brilliant, norbertk! And it works!
Code: Select all
dbadmin=> \e /home/dbadmin/test.sql
dbadmin->
dbadmin=> \p
select * from dual
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.