Create a temp table from a select query -- dbVisualizer vs SQL Developer

3.6k views Asked by At

I've got a query:

SELECT < column names > 
INTO <#temp_table> 
FROM < table > 
WHERE < stuff > 

It runs fine in dbVisualizer. However, running it in Oracle SQL Developer gives me the error "The executeQuery method must return a result set."

What is happening here, and how can I fix it in SQL Developer?

EDIT: In response to Tanner, I get the errors when I try the following things (tell me if something I try is invalid. I'm new to SQL):

This:

    select * into #temp_table from status

produces this:

    The executeQuery method must return a result set.

This:

    select * into #temp_table from status;
    select * from #temp_table;

produces this:

    Invalid object name '#temp_table'.

And this:

    select *
    from(
      select * into #temp_table from status)

produces this:

    Incorrect syntax near the keyword 'into'.

I'm lost, ladies and gentledudes.

1

There are 1 answers

1
Tanner On

If you have a query like:

SELECT * 
INTO #TEMP 
FROM TABLE_A

That is simply creating and inserting data into a temp table.

What you need to do is return that temp table, so after you have run that code you need to do this:

SELECT * 
FROM #TEMP