Execute queries stored as text in table

Moderator: NorbertKrupa

Post Reply
Brett
Beginner
Beginner
Posts: 49
Joined: Fri Oct 11, 2013 1:19 am

Execute queries stored as text in table

Post by Brett » Wed Oct 16, 2013 7:29 pm

Good afternoon,

There is a function on Oracle called sql_execute that I've used to be able to execute queries that are stored in tables. We've used this as a means of limiting the queries folks can run in the database. Is this possible in vertica? For example if I store SELECT * FROM DUAL; in a table column I'd like to be able to dynamically query the table to run that statement.
Last edited by Brett on Sun Oct 27, 2013 5:33 am, edited 2 times in total.

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: Execute queries stored as text in table

Post by JimKnicely » Thu Oct 17, 2013 7:24 pm

You can do it in vsql like this:

Code: Select all

dbadmin=> select * from sql;
          c
---------------------
 select * from dual;
(1 row)

dbadmin=> \! /opt/vertica/bin/vsql -At -c "select * from sql" | vsql
 dummy
-------
 X
(1 row)
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Brett
Beginner
Beginner
Posts: 49
Joined: Fri Oct 11, 2013 1:19 am

Re: Execute queries stored as text in table

Post by Brett » Sun Oct 27, 2013 5:31 am

knicely,

Thanks for your reply. Do you think I can do what you gave as an example in a tool such as Tableau?

Post Reply

Return to “New to Vertica”