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 6740541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:37:05+00:00 2026-05-26T11:37:05+00:00

I currently have an issue whereby I cannot reference a table in a linked

  • 0

I currently have an issue whereby I cannot reference a table in a linked database within a stored procedure. I get the error message:

ORA-00942: table or view does not exist

Here are the steps I took on the host machine (running oracle 10g) to set up the database link to the remote database (running oracle 11g). The steps are accurate, but some some names have been changed, though they have been kept consistent.

  1. Update tnsnames.ora, adding a new entry:

    REMOTE_DB =
        (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)
                       (HOST = 10.10.10.10)
                       (QUEUESIZE = 20)
                       (PORT = 1521)
            )
            (CONNECT_DATA =
                       (SERVICE_NAME = remote_service)
            )
        )
    
  2. Create database link, as the user who will later be creating and executing the stored procedure:

    create database link remote_link
    connect to "remote_user"
    identified by "remote_pass"
    using 'REMOTE_DB';
    
  3. Prove database link is working by selecting from it:

    select id from remote_table@remote_link;
    
    id
    --------------------------------------------------------------------------------
    8ac6eb9b-fcc1-4574-8604-c9fd4412b917
    c9e7ee51-2314-4002-a684-7817b181267b
    cc395a81-56dd-4d68-9bba-fa926dad4fc7
    d6b450e0-3f36-411a-ba14-2acc18b9c008
    
  4. Create stored procedure that depends on working database link:

    create or replace
    PROCEDURE test_remote_db_link
    AS
    v_id varchar(50);
    BEGIN   
        select id into v_id from remote_table@remote_link where id = 'c9e7ee51-2314-4002-a684-7817b181267b';
        dbms_output.put_line('v_id : ' || v_id);
    END test_remote_db_link;
    
  5. Explode own head after staring at the following error message for over an entire working day:

    Error(10,27): PL/SQL: ORA-00942: table or view does not exist
    

I have tried many things to try to sort this issue out, including:

  1. When creating the database link, not using quotes around the username and password. Link creates fine, but selecting from it gives me this error:

    ERROR at line 1:
    ORA-01017: invalid username/password; logon denied
    ORA-02063: preceding line from TWS_LINK
    
  2. Tried various combinations of username and password in upper/lowercase. Received same error as 1.

  3. Tried single quotes instead of double quotes around username and password. Recieved this error:

    ERROR at line 1:
    ORA-00987: missing or invalid username(s)
    
  4. Proved I have full access to the remote db by connecting into it with sqlplus:

    [oracle]$ sqlplus remote_user/remote_pass@REMOTE_DB
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 20 22:23:12 2011
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> 
    

I’m not sure what to do next. The possible next step is to start looking at issues on the remote database, and perhaps see if other databases can connect to it. Another would be to look at incompatibilities going from host 10g to remote 11g.

  • 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-05-26T11:37:06+00:00Added an answer on May 26, 2026 at 11:37 am

    OK so I was able to get this working, of sorts.

    It turns out that when creating the database link, the double quotes around the username and password fields were causing the issue. To summarise:

    If they were present, and the link created as so:

    create database link remote_link
    connect to "remote_user"
    identified by "remote_pass"
    using 'REMOTE_DB';
    
    1. The remote database could be queried via sql
    2. The stored procedure could not be compiled, recieving the ORA-942 error
    3. As the procedure could not be compiled, it could not be executed

    When the double quotes are not present:

    create database link remote_link
    connect to remote_user
    identified by remote_pass
    using 'REMOTE_DB';
    
    1. The remote database could not be queried via sql, recieving an invalid password error (detailed in the question)
    2. The stored procedure could be compiled with no errors.
    3. The stored procedure executes as expected, retrieving data from across the database link, and displaying it.

    So, even though the remote database cannot be querued via sql, recieving an invalid password error, the procedure that uses this same connection information compiles and executes normally.

    I’m sure you’ll agree, this is a curious state of events, and I genuinely stumbled across making it work in my scenario. I’m not quite sure I would call it a solution, as there are plenty of unanswered questions.

    Hopefully if someone comes here via google, they’ll find this answer useful, and at least get their code running.

    GC.

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

Sidebar

Related Questions

I have a database issue that i currently cannot wrap my head around with
I currently have a stored procedure which returns data and displayed in my report
I currently have an issue in my DLR language implementation where subsequent calls to
I currently have a issue with firefox, where all other browser behave in the
I do not currently have this issue , but you never know, and thought
I'm having an issue with multiple markers on google maps - I currently have
I currently have an MS Access application that connects to a PostgreSQL database via
We currently have a problem whereby on our stage servers, links that exist on
Okay, so I have an issue with an AJAX request. I currently have this
Hey guys another rails issue, Currently have a collection that is line items for

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.