1

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.

NoSocks
  • 61
  • 1
  • 8
  • Are you actually using sql-server (the Microsoft RDBMS)? – Tab Alleman Jun 25 '15 at 14:12
  • Yessir. Why do you ask? – NoSocks Jun 25 '15 at 14:57
  • @NoSocks, can you explain better what are you using? Oracle or Microsoft. In comment you say Microsoft, in question you say Oracle, in tags you have both Oracle and Microsoft. Are you kidding? – Giorgi Nakeuri Jun 25 '15 at 15:12
  • I'm not kidding... I told you I'm new at this. I'm accessing a SQL Server database using the Oracle SQL Developer application. I'm trying to understand what is what. – NoSocks Jun 25 '15 at 15:16
  • I tagged sql-server because I'm accessing an SQL Server database. The application I am using is Oracle SQL Developer. My mistake. – NoSocks Jun 25 '15 at 15:25
  • I ask because I wonder why you would use Oracle SQL Developer with Sql-Server. Why not use SSMS? My best guess as to your problem is that the Oracle tool has a problem with the SELECT...INTO structure. Sounds like it sees a query that starts with "SELECT" and uses a command-type that expects a resultset, and errors if it doesn't get one. – Tab Alleman Jun 25 '15 at 15:30

1 Answers1

0

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
Tanner
  • 22,205
  • 9
  • 65
  • 83
  • Check out my edit. I tried to get the data and return it, but I can't figure out how. Any ideas? – NoSocks Jun 25 '15 at 15:03