sql - Oracle / PLSQL - Using column results in a where clause -


i've been trying simple still can't. trying interate on table , use each row of column in clause display query.

for example:

i want retrieve users dba_users pass clause in query show example account_status , profile every user. want in way can turn result many html tables.

i've tried many things really, post doesn't work think show problem having,

begin  in (select username dba_users order 1)  loop  execute immediate 'select account_status dba_users username ''||i.username||''';  end loop;  end;  / 

edit: here's example of want achieve:

  1. read 2 sql_ids v$sql

    sql> select sql_id v$sql rownum < 3;

    sql_id

    9avfy3fv2wq2x
    0ywp98ffdz77f

  2. use returned ids gather performance info , results in 2 result sets

-- html markup

set markup html on head " -   " -   body "" -   table "border='1' align='center' summary='script output'" -   spool on entmap on preformat off    select sql_id, loads_total dba_hist_sqlstat sql_id '9avfy3fv2wq2x';   select sql_id, loads_total dba_hist_sqlstat sql_id '0ywp98ffdz77f';   

and following results

sql_id        loads_total   ------------- -----------   9avfy3fv2wq2x          21    sql_id        loads_total   ------------- -----------   0ywp98ffdz77f          12   

using markup tag, translates into:

example

thanks in advance time,

od

try using cursor:

 declare     cursor users       select username dba_users ;   begin      user in user     loop        select account_status dba_users username = user;     end loop;   end;  

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -