Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> PL/SQL question

PL/SQL question

From: Hagedorn, Linda <lindah_at_epocrates.com>
Date: Thu, 15 Nov 2001 13:51:27 -0800
Message-ID: <F001.003C6C60.20011115133026@fatcity.com>

Can anyone can tell me how to use PL/SQL declared variables in a select statement where a . has to be between the owner and table name, and the owner and table name are variables, I'd be most appreciative.  The answer is probably obvious... Feel free to point it out. 

On import, we occasionally have sequences that are out of sync with the data.  To remedy this, I'm creating a master table that will match owner/table/column to owner/sequence, and a PL/SQL procedure that will increment sequences which are found to be lower than the max value in the associated owner/table/column. 

Matching_Table:

Table_owner
Table_name
Table_column

Sequence_owner
Sequence_name
Create_dt
Last_mod_dt

Pseudo code:

Declarations variables, output report file, counters. Read dba_sequences in cursor
Select table_owner, table_name, table_column into v_table_owner, v_table_name, v_table_column from matching_table a where sequence_owner = a.sequence_owner and sequence_name = a.sequence_name ;  (sequence_owner is from loop, reading dba_sequences)

if row is found then                            
  Select max(v_table_column) from v_table_owner.v_table_name ;

For the life of me I can't get this syntax right.  The parser is complaining because v_table_owner.v_table_name isn't declared.  I've tried || (concatenation), commas, single quotes, double quotes, colon, etc.  

If you can see the error, I'd be very happy for a reply. 

Thanks, Linda
echo
'[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc Received on Thu Nov 15 2001 - 15:51:27 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US