Al,
When you say, "...I have a client who gave me access to his plsql...", what REALLY did the client GIVE you? To connect from your PC to your client's environment, s/he should have given you 1) a username, 2) a password, and 3) a "Host Service" alias that appears in a connectivity file (named "tnsnames.ora") on your local machine. That file usually appears in your ORACLE_HOME/network/admin directory. (ORACLE_HOME is logical name that probably resolves to something like "C:\Oracle\Ora81".) If you are missing any one of those three components, then your customer didn't really give you access to her/his database.
Additionally, (from a nomenclature perspective) you probably did not try to connect via "plsql" as you suggest; you probably attempted to connect via "SQL*Plus"...two very different Oracle components whose only common features are shared letters in their spellings.
Now, presuming that you do get connected to her/his database, some queries that you can issue to become more familiar with your environment are (from an SQL> prompt):
Code:
select * from all_users;
(displays username and other information about all other users [schemas] on the same database).
Code:
select table_name from user_tables;
(displays names of tables your login "owns".)
Now, for you last request, to "...become familiar with table relationships so I can create the sql code which will return desired data", perhaps the best way to see relationships (semi-graphically) amongst your tables is to save my script code, below, to a script, which I call "pk_fk.sql", then execute the code from your SQL> prompt as "SQL> pk_fk". The script generates a hierarchical tree-walk of all tables that your login owns, depicting the parent-child (primary key-to-foreign key) relationships within the schema. Here is the code:
Code:
REM **************************************************************
REM David L. Hunt (file author) distributes this and other
REM files/scripts for educational purposes only, to illustrate the
REM use or application of various computing techniques. Neither the
REM author nor Dasages, LLC makes any warranty regarding this
REM script's fitness for any industrial application or purpose nor is
REM there any claim that this or any similarly-distributed scripts
REM are error free or should be used for any purpose other than
REM illustration.
REM **************************************************************
set echo off
set pagesize 500
set feedback off
drop table uc
/
create table uc as
select table_name, constraint_name,
r_constraint_name from user_constraints
where constraint_type in ('P','R')
/
drop table pk_fk
/
create table pk_fk as
select decode(table_name,prior table_name,'(recursive)',table_name) detail,
prior table_name master
from uc
where prior table_name is not null
connect by prior constraint_name =
r_constraint_name
union
select
table_name detail, '' master
from uc
where not exists
(select 'x' from user_constraints
where uc.table_name = table_name
and constraint_type = 'R')
/
set pagesize 0
select
lpad(' ',(level-1)*3) ||
detail
from pk_fk
where master <> detail or master is null
connect by prior detail = master
start with master is null
/
set echo on
set feedback on
set pagesize 35
REM *** End of PK_FK.sql script ************************
Let us know if these responses help to resolve your needs.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA @ 20:05 (04Mar04) UTC (aka "GMT" and "Zulu"), 13:05 (04Mar04) Mountain Time)