Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8266777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:16:59+00:00 2026-06-08T05:16:59+00:00

I am converting a MSSQL script to Oracle, and I haven’t been able to

  • 0

I am converting a MSSQL script to Oracle, and I haven’t been able to figure out the syntax to use a variable in place of a table name or column.

Here is a simple example that I’ve been try to make work in Oracle SQL Developer so I can better understand the syntax:

 set serveroutput on format wrapped;
declare 
  VR_TABLE VARCHAR2(256);
  VR_UPDATE VARCHAR2(256);
begin
  VR_TABLE :='SYSTEM_STATUS';
  EXECUTE IMMEDIATE 'select UPDATE_VERSION INTO VR_UPDATE from ' || VR_TABLE || 'where rownum < 2 ;'
end;

Where VR_TABLE is the variable table name that will get changed each iteration of the loop.
Can somebody point out what I’m doing wrong, or link me to a site that would be useful for me to read? I’ve read a few tutorials on this, but I haven’t had any luck thus far.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:17:01+00:00Added an answer on June 8, 2026 at 5:17 am
    1. You need to have a space between the table name and the subsequent WHERE clause
    2. The INTO needs to be part of the EXECUTE IMMEDIATE, not part of the dynamic SQL statement.
    3. The dynamic SQL statement should not have a trailing semicolon
    4. The EXECUTE IMMEDIATE statement should end with a semicolon

    Putting those together, something like this should work

    declare 
      VR_TABLE VARCHAR2(256);
      VR_UPDATE VARCHAR2(256);
    begin
      VR_TABLE :='SYSTEM_STATUS';
      EXECUTE IMMEDIATE 'select UPDATE_VERSION from ' || VR_TABLE || ' where rownum < 2'
                   INTO VR_UPDATE;
    end;
    

    Of course, since you’re not doing anything with VR_UPDATE, nothing will be displayed when this anonymous block is executed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the php script for converting a mysql table to text file? I
I'm converting a PHP script as DB has been switched from MySQL to PostgreSQL.
I'm converting a classified ad/flat file perl script to use mysql/dbi; I have this
I found alot of question on stack about converting mysql to mssql, but i
I need some help in converting my script from using mysql to mysqli I
I am having a problem converting a div to a php variable. This works
I'm converting a Unix Perl script to run on Windows. I'm having a problem
MySQL Gurus, I'm converting some reports from a MSSQL database for usage on a
We are upgrading/converting several old Access databases to MS-SQL. Many of these databases have
I am converting all my SQL Server queries to MySQL and my queries that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.