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

  • SEARCH
  • Home
  • 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 8040493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:54:51+00:00 2026-06-05T03:54:51+00:00

I want to do v$session@remotedatabase where remotedatabase is a variable for a dblink address.

  • 0

I want to do v$session@remotedatabase where remotedatabase is a variable for a dblink address. Is that possible?

I’m using Apex 4 and trying to get temporary space on all databases.

Current query

select 'Total temp space available in :Database is '||sum(bytes)/1024/1024 ||' mb' from v$tempfile@:Database

yeilds ORA-01729: database link name expected because the variable isn’t resolved correcltly?

  • 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-05T03:54:52+00:00Added an answer on June 5, 2026 at 3:54 am

    You would need to use dynamic SQL in order to have the database link be variable. In PL/SQL, that would look something like

    DECLARE
      l_sql_stmt varchar2(1000);
      l_tmp_space varchar2(1000);
      l_database  varchar2(100) := <<db link name>>;
    BEGIN
      l_sql_stmt := 'select ''Total temp space available in ' ||l_database  || ' is '' || sum(bytes)/1024/1024 ||'' mb'' from v$tempfile@' || l_database;
      dbms_output.put_line( l_sql_stmt );
      EXECUTE IMMEDIATE l_sql_stmt
        INTO l_tmp_space;
      dbms_output.put_line( l_tmp_space );
    END;
    

    Basically, you need to construct a string that contains the SQL statement and then execute that dynamically generated string (that’s more complicated when the SQL statement itself is building up a string as yours is here– that makes figuring out which single quotes to escape a bit of a challenge).

    Depending on what you are trying to do in APEX, however, you may want something a little different. For example, if you are trying to create a report based on this, a regular (non-interactive) report can be populated either from a SQL statement or a function that returns a SQL statement. If that’s what you’re trying to do, you’d want something like

    DECLARE
      l_sql_stmt varchar2(1000);
      l_tmp_space varchar2(1000);
      l_database  varchar2(100) := <<db link name>>;
    BEGIN
      l_sql_stmt := 'select ''Total temp space available in ' ||l_database  || ' is '' || sum(bytes)/1024/1024 ||'' mb'' from v$tempfile@' || l_database;
      dbms_output.put_line( l_sql_stmt );
      RETURN l_sql_stmt;
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I only want the session cookie on www.website.tld and www.apps.website.tld, using ini_set if possible.
I want to share my session variables in PHP using many subdomains. I have
I want to reuse a WebRequest object so that cookies and session would be
I want to delete all the elements from my list: foreach (Session session in
I want to use session with my silverlight4 application to store data for temporary
I want one session variable to be cleaned every 24 hours .I don't want
I want to clear session when browser window closed. But when i am trying
I'm using express framework. I want to reach session data from socket.io. I tried
net 2.0 and I want admin session variable timeout for 1 hour. Is it
I have using jsp technology in my project.I want to do session tracking in

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.